This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Need higher resolution times for linpack benchmark
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: ddf at iqdotdt dot com
- Cc: fortran at gcc dot gnu dot org
- Date: Fri, 11 Dec 2009 23:57:25 +0200
- Subject: Re: Need higher resolution times for linpack benchmark
- References: <200912111244.23042.ddf@iqdotdt.com>
Delbert Franz wrote:
Hi,
I am running the standard 100x100 LINPACK benchmark program under
Debian Lenny compiled with gfortran 4.3.2. The results are highly
erratic and stem from all the timers I have tried having an apparent
resolution of one millisecond. Consequently many of the times are
shown as 0.0 or if non-zero, have so much noise that the results are
useless. I have tried CPU_TIME, SECOND, and DTIME.
CPU_TIME claims to be able to produce microsecond resolution, but
somehow it does not on my machine. Running an Intel E8400 chip and
the kernel is compiled with the various high-resolution timers
included. All of the times printed from CPU_TIME clearly show a
resolution of one millisecond.
Is there a way to get higher resolution than a millisecond from this
version of gfortran?
CPU_TIME and other non-standard cpu timer functions are implemented by
using getrusage(), which is usually the best available POSIX CPU timer
function. The problem is that at least on Linux, it seems that while the
getrusage() API as such should be able to provide microsecond
resolution, the Linux kernel itself keeps track of CPU time only up to
millisecond resolution.
The high-resolution timers in recent Linux kernels you mention don't
change the granularity of process CPU time accounting.
One thing you can do it to use a wall-clock timer instead of a CPU
timer. The DATE_AND_TIME intrinsic is implemented with gettimeofday(),
which should give you up to microsecond resolution, especially with a
modern kernel with the high-resolution timers. There is a PR around for
using clock_gettime() instead if available; that API supports nanosecond
resolution, although in practice it will be limited by the hardware.
--
Janne Blomqvist