-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclock.f90
231 lines (160 loc) · 6.43 KB
/
clock.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
module clocks
implicit none
real :: cputime1_programme
real :: cputime2_programme
real :: cputime1_pyramid
real :: cputime2_pyramid
real :: cputime1_short
real :: cputime2_short
real :: cputime1_long
real :: cputime2_long
integer :: cpu_hours = 0
integer :: cpu_minutes = 0
real :: cpu_seconds = 0.0
integer(kind=8) :: cntr1_programme
integer(kind=8) :: cntr2_programme
integer(kind=8) :: cntr1_pyramid
integer(kind=8) :: cntr2_pyramid
integer(kind=8) :: cntr1_short
integer(kind=8) :: cntr2_short
integer(kind=8) :: cntr1_long
integer(kind=8) :: cntr2_long
integer(kind=8) :: countspersec
integer :: clock_hours = 0
integer :: clock_minutes = 0
real :: clock_seconds = 0.0
contains
subroutine setup_clocks
call cpu_time(cputime1_programme)
call system_clock(cntr1_programme)
end subroutine setup_clocks
subroutine report_clocks
call report_cpuclock
call report_wallclock
end subroutine report_clocks
subroutine report_cpuclock
cpu_hours = 0
cpu_minutes = 0
cpu_seconds = 0.0
call cpu_time(cputime2_programme)
cpu_seconds = cpu_seconds+real(cputime2_programme-cputime1_programme)
cpu_minutes = cpu_minutes + int(cpu_seconds) / 60
cpu_seconds = MOD ( cpu_seconds , 60.0 )
cpu_hours = cpu_hours + cpu_minutes / 60
cpu_minutes = MOD ( cpu_minutes , 60 )
!write(*,*) "CPU time: ", cpu_hours, ' hours', cpu_minutes, ' minutes', &
! cpu_seconds, ' seconds.'
end subroutine report_cpuclock
subroutine report_wallclock
clock_hours = 0
clock_minutes = 0
clock_seconds = 0.0
call system_clock(cntr2_programme,countspersec)
clock_seconds = clock_seconds+real(cntr2_programme-cntr1_programme)/real(countspersec)
clock_minutes = clock_minutes + int(clock_seconds) / 60
clock_seconds = MOD ( clock_seconds , 60.0 )
clock_hours = clock_hours + clock_minutes / 60
clock_minutes = MOD ( clock_minutes , 60 )
!write(*,*) "Wall clock time: ", clock_hours, ' hours', clock_minutes, ' minutes', &
! clock_seconds, ' seconds.'
end subroutine report_wallclock
subroutine start_pyramid_clock()
call cpu_time(cputime1_pyramid)
call system_clock(cntr1_pyramid)
end subroutine start_pyramid_clock
subroutine report_pyramid_clock()
call report_cpuclock_pyramid()
call report_wallclock_pyramid()
end subroutine report_pyramid_clock
subroutine report_cpuclock_pyramid()
cpu_hours = 0
cpu_minutes = 0
cpu_seconds = 0.0
call cpu_time(cputime2_pyramid)
cpu_seconds = cpu_seconds+real(cputime2_pyramid-cputime1_pyramid)
cpu_minutes = cpu_minutes + int(cpu_seconds) / 60
cpu_seconds = MOD ( cpu_seconds , 60.0 )
cpu_hours = cpu_hours + cpu_minutes / 60
cpu_minutes = MOD ( cpu_minutes , 60 )
write(*,*) "Pyramid CPU time: ",cpu_seconds, ' seconds.'
end subroutine report_cpuclock_pyramid
subroutine report_wallclock_pyramid()
clock_hours = 0
clock_minutes = 0
clock_seconds = 0.0
call system_clock(cntr2_pyramid,countspersec)
clock_seconds = clock_seconds+real(cntr2_pyramid-cntr1_pyramid)/real(countspersec)
clock_minutes = clock_minutes + int(clock_seconds) / 60
clock_seconds = MOD ( clock_seconds , 60.0 )
clock_hours = clock_hours + clock_minutes / 60
clock_minutes = MOD ( clock_minutes , 60 )
!write(*,*) "Pyramid Wall clock time: ", clock_hours,' hours', clock_minutes, ' minutes', &
! clock_seconds, ' seconds.'
end subroutine report_wallclock_pyramid
subroutine start_short_clock()
call cpu_time(cputime1_short)
call system_clock(cntr1_short)
end subroutine start_short_clock
subroutine report_short_clock()
call report_cpuclock_short()
call report_wallclock_short()
end subroutine report_short_clock
subroutine report_cpuclock_short()
cpu_hours = 0
cpu_minutes = 0
cpu_seconds = 0.0
call cpu_time(cputime2_short)
cpu_seconds = cpu_seconds+real(cputime2_short-cputime1_short)
cpu_minutes = cpu_minutes + int(cpu_seconds) / 60
cpu_seconds = MOD ( cpu_seconds , 60.0 )
cpu_hours = cpu_hours + cpu_minutes / 60
cpu_minutes = MOD ( cpu_minutes , 60 )
write(*,*) "short CPU time: ", cpu_seconds, ' seconds.'
end subroutine report_cpuclock_short
subroutine report_wallclock_short()
clock_hours = 0
clock_minutes = 0
clock_seconds = 0.0
call system_clock(cntr2_short,countspersec)
clock_seconds = clock_seconds+real(cntr2_short-cntr1_short)/real(countspersec)
clock_minutes = clock_minutes + int(clock_seconds) / 60
clock_seconds = MOD ( clock_seconds , 60.0 )
clock_hours = clock_hours + clock_minutes / 60
clock_minutes = MOD ( clock_minutes , 60 )
!write(*,*) "short Wall clock time: ", clock_hours, ' hours', clock_minutes, ' minutes', &
! clock_seconds, ' seconds.'
end subroutine report_wallclock_short
subroutine start_long_clock()
call cpu_time(cputime1_long)
call system_clock(cntr1_long)
end subroutine start_long_clock
subroutine report_long_clock()
call report_cpuclock_long()
call report_wallclock_long()
end subroutine report_long_clock
subroutine report_cpuclock_long()
cpu_hours = 0
cpu_minutes = 0
cpu_seconds = 0.0
call cpu_time(cputime2_long)
cpu_seconds = cpu_seconds+real(cputime2_long-cputime1_long)
cpu_minutes = cpu_minutes + int(cpu_seconds) / 60
cpu_seconds = MOD ( cpu_seconds , 60.0 )
cpu_hours = cpu_hours + cpu_minutes / 60
cpu_minutes = MOD ( cpu_minutes , 60 )
write(*,*) "long CPU time: ", cpu_seconds,' seconds.'
end subroutine report_cpuclock_long
subroutine report_wallclock_long()
clock_hours = 0
clock_minutes = 0
clock_seconds = 0.0
call system_clock(cntr2_long,countspersec)
clock_seconds = clock_seconds+real(cntr2_long-cntr1_long)/real(countspersec)
clock_minutes = clock_minutes + int(clock_seconds) / 60
clock_seconds = MOD ( clock_seconds , 60.0 )
clock_hours = clock_hours + clock_minutes / 60
clock_minutes = MOD ( clock_minutes , 60 )
! write(*,*) "long Wall clock time: ", clock_hours, ' hours', &
! clock_minutes, ' minutes', clock_seconds, ' seconds.'
end subroutine report_wallclock_long
end module clocks