1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
SUBROUTINE openad_checkpointinit(uCheckLev1, |
5 |
+ uCheckLev2, |
6 |
+ uCheckLev3, |
7 |
+ uCheckLev4 ) |
8 |
|
9 |
IMPLICIT NONE |
10 |
|
11 |
#include "SIZE.h" |
12 |
#include "EEPARAMS.h" |
13 |
#include "PARAMS.h" |
14 |
|
15 |
integer iloop |
16 |
logical haveRemainder, allStepsCovered |
17 |
integer uCheckLev1, uCheckLev2, uCheckLev3,uCheckLev4 |
18 |
integer nCheckLev1, nCheckLev2, nCheckLev3,nCheckLev4 |
19 |
|
20 |
uCheckLev1=0 |
21 |
uCheckLev2=0 |
22 |
uCheckLev3=0 |
23 |
uCheckLev4=0 |
24 |
|
25 |
open(2,action='read',file='ncheckLev.conf') |
26 |
read(2,'(I5,/,I5,/I5,/I5)') nCheckLev1, nCheckLev2, nCheckLev3, |
27 |
+nCheckLev4 |
28 |
close(2) |
29 |
|
30 |
write(standardmessageunit,'(A,I4,A,I4,A,I4,A,I8)') |
31 |
+'OAD: the_main_loop checkpoints allowed 1st:' ,nCheckLev1, |
32 |
+', 2nd:', nCheckLev2, |
33 |
+', 3rd:', nCheckLev3, |
34 |
+', 4th:', nCheckLev4 |
35 |
|
36 |
cju in this current scheme |
37 |
cju there is no point in specifying 1 as the number of checkpoints |
38 |
cju because for now don't avoid the incidental store of |
39 |
cju the same checkpoint across multiple levels. |
40 |
if (nCheckLev4 .eq. 1 ) then |
41 |
uCheckLev4=0 |
42 |
write(standardmessageunit,'(A)') |
43 |
+'OAD: NOTE: resetting level 4 to 0' |
44 |
else |
45 |
uCheckLev4=nCheckLev4 |
46 |
end if |
47 |
if (nCheckLev3 .eq. 1 ) then |
48 |
uCheckLev3=0 |
49 |
write(standardmessageunit,'(A)') |
50 |
+'OAD: NOTE: resetting level 3 to 0' |
51 |
else |
52 |
uCheckLev3=nCheckLev3 |
53 |
end if |
54 |
if (nCheckLev2 .eq. 1 ) then |
55 |
uCheckLev2=0 |
56 |
write(standardmessageunit,'(A)') |
57 |
+'OAD: NOTE: resetting level 2 to 0' |
58 |
else |
59 |
uCheckLev2=nCheckLev2 |
60 |
end if |
61 |
if (nCheckLev1 .eq. 1 ) then |
62 |
uCheckLev1=0 |
63 |
write(standardmessageunit,'(A)') |
64 |
+'OAD: NOTE: resetting level 1 to 0' |
65 |
else |
66 |
uCheckLev1=nCheckLev1 |
67 |
end if |
68 |
cju check sanity |
69 |
if (uCheckLev4 .gt. 0 ) then |
70 |
if ( uCheckLev3*uCheckLev2*uCheckLev1 .eq. 0) then |
71 |
write(errormessageunit,'(A)') |
72 |
+'OAD: ERROR: uCheckLev4 > 0 implies ', |
73 |
+'all lower levels must be nonzero too.' |
74 |
end if |
75 |
end if |
76 |
if (uCheckLev3 .gt. 0 ) then |
77 |
if ( uCheckLev2*uCheckLev1 .eq. 0) then |
78 |
write(errormessageunit,'(A)') |
79 |
+'OAD: ERROR: uCheckLev3 > 0 implies ', |
80 |
+'all lower levels must be nonzero too.' |
81 |
end if |
82 |
end if |
83 |
if (uCheckLev2 .gt. 0 ) then |
84 |
if ( uCheckLev1 .eq. 0) then |
85 |
write(errormessageunit,'(A)') |
86 |
+'OAD: ERROR: uCheckLev2 > 0 implies ', |
87 |
+'all lower levels must be nonzero too.' |
88 |
end if |
89 |
end if |
90 |
if (uCheckLev1 .eq. 0 ) then |
91 |
write(errormessageunit,'(A)') |
92 |
+'OAD: ERROR: uCheckLev1 must be nonzero ' |
93 |
end if |
94 |
|
95 |
cju uCheckLev1 |
96 |
allStepsCovered = .false. |
97 |
if (nTimeSteps .lt. uCheckLev1 ) then |
98 |
uCheckLev1=nTimeSteps |
99 |
allStepsCovered =.true. |
100 |
end if |
101 |
|
102 |
cju uCheckLev2 |
103 |
if (.NOT. allStepsCovered ) then |
104 |
if (MOD(nTimeSteps,uCheckLev1).gt.0) then |
105 |
if((nTimeSteps/uCheckLev1)+1 .le. uCheckLev2 ) then |
106 |
uCheckLev2=(nTimeSteps/uCheckLev1)+1 |
107 |
allStepsCovered =.true. |
108 |
end if |
109 |
else |
110 |
if((nTimeSteps/uCheckLev1) .le. uCheckLev2 ) then |
111 |
uCheckLev2=(nTimeSteps/uCheckLev1) |
112 |
allStepsCovered =.true. |
113 |
end if |
114 |
end if |
115 |
else |
116 |
uCheckLev2 = 0 |
117 |
end if |
118 |
|
119 |
cju uCheckLev3 |
120 |
if (.NOT. allStepsCovered ) then |
121 |
if (MOD(nTimeSteps,uCheckLev1*uCheckLev2).gt.0) then |
122 |
if((nTimeSteps/(uCheckLev1*uCheckLev2))+1 |
123 |
+ .le. uCheckLev3 ) then |
124 |
uCheckLev3=(nTimeSteps/(uCheckLev1*uCheckLev2))+1 |
125 |
allStepsCovered =.true. |
126 |
end if |
127 |
else |
128 |
if((nTimeSteps/(uCheckLev1*uCheckLev2)) .le. uCheckLev3 )then |
129 |
uCheckLev3=(nTimeSteps/(uCheckLev1*uCheckLev2)) |
130 |
allStepsCovered =.true. |
131 |
end if |
132 |
end if |
133 |
else |
134 |
uCheckLev3 = 0 |
135 |
end if |
136 |
|
137 |
cju uCheckLev4 |
138 |
if (.NOT. allStepsCovered ) then |
139 |
if (MOD(nTimeSteps,uCheckLev1*uCheckLev2*uCheckLev3) |
140 |
+ .gt.0) then |
141 |
if((nTimeSteps/(uCheckLev1*uCheckLev2*uCheckLev3))+1 |
142 |
+ .le. uCheckLev4 ) then |
143 |
uCheckLev4= |
144 |
+ (nTimeSteps/(uCheckLev1*uCheckLev2*uCheckLev3))+1 |
145 |
allStepsCovered =.true. |
146 |
end if |
147 |
else |
148 |
if((nTimeSteps/(uCheckLev1*uCheckLev2*uCheckLev3)) |
149 |
+ .le. uCheckLev4 ) then |
150 |
uCheckLev4= |
151 |
+ (nTimeSteps/(uCheckLev1*uCheckLev2*uCheckLev3)) |
152 |
allStepsCovered =.true. |
153 |
end if |
154 |
end if |
155 |
else |
156 |
uCheckLev4 = 0 |
157 |
end if |
158 |
|
159 |
if (.NOT. allStepsCovered) then |
160 |
write(errormessageunit,'(A)') |
161 |
+'OAD: ERROR: not enough checkpoints allowed' |
162 |
end if |
163 |
|
164 |
write(standardmessageunit,'(A,I6)') |
165 |
+'OAD: timesteps required:',ntimesteps |
166 |
write(standardmessageunit,'(4(A,I4))') |
167 |
+'OAD: the_main_loop checkpoints used 1st:',uCheckLev1, |
168 |
+', 2nd:', uCheckLev2, |
169 |
+', 3rd:', uCheckLev3, |
170 |
+', 4th:', uCheckLev4 |
171 |
|
172 |
END |
173 |
|