-
Notifications
You must be signed in to change notification settings - Fork 33
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
Avoid initializing MPI in regression tests #320
Conversation
Addresses an issue with hygiene when importing the h5py module. Importing h5py causes future MPI operations in the process or child process to fail (probably due to unpaired MPI_Init). Fixes #312
I'm not sure I ran across the same problem, but in a different context I "fixed" an issue by using the following initialization order: import mpi4py
mpi4py.rc(initialize=False)
from mpi4py import MPI
import h5py
MPI.Init() Would you mind testing that approach and see if this fixes it? (I don't have access to the system where it's nor working). |
@pgrete I'm glad somebody else ran into this before. :) Let me see... the thing is, the MPI initialization seemed to be coming out of the loading of a native library in |
That did work! I'll promote it to run_test.py. I didn't seem to actually need to call |
Just wrap the MPI import in a try-catch block, in case I was going to suggest moving the script in the string into it's own file in |
@AndrewGaspar Thanks so much for fixing this, @pgrete thanks for the suggestion. This is great! And @Yurlungur thanks for your suggestions! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 👍
Thanks for digging into this.
@pgrete I assume you're good with this change then? |
Phil signed off on the call. |
Addresses an issue with hygiene when importing the h5py module.Prevent
mpi4py
from initializing MPI.Fixes #312
PR Summary
Importing h5py causes future MPI operations in the process or child process to fail (probably due to unpaired MPI_Init) for some implementations of MPI, such as openmpi 4.0.2 on Darwin Power9.
Therefore, this change runs restart.py's TestCase.Analyse script in a child process to maintain hygiene in the test process.This change stops thempi4py
transitive dependency from initializing MPI when present.A possible alternative solution would be to import h5py in the scope of the Analyse function. My concern with this is that futurempiexec
commands would fail, and I don't know if we're guaranteed to never have any more. This solution is more complete, but less pretty.PR Checklist