Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

use dclock and get negative run time

woshiwuxin
Novice
255 Views

Hi, everyone!

I use dclock (with "use ifport") to time my application. It works perfect for a short run, i.e. 300 second. But for a long run, i.e. 1 or 2 days, it gives a negative run time. Could anyone give an explanation for this?

Thanks!

0 Kudos
4 Replies
Steven_L_Intel1
Employee
255 Views

Very interesting. I waded through the source code for DCLOCK (actually, the SECNDS routine it calls internally), and I see that it tries to account for spanning midnight but only over one day. It can't handle a period longer than two days. I recommend the use of the Fortran standard intrinsic SYSTEM_CLOCK instead - it can deal with longer spans.

I will ask the developers to fix DCLOCK as it should not be based on SECNDS. Issue ID is DPD200243198.

woshiwuxin
Novice
255 Views

Thanks, Steve!

Actually, my current solution is to use "gettimeofday" from C. "SYSTEM_CLOCK" seems to be better. I guess I can get a resolution of one microsecond. :D

Steven_L_Intel1
Employee
255 Views

We've corrected the implementation of DCLOCK for a release later this year. I would caution you that the resolution is dependent on how often the OS updates the elapsed time clock. I think Linux does tend to do it every microsecond, but just because the value you get has a precision of microseconds, that doesn't mean the resolution (gap between increments) is the same.

woshiwuxin
Novice
255 Views

Thanks, Steve! I always learn something useful from this forum.

Reply