The ZOLTAN_TIMER uses Zoltan_Time to obtain the current clock time.
NOTE: The current implementation of ZOLTAN_TIMER relies on two assumptions to work correctly.
In future work, these constraints may be weakened so that, for instance, different processors may have different numbers of timers or skip synchronization points.
Source code location: | Utilities/Timer |
Function prototypes file: | Utilities/Timer/zoltan_timer.h or include/zoltan_timer.h Utilities/Timer/zoltan_timer_cpp.h or include/zoltan_timer_cpp.h |
Library name: | libzoltan_timer.a |
Other libraries used by this library: | libmpi.a and libzoltan_mem.a. |
Routines:
Zoltan_Timer_Create: Creates a ZOLTAN_TIMER object to store timers. |
|
Use in Zoltan:
The ZOLTAN_TIMER utilities are used in Zoltan's graph and hypergraph algorithms. It is activated by setting parameter use_timers to a positive integer value. |
C: | struct Zoltan_Timer *Zoltan_Timer_Create( int timer_flag); |
C++: | Zoltan_Timer_Object(int timer_flag); |
In the C++ interface, the Zoltan_Timer_Object class represents a Zoltan_Timer data structure and the functions that operate on it. It is the constructor that allocates an instance of a Zoltan_Timer_Object. It has no return value.
Input Arguments: | |
timer_flag | A flag indicating the type of timer to be used; it is passed to calls to Zoltan_Time. Valid values are ZOLTAN_TIME_WALL, ZOLTAN_TIME_CPU, ZOLTAN_TIME_USER and ZOLTAN_TIME_DEF (the default timer). See the timing routines for more information about the timer_flag values. |
Returned Value: | |
struct Zoltan_Timer * | Pointer to memory for storage of Zoltan_Timer information. If an error occurs, NULL will be returned in C. |
C: | int Zoltan_Timer_Init( struct Zoltan_Timer *zt, int use_barrier, const char *timer_name ); |
C++: | int Zoltan_Timer_Object::Init( const int use_barrier, const std::string & timer_name); |
Note that processors must initialize multiple timers within a Zoltan_Timer object in the same order to ensure that the returned timer index value is the same on each processor.
Input Arguments: | |
zt | Pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create. |
use_barrier | Flag indicating whether to synchronize processors before starting or stopping a timer. A value of 1 causes MPI_Barrier to be invoked before the timer is started or stopped; a value of 0 provides no synchronization. |
timer_name | A character string associated with the timer; it is printed as the timer name in Zoltan_Timer_Print and Zoltan_Timer_PrintAll. |
Returned Value: | |
int | The unique integer identifier for this timer. |
C: | int ZOLTAN_TIMER_START( struct Zoltan_Timer *zt, int timer_idx, MPI_COMM communicator ); |
C++: | int Zoltan_Timer_Object::Start( const int timer_idx, const MPI_COMM & communicator); |
Input Arguments: | |
zt | Pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create. |
timer_idx | The integer timer index (returned by Zoltan_Timer_Init) of the timer to be started. |
communicator | The MPI communicator to be used for synchronization is the timer was initialized with use_barrier=1. |
Returned Value: | |
int | Error code indicating whether the timer started successfully. |
C: | int ZOLTAN_TIMER_STOP( struct Zoltan_Timer *zt, int timer_idx, MPI_COMM communicator ); |
C++: | int Zoltan_Timer_Object::Stop( const int timer_idx, const MPI_COMM & communicator); |
Input Arguments: | |
zt | Pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create. |
timer_idx | The integer timer index (returned by Zoltan_Timer_Init) of the timer to be stopped. |
communicator | The MPI communicator to be used for synchronization is the timer was initialized with use_barrier=1. |
Returned Value: | |
int | Error code indicating whether the timer stopped successfully. |
C: | int Zoltan_Timer_Print( struct Zoltan_Timer *zt, int timer_idx, int proc, MPI_Comm comm, FILE *fp ); |
C++: | int Zoltan_Timer_Object::Print( const int timer_idx, const int proc, const MPI_Comm &comm, FILE *fp ); |
Input Arguments: | |
zt | Pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create. |
timer_idx | The integer timer index (returned by Zoltan_Timer_Init) of the timer to be printed. |
proc | The rank (within MPI communicator comm) of the processor that should print the timer's values. |
comm | The MPI communicator across which minimum, maximum and average values of the timer should be computed. |
fp | The file pointer to a open, writable file to which timer values should be printed. Special files stdout and stderr are also legal values for this argument. |
Returned Value: | |
int | Error code. |
C: | int Zoltan_Timer_PrintAll( struct Zoltan_Timer *zt, int proc, MPI_Comm comm, FILE *fp ); |
C++: | int Zoltan_Timer_Object::PrintAll( const int proc, const MPI_Comm &comm, FILE *fp ); |
Input Arguments: | |
zt | Pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create. |
proc | The rank (within MPI communicator comm) of the processor that should print the timer's values. |
comm | The MPI communicator across which minimum, maximum and average values of the timer should be computed. |
fp | The file pointer to a open, writable file to which timer values should be printed. Special files stdout and stderr are also legal values for this argument. |
Returned Value: | |
int | Error code. |
C: | int Zoltan_Timer_Reset( struct Zoltan_Timer *zt, int timer_idx, int use_barrier, const char *timer_name ); |
C++: | int Zoltan_Timer_Object::Reset( const int timer_idx, const int use_barrier, const std::string & timer_name); |
Input Arguments: | |
zt | Pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create. |
timer_idx | The integer timer index (returned by Zoltan_Timer_Init) of the timer to be reset. |
use_barrier | Flag indicating whether to synchronize processors before starting or stopping a timer. A value of 1 causes MPI_Barrier to be invoked before the timer is started or stopped; a value of 0 provides no synchronization. |
timer_name | A character string associated with the timer; it is printed as the timer name in Zoltan_Timer_Print and Zoltan_Timer_PrintAll. |
Returned Value: | |
int | Error code indicating whether or not the timer was reset correctly. |
C: | struct Zoltan_Timer *Zoltan_Timer_Copy( struct Zoltan_Timer *from); |
C++: | Zoltan_Timer_Object(const Zoltan_Timer_Object &from); |
In C++, there is no direct interface to Zoltan_Timer_Copy. Instead, the Zoltan_Timer_Object copy constructor invokes the C library function Zoltan_Timer_Copy.
Input Arguments: | |
from | Pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create whose state is to be copied to new memory. |
Returned Value: | |
struct Zoltan_Timer * | Pointer to memory for storage of the copied Zoltan_Timer information. If an error occurs, NULL will be returned in C. |
C: | int Zoltan_Timer_Copy_To( struct Zoltan_Timer **to, struct Zoltan_Timer *from ); |
C++: | Zoltan_Timer_Object & operator =(const Zoltan_Timer_Object &from); |
The C++ interface to Zoltan_Timer_Copy_To is through the Zoltan_Timer_Object copy operator which invokes the C library function Zoltan_Timer_Copy_To.
Arguments: | |
to | Pointer to the Zoltan_Timer struct whose state is to be overwritten with the state of from. |
from | Pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create whose state is to be copied to to. |
Returned Value: | |
int | Error code. |
C: | void Zoltan_Timer_Destroy( struct Zoltan_Timer **zt); |
C++: | ~Zoltan_Timer_Object(); |
In C++, the Zoltan_Timer_Object class represents a Zoltan_Timer data structure and the functions that operate on it. Zoltan_Timer_Destroy is called by the destructor for the Zoltan_Timer_Object.
Input Arguments: | |
zt | Pointer to the pointer to the Zoltan_Timer struct returned by Zoltan_Timer_Create. Upon return, zt is set to NULL. |
Returned Value: | |
None. |