⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtimer.f90

📁 shpf 1.9一个并行编译器
💻 F90
字号:
SUBROUTINE timer (t)
!---------------------------------------------------------------
! Returns the elapsed time in seconds since the first call to
! 'timer ()'.
!
! N.B. The 'SYSTEM_CLOCK ()' intrinsic is dangerous in an HPF
! program, as it violates HPF semantics by potentially returning
! a  different value on each processor.  Do not use the result 't'
! in any expression that governs the program's control flow
! (e.g. an IF or WHILE condition)!
!	We plan to provide a 'safe' version of 'SYSTEM_CLOCK ()'
! (e.g. one that returns the time as measured on a particular
! processor) in a future release of 'shpf'.
!---------------------------------------------------------------
  DOUBLE PRECISION, INTENT (OUT) ::  t
  INTEGER :: cnt0, cnt, rate, max
  SAVE       cnt0          ! its initial value should be 0!

  CALL SYSTEM_CLOCK (cnt, rate, max)

  IF (cnt0 == 0) THEN
    cnt0 = cnt
    cnt  = 0
  ELSE IF (cnt >= cnt0) THEN
    cnt = cnt - cnt0
  ELSE
    cnt = max - (cnt0 - cnt) + 1
  ENDIF

  IF (rate > 0) THEN
    t = DBLE (cnt) / DBLE (rate)
  ELSE
    t = 0.0    !! no clock !!
  ENDIF

  RETURN
END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -