Fortran

From 太極
Revision as of 08:48, 24 March 2015 by Brb (talk | contribs) (Created page with "= Misc = == Timing == system_clock tells the elapsed wall time between two successive calls. <pre> integer(kind=8):: tclock1, tclock2, clock_rate real(kind=8):: elapse_time c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Misc

Timing

system_clock tells the elapsed wall time between two successive calls.

integer(kind=8):: tclock1, tclock2, clock_rate
real(kind=8):: elapse_time

call system_clock(tclock1)

<code to be timed>

call system_clock(tclock2, clock_rate)
elapse_time = float(tclock2 - tclock1) / float(clock_rate)

cpu_time tells the CPU time used between two successive calls

real(kind=8):: t1, t2, elapsed_cpu_time
call cpu_time(t1)

<code to be timed>

call cpu_time(t2)
elapsed_cpu_time = t2 - t1