open-mpi / ompi

Open MPI main development repository
https://www.open-mpi.org
Other
2.18k stars 861 forks source link

ofi/common: fix code that broke sessions #12870

Closed hppritcha closed 1 month ago

hppritcha commented 1 month ago

With sessions initialization model (section 11.3 of MPI 4 standard) MPI may be initialized and finalized any number of times.

This patch refactors code that was assuming a one shot init/finalize sequence for initializing Open MPI and its MCA param space

The underlying problem with the replaced code was that when an app calls MPI_Session_finalize and there are no more sessions active, the MCA param space is destroyed. So if one does not build Open MPI to use dynamically load components, and a component is using static variables in a way that assumes the MCA param space is always preserved if a static variable is set to some value, then things break if a subsequent MPI_Session_init is invoked.

Related to #12869