-
Notifications
You must be signed in to change notification settings - Fork 237
/
openad_checkpointInit.F
170 lines (155 loc) · 5.05 KB
/
openad_checkpointInit.F
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
SUBROUTINE openad_checkpointinit(uCheckLev1,
+ uCheckLev2,
+ uCheckLev3,
+ uCheckLev4 )
IMPLICIT NONE
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
integer iloop
logical haveRemainder, allStepsCovered
integer uCheckLev1, uCheckLev2, uCheckLev3,uCheckLev4
integer nCheckLev1, nCheckLev2, nCheckLev3,nCheckLev4
uCheckLev1=0
uCheckLev2=0
uCheckLev3=0
uCheckLev4=0
open(2,action='read',file='ncheckLev.conf')
read(2,'(I5,/,I5,/I5,/I5)') nCheckLev1, nCheckLev2, nCheckLev3,
+nCheckLev4
close(2)
write(standardmessageunit,'(A,I4,A,I4,A,I4,A,I8)')
+'OAD: the_main_loop checkpoints allowed 1st:' ,nCheckLev1,
+', 2nd:', nCheckLev2,
+', 3rd:', nCheckLev3,
+', 4th:', nCheckLev4
cju in this current scheme
cju there is no point in specifying 1 as the number of checkpoints
cju because for now don't avoid the incidental store of
cju the same checkpoint across multiple levels.
if (nCheckLev4 .eq. 1 ) then
uCheckLev4=0
write(standardmessageunit,'(A)')
+'OAD: NOTE: resetting level 4 to 0'
else
uCheckLev4=nCheckLev4
end if
if (nCheckLev3 .eq. 1 ) then
uCheckLev3=0
write(standardmessageunit,'(A)')
+'OAD: NOTE: resetting level 3 to 0'
else
uCheckLev3=nCheckLev3
end if
if (nCheckLev2 .eq. 1 ) then
uCheckLev2=0
write(standardmessageunit,'(A)')
+'OAD: NOTE: resetting level 2 to 0'
else
uCheckLev2=nCheckLev2
end if
if (nCheckLev1 .eq. 1 ) then
uCheckLev1=0
write(standardmessageunit,'(A)')
+'OAD: NOTE: resetting level 1 to 0'
else
uCheckLev1=nCheckLev1
end if
cju check sanity
if (uCheckLev4 .gt. 0 ) then
if ( uCheckLev3*uCheckLev2*uCheckLev1 .eq. 0) then
write(errormessageunit,'(A)')
+'OAD: ERROR: uCheckLev4 > 0 implies ',
+'all lower levels must be nonzero too.'
end if
end if
if (uCheckLev3 .gt. 0 ) then
if ( uCheckLev2*uCheckLev1 .eq. 0) then
write(errormessageunit,'(A)')
+'OAD: ERROR: uCheckLev3 > 0 implies ',
+'all lower levels must be nonzero too.'
end if
end if
if (uCheckLev2 .gt. 0 ) then
if ( uCheckLev1 .eq. 0) then
write(errormessageunit,'(A)')
+'OAD: ERROR: uCheckLev2 > 0 implies ',
+'all lower levels must be nonzero too.'
end if
end if
if (uCheckLev1 .eq. 0 ) then
write(errormessageunit,'(A)')
+'OAD: ERROR: uCheckLev1 must be nonzero '
end if
cju uCheckLev1
allStepsCovered = .false.
if (nTimeSteps .lt. uCheckLev1 ) then
uCheckLev1=nTimeSteps
allStepsCovered =.true.
end if
cju uCheckLev2
if (.NOT. allStepsCovered ) then
if (MOD(nTimeSteps,uCheckLev1).gt.0) then
if((nTimeSteps/uCheckLev1)+1 .le. uCheckLev2 ) then
uCheckLev2=(nTimeSteps/uCheckLev1)+1
allStepsCovered =.true.
end if
else
if((nTimeSteps/uCheckLev1) .le. uCheckLev2 ) then
uCheckLev2=(nTimeSteps/uCheckLev1)
allStepsCovered =.true.
end if
end if
else
uCheckLev2 = 0
end if
cju uCheckLev3
if (.NOT. allStepsCovered ) then
if (MOD(nTimeSteps,uCheckLev1*uCheckLev2).gt.0) then
if((nTimeSteps/(uCheckLev1*uCheckLev2))+1
+ .le. uCheckLev3 ) then
uCheckLev3=(nTimeSteps/(uCheckLev1*uCheckLev2))+1
allStepsCovered =.true.
end if
else
if((nTimeSteps/(uCheckLev1*uCheckLev2)) .le. uCheckLev3 )then
uCheckLev3=(nTimeSteps/(uCheckLev1*uCheckLev2))
allStepsCovered =.true.
end if
end if
else
uCheckLev3 = 0
end if
cju uCheckLev4
if (.NOT. allStepsCovered ) then
if (MOD(nTimeSteps,uCheckLev1*uCheckLev2*uCheckLev3)
+ .gt.0) then
if((nTimeSteps/(uCheckLev1*uCheckLev2*uCheckLev3))+1
+ .le. uCheckLev4 ) then
uCheckLev4=
+ (nTimeSteps/(uCheckLev1*uCheckLev2*uCheckLev3))+1
allStepsCovered =.true.
end if
else
if((nTimeSteps/(uCheckLev1*uCheckLev2*uCheckLev3))
+ .le. uCheckLev4 ) then
uCheckLev4=
+ (nTimeSteps/(uCheckLev1*uCheckLev2*uCheckLev3))
allStepsCovered =.true.
end if
end if
else
uCheckLev4 = 0
end if
if (.NOT. allStepsCovered) then
write(errormessageunit,'(A)')
+'OAD: ERROR: not enough checkpoints allowed'
end if
write(standardmessageunit,'(A,I6)')
+'OAD: timesteps required:',ntimesteps
write(standardmessageunit,'(4(A,I4))')
+'OAD: the_main_loop checkpoints used 1st:',uCheckLev1,
+', 2nd:', uCheckLev2,
+', 3rd:', uCheckLev3,
+', 4th:', uCheckLev4
END