A non-instantiable wrapper class to track MPI-related statistics. More...
#include <MPIStats.h>
Static Public Member Functions | |
static void | displayStats (std::ostream &os, const std::string &indent=" ") |
Displays statistics collated thus far. | |
Static Public Attributes | |
static double | idleTime = 0.0 |
Cumulative time spent idling. | |
static int | sendCount = 0 |
Number of messages sent by this process. | |
static int | recvCount = 0 |
Number of messages received by this process. | |
static int | bcastCount = 0 |
Number of messages broad casted by this process. | |
static int | reduceCount |
Number of times reduction operation was performed by this process. | |
static int | probeCount = 0 |
Number of time this process probed for messages. | |
Private Member Functions | |
MPIStats () | |
The default constructor. | |
~MPIStats () | |
The destructor. |
A non-instantiable wrapper class to track MPI-related statistics.
This class is a simple wrapper class that is used to encapsulate the statistic gathered during program execution. The statistics collated by this class related to MPI calls. In order to facilitate statistics collection without cluttering MPI code, this class provides a set of handy macros for various MPI macro calls, namely: MPI_PROBE, MPI_SEND, MPI_RECV, MPI_BCAST, and TRACK_IDLE_TIME. Use the aforementioned macros to streamline your code. Finally, at the end of MPI processing use MPIStats::displayStats() method do display the statistics gathered by this method.
Definition at line 56 of file MPIStats.h.
MPIStats::MPIStats | ( | ) | [inline, private] |
The default constructor.
The default constructor has is private in order to ensure that this class is never instantiated. Instead, the static methods and static instance variables in this class are directly used.
Definition at line 199 of file MPIStats.h.
MPIStats::~MPIStats | ( | ) | [inline, private] |
The destructor.
The destructor is private to ensure that objects of this class can never be deleted (as they cannot be created either).
Definition at line 206 of file MPIStats.h.
void MPIStats::displayStats | ( | std::ostream & | os, | |
const std::string & | indent = " " | |||
) | [static] |
Displays statistics collated thus far.
This method is invoked at the end of the makeClusters() method to display performance related statistics for this class. This method displays the following information:
The time spent idling waiting for messages to arrive (in seconds). This information is tracked in the idleTime instance variable.
The number of messages that were sent (essentially calls to MPI Send method). This information is tracked in the sendCount instance variable.
The number of messages that were received (essentially calls to MPI Recv method). This information is tracked in the recvCount instance variable.
The number of calls to broadcast (essentially calls to MPI Bcast method). This information is tracked in the bcastCount instance variable.
The number of reduction operations (essentially calls to MPI Reduce method). This information is tracked in the reduceCount instance variable.
The number of calls to proble (essentially calls to MPI probe method). This information is tracked in the probeCount instance variable.
[out] | os | The output stream to which all the information must be written. |
[in] | indent | An indentation prefix to be used to indent the outputs generated by this method. The default indentation prefix is 4 spaces. |
Definition at line 49 of file MPIStats.cpp.
References bcastCount, idleTime, probeCount, recvCount, and sendCount.
int MPIStats::bcastCount = 0 [static] |
Number of messages broad casted by this process.
This static instance variable (initialized to 0 (zero)) is used to essentially track the number of calls to MPI bcast method. This variable must be incremented each time MPI's bcast method is invoked. This variable is finally printed in the displayStats() method.
Definition at line 118 of file MPIStats.h.
Referenced by displayStats().
double MPIStats::idleTime = 0.0 [static] |
Cumulative time spent idling.
This static instance variable (initialized to 0) maintains the cumulative time spent by this process idling, waiting for messages to arrive from another process. This value is tracked by wrapping each MPI probe call (or MPI recv as the case may be) with the TRACK_IDLE_TIME macro. The time is tracked using the Wtime() method defined by MPI.
Definition at line 67 of file MPIStats.h.
Referenced by displayStats().
int MPIStats::probeCount = 0 [static] |
Number of time this process probed for messages.
This static instance variable (initialized to 0 (zero)) is used to essentially track the number of calls to MPI probe method. This variable must be incremented each time MPI's bcast method is invoked. This variable is finally printed in the displayStats() method.
Definition at line 144 of file MPIStats.h.
Referenced by displayStats().
int MPIStats::recvCount = 0 [static] |
Number of messages received by this process.
This static instance variable (initialized to 0 (zero)) is used to essentially track the number of calls to MPI recv method. This variable must be incremented each time MPI's recv method is invoked. This variable is finally printed in the displayStats() method.
If you would also like to track the time spent to recv a certain message as idle time then you can easily achieve this objective as shown in the code fragement below:
#include "MPIHelper.h" void someMethod() { TRACK_IDLE_TIME(MPI_SEND(b, 1, MPI_TYPE_INT, rank, tag)); }
Definition at line 105 of file MPIStats.h.
Referenced by displayStats().
int MPIStats::reduceCount [static] |
Number of times reduction operation was performed by this process.
This static instance variable (initialized to 0 (zero)) is used to essentially track the number of calls to MPI reduce method. This variable must be incremented each time MPI's reduce method is invoked. This variable is finally printed in the displayStats() method.
Definition at line 131 of file MPIStats.h.
int MPIStats::sendCount = 0 [static] |
Number of messages sent by this process.
This static instance variable (initialized to 0 (zero)) is used to essentially track the number of calls to MPI send method. This variable must be incremented each time MPI's send method is invoked. This variable is finally printed in the displayStats() method.
Definition at line 80 of file MPIStats.h.
Referenced by displayStats().