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