There are two timing routines in the OpenMP runtime library, double omp_get_wtime() and double omp_get_wtick(). Both return double precision values in seconds. The latter returns the resolution of the former. omp_get_wtime returns the elapsed wallclock time since some reference time in the past. The reference time is arbitrary, but is guaranteed not to change for a given thread during its execution. The reference times for different threads are not guaranteed to be consistent, so this function is not useful for making global timings. The intended use of the wtime function is to make per-thread timings by calling it at the beginning and end of an interval and differencing the values to get the elapsed time.

These routines are typically implemented as wrappers on timing routines supplied by the operating system. Their principal value is their portability across platforms. The corresponding timing routines in the MPI API have sometimes been used in codes that make no other use of MPI because of their portability. These OpenMP routines could also be used in applications that have no OpenMP directives simply because they are easy to use and portable.

 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement