Approvals: 0/1
This is an old revision of the document!
Timers and performance debugging
In MPI, timers are defined because existing timers are either inconvenient or do not provide adequate access to high resolution timers (See also Section 8.6 Timers and Synchronization in mpi-3.0 Standard.).
MPI_WTIME()
double MPI_Wtime(void) DOUBLE PRECISION MPI_Wtime() BIND(C) DOUBLE PRECISION MPI_WTIME()
MPI_WTIME returns a floating-point number of seconds, representing elapsed wallclock time since some time in the past and may be used as follows:
{ double starttime, endtime; starttime = MPI_Wtime(); .... stuff to be timed ... endtime = MPI_Wtime(); printf("That took %f seconds\n",endtime-starttime); }
Note: The times returned are local to the node that called them. Different nodes need not to be synchronized. (MPI_WTIME_IS_GLOBAL is a Boolean variable that is 1 if synchronized and 0 if not.) Therefore, compare times ONLY within the same MPI-process.
MPI_WTICK()
double MPI_Wtick(void) DOUBLE PRECISION MPI_Wtick() BIND(C) DOUBLE PRECISION MPI_WTICK()
MPI_WTICK returns the resolution of MPI_WTIME in seconds, i.e. the time between successive clock ticks given in seconds.
omp_get_wtime
c example:
double start = omp_get_wtime( ); Sleep(1000); double end = omp_get_wtime( ); double wtick = omp_get_wtick( );
gettimeofday()
gives the time of your wrist watch.
clock
gives the amount of time that the CPU is busy for a particular task from one call to the next.
fortran
SYSTEM_CLOCK DATE_AND_TIME CPU_TIME