DISPATCH
omp_timer_mod.f90
1
!*******************************************************************************
2
!> Support tic/toc timing, as in MATLAB, and accurate wallclock() function.
3
!> The timing is generally much more accurate if this module is compiled with
4
!> OMP active.
5
!*******************************************************************************
6
MODULE
omp_timer_mod
7
implicit none
8
private
9
real(8)
,
external
:: omp_get_wtime
10
type
omp_timer_t
11
contains
12
procedure
,
nopass
:: delay
13
procedure
,
nopass
:: get
14
procedure
,
nopass
:: set
15
end type
16
type
(omp_timer_t),
public
:: omp_timer
17
real(8)
,
save
:: offset=0d0
18
public
wallclock
19
CONTAINS
20
21
!===============================================================================
22
FUNCTION
wallclock()
result
(time)
23
real(8)
:: time
24
!.............................................................................
25
time = omp_get_wtime()
26
if
(offset == 0d0)
then
27
offset=time
28
end if
29
time = time-offset
30
END FUNCTION
wallclock
31
32
!===============================================================================
33
!> Active spin delay
34
!===============================================================================
35
SUBROUTINE
delay (delta)
36
real
:: delta
37
real(8)
:: wc
38
!.............................................................................
39
wc = wallclock()
40
do
while
(wallclock()-wc < delta)
41
end do
42
END SUBROUTINE
delay
43
44
!===============================================================================
45
!> Get offset
46
!===============================================================================
47
SUBROUTINE
get (wc)
48
real(8)
:: wc
49
!.............................................................................
50
wc = offset
51
END SUBROUTINE
get
52
53
!===============================================================================
54
!> Set offset
55
!===============================================================================
56
SUBROUTINE
set (wc)
57
real(8)
:: wc
58
!.............................................................................
59
offset = wc
60
END SUBROUTINE
set
61
62
END MODULE
omp_timer_mod
omp_timer_mod
Support tic/toc timing, as in MATLAB, and accurate wallclock() function. The timing is generally much...
Definition:
omp_timer_mod.f90:6
omp
omp_timer_mod.f90
Generated by
1.8.13