New sanity test for cpu_time() intrinsic function
Brooks Moses
bmoses@stanford.edu
Mon Nov 14 23:59:00 GMT 2005
Uttam Pawar wrote:
> I've written following sanity test for cpu_time intrinsic, does it look ok?
>
[...]
> call cpu_time(r1)
> ! if (r1 .lt. 0) then according to f95 standard, it mean processor cannot return
> ! meaningful value. This is not an error but a valid case which can be ignored, I think.
I think this is a possible failure condition, however, and thus should
be tested. The question is whether, if the test is true, the result
should count as "pass" or "fail". It is legal according to the F95
standard, but it is not desired behavior of gfortran (as I understand
it), and thus should probably be flagged as a failure.
> if (r1 .eq. 0) then
[...]
> if (r2.lt.r1) call abort()
> endif
> end program test_cpu_time
The usage of r1 in the second IF statement seems misleading to me, since
it's already been established that r1 is equal to zero.
Also, it appears that this code will "succeed" without really testing
anything if r1 is greater than zero. Is this actually the desired behavior?
- Brooks
More information about the Fortran
mailing list