Need higher resolution times for linpack benchmark
Tim Prince
n8tm@aol.com
Fri Dec 11 22:01:00 GMT 2009
N.M. Maclaren wrote:
> This is nor a gfortran answer, but here is a wall-clock timer that is
> callable from Fortran and I use when I need it.
>
> /* Return high-precision timestamp. */
> #include <stddef.h>
> #include <sys/time.h>
> double gettime_ (void) {
> struct timeval timer;
> if (gettimeofday(&timer,NULL))
> return -1.0;
> return timer.tv_sec+
> 1.0e-6*timer.tv_usec;
> }
>
> Regards,
> Nick Maclaren.
>
Not to be confused with high precision timer implemented in some cases
on Windows, this should be capable of resolution within a microsecond on
linux. OpenMP omp_get_wtime() is likely to be implemented similar to this.
Fortran system_clock should be capable of similar resolution, even on
Windows, when 64-bit integer arguments are supported. f95 required only
support of default integers.
System functions, such as _rdtsc, should be capable of resolution down
to a few buss cycles, on current CPUs.
cpu_time still has only 10 millisecond resolution on common systems, and
usually measures total cpu time of all threads, skipping idle periods,
so in general it is a completely different measurement from elapsed time.
More information about the Fortran
mailing list