The MPI tool information interface requires a separate set of initialization and finalization routines.
MPI_T_INIT_THREAD(required, provided) | |
IN required | desired level of thread support (integer) |
OUT provided | provided level of thread support (integer) |
All programs or tools that use the MPI tool information interface must initialize the MPI tool information interface in the processes that will use the interface before calling any other of its routines. A user can initialize the MPI tool information interface by calling MPI_T_INIT_THREAD, which can be called multiple times. In addition, this routine initializes the thread environment for all routines in the MPI tool information interface. Calling this routine when the MPI tool information interface is already initialized has no effect beyond increasing the reference count of how often the interface has been initialized. The argument required is used to specify the desired level of thread support. The possible values and their semantics are identical to the ones that can be used with MPI_INIT_THREAD listed in Section MPI and Threads. The call returns in provided information about the actual level of thread support that will be provided by the MPI implementation for calls to MPI tool information interface routines. It can be one of the four values listed in Section MPI and Threads.
The MPI specification does not require all MPI processes to exist before MPI is initialized. If the MPI tool information interface is used before initialization of MPI, the user is responsible for ensuring that the MPI tool information interface is initialized on all processes it is used in. Processes created by the MPI implementation during initialization inherit the status of the MPI tool information interface (whether it is initialized or not as well as all active sessions and handles) from the process from which they are created.
Processes created at runtime as a result of calls to MPI's dynamic process management require their own initialization before they can use the MPI tool information interface.
Advice to users.
If MPI_T_INIT_THREAD is called before
MPI_INIT_THREAD, the requested and provided thread level for
MPI_T_INIT_THREAD may influence the behavior and return value
of MPI_INIT_THREAD. The same is true for the reverse order.
Likewise, when using the Sessions Model (Section The Sessions Model), the requested
and provided thread level for MPI_T_INIT_THREAD may influence
the behavior and return values of MPI_SESSION_INIT (see Section The Sessions Model), with the
same being true for the reverse order.
( End of advice to users.)
Advice
to implementors.
MPI implementations should strive to make as many control or performance
variables available before MPI initialization (instead of adding them
during initialization) to allow tools the most flexibility. In
particular, control variables should be available before
MPI initialization if their value cannot be changed after
MPI initialization.
( End of advice to implementors.)
int MPI_T_finalize(void)
This routine finalizes the use of the MPI tool information interface and may be called as often as the corresponding MPI_T_INIT_THREAD routine up to the current point of execution. Calling it more times returns a corresponding return code. As long as the number of calls to MPI_T_FINALIZE is smaller than the number of calls to MPI_T_INIT_THREAD up to the current point of execution, the MPI tool information interface remains initialized and calls to its routines are permissible. Further, additional calls to MPI_T_INIT_THREAD after one or more calls to MPI_T_FINALIZE are permissible.
Once MPI_T_FINALIZE is called the same number of times as the routine MPI_T_INIT_THREAD up to the current point of execution, the MPI tool information interface is no longer initialized. The user can reinitialize the interface by a subsequent call to MPI_T_INIT_THREAD.
At the end of the program execution, unless MPI_ABORT is called, an application must have called MPI_T_INIT_THREAD and MPI_T_FINALIZE an equal number of times.