The easiest way to write CLOG logfiles is automatically, using the MPI
profiling interface. (See Section 8.1 of [20] and Section 7.6 of
[10].) The MPI standard specifies a mechanism by which all MPI
calls may be intercepted by the user, who can define a profiling
library containing his own versions of the MPI functions. Distributed
with the MPICH portable implementation of
MPI [6,9] is such a profiling library
to write CLOG records, logging the start time and end time of all MPI calls,
thus logging a state for Jumpshot for the time a process is executing an MPI
call. The profiling version of MPI_Finalize causes the local logs to
be merged and the logfile to be written as described in
Section How It Works
. In order to cause this to happen, one need only link
the profiling library in front of the MPI library one is using. In MPICH,
this is conveniently accomplished by using MPICH scripts for linking, which
have flags to link in various profiling libraries. For example,
mpicc -mpilog -o myprog myprog.cwill cause the profiling library for CLOG logging to be automatically linked in. When myprog is run with
mpirun -np 64 myproga CLOG logfile will automatically be produced, suitable for viewing with Jumpshot.
The MPI_Pcontrol function, when used with this profiling library, can be used to turn logging on and off dynamically in the program. This can be used, for example, to collect logging data for a single iteration of a complex loop that is executed many times.