[Mpi3-hybridpm] Better Forum INIT/FINALIZE slides

Jeff Squyres (jsquyres) jsquyres at cisco.com
Tue Jul 30 08:35:27 CDT 2013

On Jul 29, 2013, at 9:31 PM, Pavan Balaji <balaji at mcs.anl.gov> wrote:

> I prefer not changing the semantics of something that already exists. In the current semantics, once INITIALIZED/FINALIZED are set, they can never change their values.

The more I think about this, the less I think that an MPI function indicating whether or not MPI is in an epoch is necessary:

1. One of the main ideas behind this proposal is that if you don't know if you can call MPI functions, just call MPI_INIT.

2. However, there are undoubtedly situations where you don't want to call MPI_INIT (e.g., where you need a local-only operation).  But in this case, why wouldn't you use some local variable to know whether MPI has been initialized or not?  Such a local variable could be protected with app-specific locking and therefore not be racy, like INITIALIZED/FINALIZED/IN_EPOCH.

3. To clarify #2, the original argument for INITIALIZED/FINALIZED was that library A in a process might not know that library B already called MPI_INIT/MPI_FINALIZE.  But now every library will always be able to know this, because every library should call MPI_INIT/MPI_FINALIZE themselves.

4. Indeed, an MPI_IN_EPOCH type of function might accidentally lead to erroneous code.  Consider something like this:

T=0   Library A and library B (in different threads) call MPI_INIT
T=N   Library B shuts down all local MPI state and calls MPI_FINALIZE
      *** Note that library A has _not_ called MPI_FINALIZE
T=N+1 Async thread in library B calls IN_EPOCH to see if MPI is still initialized

Since IN_EPOCH will return true, the thread in library B may erroneously try to do something with the MPI state in library B that has already been torn down.

My point (which mirrors #2, above): *it's not enough to know whether MPI is in an epoch or not;* each library will also need to know whether its internal MPI state (e.g., local communicators, ...etc.) is valid or not.

*** So perhaps we should just deprecate INITIALIZED/FINALIZED and not replace them with anything.

Jeff Squyres
jsquyres at cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/

More information about the mpiwg-hybridpm mailing list