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

Allow Python bindings to control MPI setup in the OPM::Main constructor #5325

Merged
merged 2 commits into from
May 2, 2024

Conversation

hakonhagland
Copy link
Contributor

@hakonhagland hakonhagland commented May 1, 2024

Allows the Python bindings to control whether MPI_Init() and MPI_Finalize() will be called when creating an Opm::Main object. This allows the Python unit test files to run more than a single unit test. Currently, only a single unit test could be run per test file since each test would create a new simulator object (calling the Opm::Main constructor) which would call MPI_Init() a second time (after MPI_Finalize() had been called for the first test case) which would give an error like:

*** The MPI_Init() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.

(This is because it is not possible to unload the Python module opm.simulators.BlackOilSimulator (which btw links dynamically with libmpi.so) within a single Python script)

An idea for a future PR could be to allow the Python bindings to switch off MPI completely.

@hakonhagland
Copy link
Contributor Author

jenkins build this please

@hakonhagland
Copy link
Contributor Author

jenkins build this please

@hakonhagland
Copy link
Contributor Author

jenkins build this please

Allows the Python bindings to control whether MPI_Init() and
MPI_Finalize() will be called when creating an OPM::Main object.
@hakonhagland
Copy link
Contributor Author

jenkins build this please

@hakonhagland
Copy link
Contributor Author

jenkins build this please

@akva2 akva2 merged commit 0c3da92 into OPM:master May 2, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants