16.2.4. Miscellaneous Control of Profiling
Up: Profiling Interface
Next: MPI Library Implementation
Previous: Logic of the Design
There is a clear requirement for the user code to be able to control the
profiler dynamically at run time. This capability is normally used for (at
least) the purposes of
- Enabling and disabling profiling depending on the state of the
calculation.
- Flushing trace buffers at noncritical points in the calculation.
- Adding user events to a trace file.
These requirements are met by use of MPI_PCONTROL.
MPI_PCONTROL(level, ...) |
IN level | Profiling level (integer) |
C binding
int MPI_Pcontrol(const int level, ...)
Fortran 2008 binding
MPI_Pcontrol(level)
INTEGER, INTENT(IN) :: level
Fortran binding
MPI_PCONTROL(LEVEL)
INTEGER LEVEL
MPI libraries themselves make no use of this routine, and simply return
immediately to the user code. However the presence of calls to this
routine allows a profiling package to be explicitly called by the user.
Since MPI has no control of the implementation of the profiling code, we
are unable to specify precisely the semantics that will be provided by
calls to MPI_PCONTROL. This vagueness extends to the number of
arguments to the function, and their datatypes.
However to provide some level of portability of user codes to different
profiling libraries, we request the following meanings for certain values
of level.
- level=0
Profiling is disabled.
- level=1
Profiling is enabled at a normal default level of detail.
- level=2
Profile buffers are flushed, which may be a no-op in some profilers.
- All other values of level
have profile library defined effects and additional arguments.
We also request that the default state after MPI has been
initialized is for profiling to be enabled at the normal default level. (i.e.,
as if MPI_PCONTROL had just been called with the argument 1).
This allows users to link with a profiling library and to obtain profile
output without having to modify their source code at all.
The provision of MPI_PCONTROL as a no-op in the standard MPI
library supports the collection of more detailed profiling information with
source code that can still link against the standard MPI library.
Example
A wrapper to accumulate the total amount of data sent by the
MPI_SEND function, along with the total elapsed time spent in
the function.
Up: Profiling Interface
Next: MPI Library Implementation
Previous: Logic of the Design
Return to MPI-4.1 Standard Index
Return to MPI Forum Home Page
(Unofficial) MPI-4.1 of November 2, 2023
HTML Generated on November 19, 2023