Hello,
I am wondering what the safe way to time a routine in Fortran 90 is, if
it takes a very short time. With the usual approach:
CALL SYSTEM_CLOCK(CLOCK=c1)
DO k=1,1000...
erf=Erf(x)
END DO
CALL SYSTEM_CLOCK(CLOCK=c2)
counts=c2-c1
and the Fortran 90 compiler fully informed that the function Erf is a
harmless PURE procedure, I am afraid a smart compiler would optimize
"too" well the above code and make the timings invalid.
What is the preferred approach.
Thanks,
Aleksandar
P.S. I will be asking some of these pedagological questions during this
semester as I am trying to make our Fortran class "clean"...Thanks to
all that help. Concerning how to write (2*k-1)/(2*k+1)*x, I agree most
with Robin, REAL(2*k-1)/REAL(2*k+1)*x, which is readable enough and
safe. I would usually add a kind argument to any call to REAL as well...
--
_____________________________________________
Aleksandar Donev
[log in to unmask]
http://www.pa.msu.edu/~donev/
Department of Physics and Astronomy
Michigan State University
East Lansing, MI 48825
(517) 432-6770
_____________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|