1
我试图使用ifort来评估模型性能,但是打印输出没有正确显示。使用dtime或time命令打印总运行时间(挂钟)?
这是我的代码。请告诉我如何完成这个任务。
! Time the run
call dtime(timearray, telapse)
! End of the simulation
call dtime(timearray, telapse)
call print_runtime(telapse, ctime)
subroutine print_runtime(telapse, ctime)
implicit none
real*4 telapse
character*8 ctime(2)
integer*2 RunDays,
> RunHours,
> RunMins,
> RunSecs
character*40 msgstr, rtfname
parameter (msgstr = ' *** Total run time (wallclock) was ')
parameter (rtfname = 'runtime.txt')
! Now convert telapse from seconds to DD HH:MM:SS
RunDays = INT (telapse/86400.0)
telapse = telapse - (RunDays * 86400.0)
RunHours = INT (telapse/3600.0)
telapse = telapse - (RunHours * 3600.0)
RunMins = INT (telapse/60.0)
RunSecs = NINT (telapse - (RunMins * 60.0))
if (RunDays .GT. 0) then
write (*,1) msgstr, RunDays, RunHours, RunMins, RunSecs
1 format (A36, I2, 'days, ', I2.2, ':', I2.2, ':', I2.2, ' hh:mm:ss ***')
else if (RunHours .GT. 0) then
write (*,2) msgstr, RunHours, RunMins, RunSecs
2 format (A36, I2, ':', I2.2, ':', I2.2, ' hh:mm:ss ***')
else if (RunMins .GT. 0) then
write (*,3) msgstr, RunMins, RunSecs
3 format (A36, I2, ':', I2.2, ' mm:ss ***')
else
write (*,4) msgstr, telapse
4 format (A36, F7.4, ' seconds ***')
endif
return
end
目前,我的打印输出显示“*** Total run time (wallclock) was ******* seconds ***
” 如何显示一个适当的总运行时间(挂钟)在这里? 谢谢。 Michael
我做了一个线索。写出显示0.0000000E + 00 ?? – 2012-03-05 23:49:37