Reputation: 1463
I understand that MPI_init can only be called more than once per executable instance. Can anyone clarify the limits of this language: ie:
Thanks!
Upvotes: 0
Views: 2390
Reputation: 22670
If I understand you correctly, the easiest way would be to intercept the calls to MPI_Init
and execute it only once. For C, MPI provides the PMPI Profiling Interface that allows you to override any MPI symbol and provides an additional PMPI symbol. E.g. you define a function MPI_Init
and in that function, depending if it is called for the firs time, call PMPI_Init
. The same (in reverse) for MPI_Finalize
.
I am not sure about the most elegant way to do that in Python. I assume you could just hack into the python bindings or LD_PRELOAD
a simple C library doing the magic.
All of that is just a workaround, that might have bad side effects. MPI Implementations advise you to not do much before an MPI_Init
. The real solution would be fixing the code to use MPI appropriately.
Upvotes: 1