Skip to content
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

Different behavior of Popen with and without pyoptsparse. #358

Closed
NAnand-TUD opened this issue Sep 25, 2023 · 4 comments
Closed

Different behavior of Popen with and without pyoptsparse. #358

NAnand-TUD opened this issue Sep 25, 2023 · 4 comments

Comments

@NAnand-TUD
Copy link

Description

I installed pyoptsparse using the build_pyoptsparse repo on openMDAO git page. The import and everything is working fine, however, it seems that pyoptsparse has some interference with the subprocess package.

Steps to reproduce issue

So Running

import subprocess as sp
sp.Popen('mpirun -n 2 SU2_CFD flow.cfg')

I get the SU2 running.

However with the one below,

import subprocess as sp
import pyoptsparse
sp.Popen('mpirun -n 2 SU2_CFD flow.cfg')

Perhaps anyone in the community has faced a similar problem? Or has knowledge of possible interference?

Thanks
Nitish

@marcomangano
Copy link
Contributor

Hi Nitish,
I suspect you might be encountering something similar to what has been discussed here. One of the dependencies imports mpi4py and that might be causing issues in your environment. Do you experience this issue any time you use Popen or specifically when you call mpirun?

@NAnand-TUD
Copy link
Author

Hi Marco,

Thanks for your swift response. I made some checks and indeed the issue was with mpi.

Unfortunately the option PYOPTSPARSE_REQUIRE_MPI=NO did not work for me. I have no clue why. However, I explicitly installed mpi4py and now pyoptsparse works with Popen, though it shows a small waning.

I can use Pyoptsparse now and can continue with my optimization.

Thanks again for your help.

Cheers,
Nitish

@marcomangano
Copy link
Contributor

Good to know you found a workaround @NAnand-TUD! Do you mind sharing the warning here for future reference?

@NAnand-TUD
Copy link
Author

Definitely, that is the least I can do for your help.

UserWarning: mpi4py could not be imported. mpi4py is required to use the parallel gradient analysis and parallel objective analysis for non-gradient based optimizers. Continuing using a dummy MPI module from pyOptSparse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants