New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDMA termination when launched from python #1334

Open
FloLangenfeld opened this Issue Nov 6, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@FloLangenfeld

FloLangenfeld commented Nov 6, 2018

Launching GDMA calculations from a python script or python interpreter causes a sudden crash. Ouptu files indicates that previous steps finish with no eroor and a GDMA input file is created, as well as a log file (fort.52, attached) with this message: Could not open psi4 output for writing.unit = 51.

On the contrary, launching the same calculations with the psi4 executable does not produce any error.

This bug was originally reported and discussed on the psi4 forum

The bug can be reproduce using the sample gdma h2o.dat file and its python equivalent

@hokru

This comment has been minimized.

Contributor

hokru commented Nov 6, 2018

The gdma wrapper expects an output file and/or fails to detect stdout correctly
https://github.com/psi4/psi4/blob/master/psi4/src/psi4/gdma_interface/wrapper.cc#L51

A work around is to specify an output file for the python script
psi4.core.set_output_file("script.out")

@FloLangenfeld

This comment has been minimized.

FloLangenfeld commented Nov 6, 2018

This workaround solved the problem. Many thanks for your quick reply!
Still, it seems weird to me that the default stdout is not detected properly...

@hokru

This comment has been minimized.

Contributor

hokru commented Nov 6, 2018

This rather seems to be a problem on the gdma (fortran) side, which wants to open an existing file and cannot handle stdout yet.
https://github.com/psi4/gdma/blob/master/src/gdma.f90#L95

@FloLangenfeld

This comment has been minimized.

FloLangenfeld commented Nov 6, 2018

But why does GDMA work when called through the psi4 binary?
Both psi4 python and pis4 binary use the same GDMA executable in the background (maybe I am wrong on this?), and gdma handles the stdout well when called with the binary (i.e. without python wrapping). It rather seems to me that the stdout connection between python and gdma is somehow broken and results in this bug.

@hokru

This comment has been minimized.

Contributor

hokru commented Nov 6, 2018

Same binary yes, but the Fortran code of gdma expects an existing file in the directory that it can open to append its output to. To allow here stdout it needs adjustments. The psi4 binary always(?) writes an output file.
PSI4 uses a slightly modified gdma binary for better interfacing, I believe.

tagging the code author @andysim

@JonathonMisiewicz

This comment has been minimized.

Contributor

JonathonMisiewicz commented Nov 6, 2018

I should add that I was able to observe the bug even when piping the Python output to an output.dat file. I had (naively) assumed that GDMA would be able to find it, but apparently not.

Good to hear about set_output_file. I didn't know that one!

@hokru

This comment has been minimized.

Contributor

hokru commented Nov 6, 2018

proposed fix: psi4/gdma#5
PSI4 uses a library version of gdma, not a stand-alone binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment