MolSSI / QCEngine

Quantum chemistry program executor and IO standardizer (QCSchema).
https://molssi.github.io/QCEngine/
BSD 3-Clause "New" or "Revised" License
163 stars 78 forks source link

Importing qcengine breaks OpenMPI programs #399

Closed awvwgk closed 1 year ago

awvwgk commented 1 year ago

Describe the bug

Importing qcng modifies the environment and can break running all OpenMPI programs.

To Reproduce

import subprocess
subprocess.run("printenv > previous.txt", shell=True)
import qcengine as qcng
subprocess.run("printenv > later.txt", shell=True)
--- previous.txt        2023-03-01 11:21:03.382801986 +0000
+++ later.txt   2023-03-01 11:21:12.898774636 +0000
@@ -2,0 +3 @@
+OMPI_MCA_pmix=^s1,s2,cray,isolated
@@ -5,0 +7 @@
+OMPI_MCA_ess=singleton
@@ -7,0 +10 @@
+PMIX_RANK=0
@@ -14,0 +18,4 @@
+PMIX_NAMESPACE=1256783873
 ...

Expected behavior

Modify environment transparently in the qcng provided util.execute wrapper, with possibility to turn off if unwanted.

Additional context

python                    3.10.9          he550d4f_0_cpython    conda-forge
python_abi                3.10                    3_cp310    conda-forge
qcengine                  0.26.0             pyhd8ed1ab_0    conda-forge
qcelemental               0.25.1             pyhd8ed1ab_1    conda-forge
loriab commented 1 year ago

Yes, I see it. Easy to avoid, but a completely robust solution is harder since MDI is in a class by itself.

loriab commented 1 year ago

In the meantime, mpi4py has been removed by #401, so solved permanently w/o #420 bandaid.