<div dir="ltr"><div>Hello Ole,</div><div><br></div><div>Yes, I am using MPI. I am running CP2K on cori, which is a Cray system.</div><div>I am not very sure, but it seems that the MPI is mpich, because the cray-mpich module is loaded when I run CP2K.</div><div><br></div><div>I have 331 atoms in the calculations. I tried to reduce the position string</div><div>self._shell.send('%.18e %.18e %.18e' % tuple(pos))</div><div>to <br></div><div>self._shell.send('%.8e %.8e %.8e' % tuple(pos))</div><div><br></div><div>I assumed this may avoid possible deadlock of the PIPE, but it does not work in the end.</div><div><br></div><div>Best</div><div><br></div><div>Geng<br></div><div> <br></div><br>在 2018年12月4日星期二 UTC-8下午12:59:20,Ole Schütt写道:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Hi Geng,
<br>
<br>are you using MPI? Then this is probably where the buffering happens.
<br>Depending on which MPI implementation you are using there might be a way
<br>to tweak its stdin/out forwarding.
<br>
<br>Out of curiosity, how many atoms does your system have? Maybe the
<br>Fortran side simple tries to read too many values?
<br>
<br>-Ole
<br>
<br>
<br>On 2018-12-04 21:27, Geng Sun wrote:
<br>> Hello Ole,
<br>>
<br>> Thank you very much for your reply:
<br>> I changed the code as you suggested (below), but the problem is still
<br>> present in the test.
<br>>
<br>> Best
<br>>
<br>> Geng
<br>>
<br>> def send(self, line):
<br>> """Send a line to the cp2k_shell"""
<br>> assert self._child.poll() is None # child process still
<br>> alive?
<br>> if self._debug:
<br>> #print('Sending: ' + line)
<br>> sys.stderr.write("Sending: {}\n".format(line))
<br>> sys.stderr.flush()
<br>>
<br>> if self.version < 2.1 and len(line) >= 80:
<br>> raise Exception('Buffer overflow, upgrade CP2K to r16779
<br>> or later')
<br>> assert(len(line) < 800) # new input buffer size
<br>> self.isready = False
<br>> self._child.stdin.write(line + '\n')
<br>> self._child.stdin.flush()
<br>>
<br>> 在 2018年12月4日星期二 UTC-8上午11:05:43,Ole
<br>> Schütt写道:
<br>>
<br>>> Hi Geng,
<br>>>
<br>>> this sounds indeed like a buffering issue. Could you once try to add
<br>>> a
<br>>> flush() on the python side.
<br>>>
<br>>> Basically add the following line after cp2k.py:498.
<br>>>
<br>>> self._child.stdin.write(line + '\n')
<br>>> + self._child.stdin.flush()
<br>>>
<br>>> This is probably quite inefficient. So, if it works I'll add some
<br>>> logic
<br>>> to flush only when recv() follows a send().
<br>>>
<br>>> -Ole
<br>>>
<br>>> On 2018-12-04 18:08, Geng Sun wrote:
<br>>>> Dear CP2K users,
<br>>>>
<br>>>> In the past several weeks, I frequently faced a problem when I
<br>>> use
<br>>>> the CP2K -ASE interface.
<br>>>>
<br>>>> The calculations frequently got stuck during the calculations.
<br>>>>
<br>>>> 1) Firstly I switched on the debug=True option in the ASE-CP2K
<br>>>> calculator and I found that the calculation always gets stuck at a
<br>>>
<br>>>> line with *END after sending the positions to the subroutine
<br>>>> cp2k_shell.popt (I printed the information to the standard error,
<br>>> so
<br>>>> they are not buffered)
<br>>>>
<br>>>> 2) Then, I modified the cp2k_shell.F to print a lot of "labels".
<br>>> Then
<br>>>> I found that the code may get stuck at the line of "READ
<br>>>> (*,*,iostat=iostat) pos" like below. I can always get "begin to
<br>>> read
<br>>>> pos" in the standard error, but I can not reach "LABEL-1".
<br>>>>
<br>>>> WRITE(0,*) "begin to read pos"
<br>>>> CALL m_flush(0)
<br>>>> READ (*,*,iostat=iostat) pos
<br>>>> WRITE(0,*) "LABEL-1"
<br>>>> CALL m_flush(0)
<br>>>>
<br>>>> I attached the modified cp2k_shell.F and the standard out/error
<br>>>> generated by the slurm batch system with this post. You can see
<br>>> that
<br>>>> the program get stuck at the second optimization step just after
<br>>>> sending the positions.
<br>>>>
<br>>>> I greatly appreciate your suggestions for fixing this confusing
<br>>> bugs.
<br>>>>
<br>>>> Thanks in advance.
<br>>>>
<br>>>> Geng
<br>>>>
<br>>>> --
<br>>>> You received this message because you are subscribed to the Google
<br>>>
<br>>>> Groups "cp2k" group.
<br>>>> To unsubscribe from this group and stop receiving emails from it,
<br>>> send
<br>>>> an email to <a>cp2k+...@googlegroups.com</a>.
<br>>>> To post to this group, send email to <a>cp...@googlegroups.com</a>.
<br>>>> Visit this group at <a href="https://groups.google.com/group/cp2k" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/group/cp2k';return true;" onclick="this.href='https://groups.google.com/group/cp2k';return true;">https://groups.google.com/<wbr>group/cp2k</a> [1].
<br>>>> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/<wbr>optout</a> [2].
<br>>
<br>> --
<br>> You received this message because you are subscribed to the Google
<br>> Groups "cp2k" group.
<br>> To unsubscribe from this group and stop receiving emails from it, send
<br>> an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="giDjM-5_AAAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">cp2k+uns...@googlegroups.<wbr>com</a>.
<br>> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="giDjM-5_AAAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">cp...@googlegroups.com</a>.
<br>> Visit this group at <a href="https://groups.google.com/group/cp2k" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/group/cp2k';return true;" onclick="this.href='https://groups.google.com/group/cp2k';return true;">https://groups.google.com/<wbr>group/cp2k</a>.
<br>> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/<wbr>optout</a>.
<br>>
<br>>
<br>> Links:
<br>> ------
<br>> [1] <a href="https://groups.google.com/group/cp2k" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/group/cp2k';return true;" onclick="this.href='https://groups.google.com/group/cp2k';return true;">https://groups.google.com/<wbr>group/cp2k</a>
<br>> [2] <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/<wbr>optout</a>
<br>
<br></blockquote></div>