Timers Tuning
Description of timers for tuning
Timing commands
time command options
this command returns the real, user, and system time by executing a command or program. By defualt time has an accuracy of miliseconds. Advanced option are well described in the corresponding man and info page.
date options
Prints and sets the system time and date. You could use as marker since it returns the date and time in human readable format. As in the previous case, the advances options are described in the corresponding man and info page.
Timing Functions
Sometimes you are interested in measuring the time from a particular point to another particular point. This can be useful to time a specific function or lines of your code. Normally this also requires to add few lines in your code and to link with an external library. Some are standar functions found in the MPI and OpenMP library, which ensures portability. Other calls might not be used on other systems outside from LRZ.The name and the location of some routines and functions are described in the table below:
Routine | Module, library and/or link options |
Description | Approx. accuracy | Multi- threaded programs |
---|---|---|---|---|
Accurate timers: | ||||
mpi_wtime() | -lmpi | wall clock time | 1 µs | yes |
omp_get_wtime | -openmp | wall clock time | 1 µs | yes |
Real (kind=8) function DWALLTIME() double dwalltime( |
module load lrztools $LIBLRZ_LIB $LIBLRZ_INC |
wall clock time | 1 µs | yes |
int clock_getres int clock_gettime |
#include time.h | system_wide real time clock | 1 µs | yes |
unsigned long int get_cycles() Integer(kind=8) GET_CYCLES() |
module load lrztools $LIBLRZ_LIB $LIBLRZ_INC |
This function returns the processor cycle counter. The cycle counter is free running and unsynchronized on each processor. Thus, the order of events cannot determined by comparing the results of the get_cycles function on different processors. | 50 cycles | yes |
Standard timers: | ||||
CPU_TIME | intrinsics | Returns the processor time in seconds. | ||
DATE | intrinsics | Returns the ASCII representation of the current date (in dd-mmm-yy form). | ||
DATE_AND_TIME | intrinsics | Returns the date and time. This is the preferred procedure for date and time. | ||
IDATE | intrinsics | Returns three integer values representing the current month, day, and year. | ||
SYSTEM_CLOCK | intrinsics | Returns data from the system clock. | ||
TIME | intrinsics | Returns the ASCII representation of the current time (in hh:mm:ss form). | ||
Real (kind=8) function DCPUTIME() double dwalltime() |
module load lrztools $LIBLRZ_LIB $LIBLRZ_INC |
CPU time | 1 ms | yes |
real(kind=4) array(2) real(kind=4) function ETIME (array) |
USE IFPORT | On single processor systems, returns the elapsed CPU time, in seconds, of the process that calls it. On multi-core or multi-processor systems, returns the elapsed wall-clock time, in seconds | 1 ms |
yes |
REAL(Kind=4) function TIMEF() | USE IFPORT | wall clock time | 1 ms | no ? |