1 |
adcroft |
1.8 |
#!/bin/sh |
2 |
adcroft |
1.1 |
|
3 |
adcroft |
1.8 |
compare_lines() |
4 |
|
|
{ |
5 |
|
|
# use codelet to compare lines |
6 |
adcroft |
1.9 |
if [ $verbose -gt 1 ]; then |
7 |
|
|
cat tmp3.txt 1>&2 |
8 |
|
|
fi |
9 |
adcroft |
1.8 |
return `./a.out < tmp3.txt` |
10 |
|
|
} |
11 |
|
|
|
12 |
|
|
testoutput_for_prop() |
13 |
|
|
{ |
14 |
adcroft |
1.23 |
# testoutput_for_prop dir s1 label subdir |
15 |
adcroft |
1.8 |
# |
16 |
adcroft |
1.23 |
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
17 |
adcroft |
1.8 |
# using search strings s1 and text label |
18 |
|
|
|
19 |
|
|
if [ $debug -gt 0 ]; then |
20 |
adcroft |
1.23 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
21 |
adcroft |
1.8 |
fi |
22 |
adcroft |
1.23 |
if [ -r $1/$4/output.txt ]; then |
23 |
|
|
grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt |
24 |
adcroft |
1.22 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
25 |
|
|
if [ $lncnt -lt 3 ]; then |
26 |
|
|
if [ $verbose -gt 0 ]; then |
27 |
|
|
echo Not enough lines of output when searching for "$2" 1>&2 |
28 |
|
|
fi |
29 |
|
|
return 99 |
30 |
|
|
fi |
31 |
adcroft |
1.1 |
else |
32 |
adcroft |
1.8 |
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
33 |
|
|
return 99 |
34 |
|
|
fi |
35 |
|
|
if [ $debug -gt 0 ]; then |
36 |
|
|
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
37 |
|
|
fi |
38 |
|
|
grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt |
39 |
adcroft |
1.22 |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
40 |
|
|
if [ $lncnt -lt 3 ]; then |
41 |
|
|
if [ $verbose -gt 0 ]; then |
42 |
|
|
echo Not enough lines of output when searching for "$2" 1>&2 |
43 |
|
|
fi |
44 |
|
|
return 99 |
45 |
|
|
fi |
46 |
adcroft |
1.8 |
if [ $debug -gt 0 ]; then |
47 |
|
|
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
48 |
|
|
fi |
49 |
|
|
join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt |
50 |
|
|
if [ $debug -gt 0 ]; then |
51 |
|
|
echo testoutput_for_prop: compare_lines 1>&2 |
52 |
|
|
fi |
53 |
adcroft |
1.9 |
compare_lines |
54 |
adcroft |
1.8 |
digits_of_similarity=$? |
55 |
|
|
if [ $digits_of_similarity -eq 99 ]; then |
56 |
|
|
if [ $verbose -gt 0 ]; then |
57 |
|
|
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
58 |
|
|
fi |
59 |
|
|
digits_of_similarity=99 |
60 |
|
|
else |
61 |
|
|
if [ $verbose -gt 0 ]; then |
62 |
|
|
echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2 |
63 |
|
|
fi |
64 |
|
|
fi |
65 |
|
|
rm tmp1.txt tmp2.txt tmp3.txt |
66 |
|
|
|
67 |
|
|
return $digits_of_similarity |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
dashnum() |
71 |
|
|
{ |
72 |
|
|
# dashnum n1 n2 n3 ... |
73 |
|
|
# |
74 |
|
|
# print numbers using %3i format or "--" if number = 99 |
75 |
|
|
for num in $@ |
76 |
|
|
do |
77 |
|
|
if [ $num = 99 ]; then |
78 |
|
|
printf ' --' |
79 |
|
|
else |
80 |
|
|
printf '%3i' $num |
81 |
|
|
fi |
82 |
|
|
done |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
testoutput() |
86 |
|
|
{ |
87 |
adcroft |
1.23 |
# testoutput diretory subdir |
88 |
adcroft |
1.8 |
# |
89 |
|
|
# test output in "directory" |
90 |
|
|
|
91 |
|
|
if [ $debug -gt 0 ]; then |
92 |
|
|
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
93 |
|
|
fi |
94 |
adcroft |
1.23 |
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$? |
95 |
adcroft |
1.8 |
if [ $debug -gt 0 ]; then |
96 |
|
|
echo testoutput: cg2dres=$cg2dres 1>&2 |
97 |
|
|
fi |
98 |
|
|
|
99 |
adcroft |
1.10 |
if [ $longtest -gt 0 ]; then |
100 |
adcroft |
1.23 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
101 |
|
|
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
102 |
|
|
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
103 |
|
|
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$? |
104 |
|
|
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
105 |
|
|
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
106 |
|
|
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$? |
107 |
|
|
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$? |
108 |
|
|
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
109 |
|
|
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
110 |
|
|
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$? |
111 |
|
|
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$? |
112 |
|
|
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
113 |
|
|
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
114 |
|
|
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$? |
115 |
|
|
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$? |
116 |
adcroft |
1.8 |
else |
117 |
adcroft |
1.23 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
118 |
|
|
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
119 |
|
|
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
120 |
|
|
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
121 |
|
|
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
122 |
|
|
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
123 |
|
|
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
124 |
|
|
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
125 |
adcroft |
1.8 |
fi |
126 |
|
|
|
127 |
|
|
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
128 |
|
|
$umin $umax $umean $usd $vmin $vmax $vmean $vsd |
129 |
|
|
#printf '%3i' $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
130 |
|
|
# $umin $umax $umean $usd $vmin $vmax $vmean $vsd |
131 |
|
|
} |
132 |
|
|
|
133 |
|
|
genmakemodel() |
134 |
|
|
{ |
135 |
|
|
# genmakemodel directory |
136 |
|
|
( cd $1; |
137 |
|
|
if [ $quick -eq 0 -o ! -r Makefile ]; then |
138 |
|
|
printf 'genmake ... ' 1>&2 |
139 |
adcroft |
1.28 |
find . -type l -exec rm {} \; |
140 |
adcroft |
1.13 |
if [ $ieee -eq 0 ]; then |
141 |
adcroft |
1.26 |
../../../tools/genmake2 -mods=../code > make.log 2>&1 |
142 |
adcroft |
1.13 |
else |
143 |
adcroft |
1.26 |
../../../tools/genmake2 -ieee -mods=../code > make.log 2>&1 |
144 |
adcroft |
1.13 |
fi |
145 |
adcroft |
1.8 |
if [ $? -ne 0 ]; then |
146 |
|
|
tail make.log |
147 |
edhill |
1.25 |
echo genmakemodel: $genmake failed 1>&2 |
148 |
adcroft |
1.8 |
return 1 |
149 |
|
|
else |
150 |
|
|
echo succesful 1>&2 |
151 |
|
|
fi |
152 |
|
|
fi |
153 |
|
|
) |
154 |
|
|
} |
155 |
|
|
|
156 |
adcroft |
1.18 |
makecleancompile() |
157 |
adcroft |
1.10 |
{ |
158 |
adcroft |
1.18 |
# makecleancompile directory |
159 |
|
|
( cd $1; |
160 |
|
|
if [ $force -gt 0 ]; then |
161 |
|
|
rm -f output.txt |
162 |
|
|
printf 'make clean ... ' 2>&1 |
163 |
|
|
make CLEAN >> make.log 2>&1 |
164 |
|
|
if [ $? -ne 0 ]; then |
165 |
|
|
tail make.log |
166 |
|
|
echo makecleancompile: make clean failed 1>&2 |
167 |
|
|
return 1 |
168 |
|
|
else |
169 |
|
|
echo succesful 1>&2 |
170 |
|
|
fi |
171 |
|
|
fi |
172 |
|
|
) |
173 |
|
|
} |
174 |
|
|
|
175 |
|
|
makecleanupafter() |
176 |
|
|
{ |
177 |
|
|
# makeupafter directory |
178 |
adcroft |
1.10 |
( cd $1; |
179 |
|
|
if [ $clean -gt 0 ]; then |
180 |
adcroft |
1.15 |
rm -f output.txt |
181 |
adcroft |
1.10 |
printf 'make clean ... ' 2>&1 |
182 |
|
|
make CLEAN >> make.log 2>&1 |
183 |
|
|
if [ $? -ne 0 ]; then |
184 |
|
|
tail make.log |
185 |
adcroft |
1.18 |
echo makeupafter: make clean failed 1>&2 |
186 |
adcroft |
1.10 |
return 1 |
187 |
|
|
else |
188 |
|
|
echo succesful 1>&2 |
189 |
|
|
fi |
190 |
|
|
fi |
191 |
|
|
) |
192 |
|
|
} |
193 |
|
|
|
194 |
adcroft |
1.8 |
makedependmodel() |
195 |
|
|
{ |
196 |
|
|
# makedependmodel directory |
197 |
|
|
( cd $1; |
198 |
|
|
if [ $quick -eq 0 -o ! -r Makefile ]; then |
199 |
|
|
printf 'make depend ... ' 1>&2 |
200 |
|
|
make cleanlinks >> make.log 2>&1 |
201 |
|
|
make depend >> make.log 2>&1 |
202 |
|
|
if [ $? -ne 0 ]; then |
203 |
|
|
tail make.log |
204 |
|
|
echo makemodel: make depend failed 1>&2 |
205 |
|
|
return 1 |
206 |
|
|
else |
207 |
|
|
echo succesful 1>&2 |
208 |
|
|
fi |
209 |
|
|
fi |
210 |
|
|
) |
211 |
|
|
} |
212 |
|
|
|
213 |
|
|
makemodel() |
214 |
|
|
{ |
215 |
|
|
# makemodel directory |
216 |
|
|
( cd $1; |
217 |
|
|
if [ -r Makefile ]; then |
218 |
|
|
printf 'make ... ' 1>&2 |
219 |
|
|
make >> make.log 2>&1 |
220 |
|
|
if [ $? -ne 0 ]; then |
221 |
|
|
tail make.log |
222 |
|
|
echo failed 1>&2 |
223 |
|
|
return 1 |
224 |
|
|
else |
225 |
|
|
echo succesful 1>&2 |
226 |
|
|
fi |
227 |
|
|
fi |
228 |
|
|
) |
229 |
|
|
} |
230 |
|
|
|
231 |
adcroft |
1.23 |
linkdata() |
232 |
|
|
{ |
233 |
adcroft |
1.27 |
# linkdata flag |
234 |
|
|
# |
235 |
|
|
# symbolically link data files to run directory |
236 |
|
|
if test "x$1" = x1 ; then |
237 |
|
|
( |
238 |
|
|
cd $2 |
239 |
|
|
if test "x$ADM" = x ; then |
240 |
|
|
files=`( cd ../input ; ls -1 | grep -v CVS )` |
241 |
|
|
for i in $files ; do |
242 |
|
|
if test ! -d "../input/"$i ; then |
243 |
|
|
ln -sf "../input/"$i $i |
244 |
|
|
fi |
245 |
|
|
done |
246 |
|
|
else |
247 |
|
|
files=`( cd ../input ; ls -1 *.bin | grep -v CVS )` |
248 |
|
|
for i in $files ; do |
249 |
|
|
if test ! -d "../input/"$i ; then |
250 |
|
|
ln -sf "../input/"$i $i |
251 |
|
|
fi |
252 |
|
|
done |
253 |
|
|
files=`( cd ../input_ad ; ls -1 | grep -v CVS )` |
254 |
|
|
for i in $files ; do |
255 |
|
|
if test ! -d "../input_ad/"$i ; then |
256 |
|
|
ln -sf "../input_ad/"$i $i |
257 |
|
|
fi |
258 |
|
|
done |
259 |
|
|
fi |
260 |
|
|
) |
261 |
|
|
fi |
262 |
adcroft |
1.23 |
} |
263 |
|
|
|
264 |
adcroft |
1.8 |
runmodel() |
265 |
|
|
{ |
266 |
|
|
# runmodel directory exe |
267 |
|
|
# |
268 |
|
|
# runs the model "exe" in "directory" (exe is relative to directory) |
269 |
|
|
|
270 |
|
|
( cd $1 |
271 |
|
|
if [ -x $2 ]; then |
272 |
adcroft |
1.16 |
if [ $quick -eq 0 ]; then |
273 |
adcroft |
1.15 |
rm -f output.txt |
274 |
adcroft |
1.8 |
fi |
275 |
adcroft |
1.27 |
if [ $debug -gt 0 ]; then |
276 |
|
|
echo -n runmodel: pwd= 1>&2 |
277 |
|
|
pwd 1>&2 |
278 |
|
|
fi |
279 |
adcroft |
1.19 |
printf 'runmodel: ' 1>&2 |
280 |
adcroft |
1.29 |
rm -f *.nc |
281 |
adcroft |
1.23 |
make output.txt && return 0 |
282 |
|
|
return 1 |
283 |
adcroft |
1.8 |
fi |
284 |
|
|
) |
285 |
|
|
} |
286 |
|
|
|
287 |
adcroft |
1.27 |
copynewresults() |
288 |
|
|
{ |
289 |
|
|
# copynewresults directory |
290 |
|
|
# |
291 |
|
|
# runs the model "exe" in "directory" (exe is relative to directory) |
292 |
|
|
|
293 |
|
|
( cd $1 |
294 |
|
|
if [ $newresults -eq 1 ]; then |
295 |
|
|
if [ -r output.txt ]; then |
296 |
|
|
cp -f output.txt ../results/ |
297 |
|
|
return 0 |
298 |
|
|
fi |
299 |
|
|
fi |
300 |
|
|
) |
301 |
|
|
} |
302 |
|
|
|
303 |
adcroft |
1.8 |
createcodelet() |
304 |
|
|
{ |
305 |
|
|
# create codelet for comparing model output |
306 |
|
|
cat > tmp_cmpnum.f <<EOFA |
307 |
|
|
program cmpnum |
308 |
|
|
implicit none |
309 |
|
|
real*8 a,b,diff |
310 |
|
|
integer linnum,best |
311 |
|
|
best=-16 |
312 |
|
|
99 read(*,*,end=70,err=60) linnum,a,b |
313 |
|
|
diff=0.5*(abs(a)+abs(b)) |
314 |
adcroft |
1.9 |
c print *,a,b,diff,abs(a-b)/diff |
315 |
|
|
if (diff.gt.1.e-12) then |
316 |
adcroft |
1.8 |
diff=abs(a-b)/diff |
317 |
|
|
if (diff.gt.0.) then |
318 |
|
|
c print *,int(log10(diff)),diff |
319 |
|
|
linnum=int(log10(diff)) |
320 |
|
|
best=max(best,linnum) |
321 |
|
|
endif |
322 |
adcroft |
1.9 |
else |
323 |
|
|
if (best.eq.-16.and.diff.ne.0.) best=-22 |
324 |
adcroft |
1.1 |
endif |
325 |
adcroft |
1.8 |
goto 99 |
326 |
|
|
60 stop 'cmpnum: An error occured reading a,b' |
327 |
|
|
70 print *,-best |
328 |
|
|
end |
329 |
|
|
EOFA |
330 |
|
|
f77 tmp_cmpnum.f |
331 |
|
|
if [ -x ./a.out ]; then |
332 |
|
|
return 0 |
333 |
|
|
else |
334 |
|
|
echo createcodelet: failed to compile codelet 1>&2 |
335 |
|
|
exit 1 |
336 |
|
|
fi |
337 |
|
|
} |
338 |
|
|
|
339 |
|
|
formatresults() |
340 |
|
|
{ |
341 |
|
|
# formatresults expt genmake depend make run results* |
342 |
|
|
|
343 |
|
|
nm=$1 |
344 |
|
|
printf '%s %s %s %s' $2 $3 $4 $5 |
345 |
|
|
shift; shift; shift; shift; shift; |
346 |
|
|
printf '%3s' $@ |
347 |
|
|
|
348 |
|
|
if [ $1 = '--' ]; then |
349 |
|
|
printf ' N/O ' |
350 |
|
|
else |
351 |
|
|
if [ $1 -gt 12 ]; then |
352 |
|
|
printf ' pass' |
353 |
adcroft |
1.1 |
else |
354 |
adcroft |
1.8 |
printf ' FAIL' |
355 |
|
|
fi |
356 |
|
|
fi |
357 |
|
|
printf ' %s' $nm |
358 |
|
|
printf '\n' |
359 |
|
|
|
360 |
|
|
} |
361 |
|
|
|
362 |
|
|
show_help() |
363 |
|
|
{ |
364 |
|
|
cat - << EOF |
365 |
|
|
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
366 |
|
|
-help Show this help message |
367 |
|
|
-quick Skip "genmake" and "make depend" if the Makefile exists |
368 |
adcroft |
1.27 |
-newresults Copy the output.txt into results/ |
369 |
adcroft |
1.8 |
-quiet Reduce the amount of output |
370 |
|
|
-verbose Produce copious amounts of output |
371 |
adcroft |
1.10 |
-debug Produce even more output which will mean nothing to most |
372 |
adcroft |
1.18 |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
373 |
|
|
-clean Do "make CLEAN" after compiling and testing. |
374 |
adcroft |
1.20 |
-shorttest Don't compare numeric output for mean and s.d. of variables. |
375 |
adcroft |
1.14 |
-noieee By default, $0 uses the -ieee option for genmake. This turns it off. |
376 |
adcroft |
1.21 |
-cleanup Aggresively removes all model output, executables and object files |
377 |
|
|
and then exits. Use with care. |
378 |
adcroft |
1.8 |
|
379 |
|
|
Normal usage: |
380 |
|
|
$0 * Configure, compile, run and analyze in all experiment directories |
381 |
|
|
EOF |
382 |
|
|
} |
383 |
|
|
|
384 |
adcroft |
1.11 |
scandirs() |
385 |
|
|
{ |
386 |
|
|
if [ $# -eq 0 ]; then |
387 |
|
|
for arg in * |
388 |
|
|
do |
389 |
|
|
test -d $arg/input && echo $arg |
390 |
|
|
done |
391 |
|
|
else |
392 |
|
|
echo $* |
393 |
|
|
fi |
394 |
|
|
} |
395 |
|
|
|
396 |
adcroft |
1.21 |
clean_up() |
397 |
|
|
{ |
398 |
|
|
# Find all executables, object files, CPP'd source and model output |
399 |
|
|
# and DELETE it. |
400 |
adcroft |
1.23 |
for opt in '-name "mitgcmuv*"' '-name "*.o"' '-name "*.f"' '-name "*.c"' '-name "fort.*"' '-name "make.log"' '-path *results -prune -o -name "*.meta"' '-path *results -prune -o -name "*.data"' '-type l' |
401 |
adcroft |
1.21 |
do |
402 |
|
|
echo Cleaning: find . $opt -exec rm {} \; |
403 |
|
|
find . $opt -exec rm {} \; |
404 |
|
|
done |
405 |
|
|
} |
406 |
|
|
|
407 |
adcroft |
1.8 |
############################################################################### |
408 |
adcroft |
1.23 |
############################################################################### |
409 |
|
|
############################################################################### |
410 |
adcroft |
1.8 |
|
411 |
|
|
# Main function |
412 |
|
|
|
413 |
|
|
# Default properties |
414 |
|
|
debug=0 |
415 |
|
|
verbose=1 |
416 |
|
|
quick=0 |
417 |
adcroft |
1.27 |
newresults=0 |
418 |
adcroft |
1.18 |
force=0 |
419 |
adcroft |
1.10 |
clean=0 |
420 |
adcroft |
1.14 |
ieee=1 |
421 |
adcroft |
1.20 |
longtest=1 |
422 |
adcroft |
1.8 |
expts='' |
423 |
edhill |
1.25 |
genmake=genmake |
424 |
adcroft |
1.8 |
|
425 |
|
|
# Process arguments |
426 |
|
|
for arg in $@ |
427 |
|
|
do |
428 |
|
|
case $arg in |
429 |
adcroft |
1.21 |
-cleanup) clean_up; exit 0;; |
430 |
adcroft |
1.8 |
-quick) quick=1;; |
431 |
adcroft |
1.27 |
-newresults) newresults=1;; |
432 |
adcroft |
1.8 |
-verbose) verbose=2;; |
433 |
|
|
-debug) debug=1;; |
434 |
adcroft |
1.18 |
-force) force=1;; |
435 |
adcroft |
1.10 |
-clean) clean=1;; |
436 |
adcroft |
1.14 |
-noieee) ieee=0;; |
437 |
adcroft |
1.20 |
-shorttest) longtest=0;; |
438 |
adcroft |
1.8 |
-quiet) verbose=0;; |
439 |
|
|
-help) show_help; exit 0;; |
440 |
adcroft |
1.13 |
-*) echo Unrecognized option:$arg; exit 9;; |
441 |
adcroft |
1.8 |
*) test -d $arg && expts=`echo $expts $arg`;; |
442 |
|
|
esac |
443 |
|
|
done |
444 |
adcroft |
1.15 |
|
445 |
adcroft |
1.18 |
if [ $force -gt 0 -a $quick -gt 0 ]; then |
446 |
|
|
echo You specified -quick and -force together which conflict. |
447 |
|
|
echo Please specify either -quick or -force or neither but not both. |
448 |
adcroft |
1.15 |
exit 1 |
449 |
|
|
fi |
450 |
adcroft |
1.8 |
|
451 |
adcroft |
1.11 |
#if [ ${#expts} -eq 0 ]; then |
452 |
|
|
# echo Scanning all directories |
453 |
|
|
# for arg in * |
454 |
|
|
# do |
455 |
|
|
# test -d $arg && expts=`echo $expts $arg` |
456 |
|
|
# done |
457 |
|
|
#fi |
458 |
|
|
expts=`scandirs $expts` |
459 |
adcroft |
1.8 |
|
460 |
|
|
createcodelet |
461 |
|
|
|
462 |
jmc |
1.24 |
date > summary.txt |
463 |
adcroft |
1.10 |
if [ $longtest -gt 0 ]; then |
464 |
jmc |
1.24 |
cat << EOF >> summary.txt |
465 |
adcroft |
1.8 |
T S U V |
466 |
|
|
C D M c m s m s m s m s |
467 |
|
|
n p a R g m m e . m m e . m m e . m m e . |
468 |
|
|
f n k u 2 i a a d i a a d i a a d i a a d |
469 |
|
|
g d e n d n x n . n x n . n x n . n x n . |
470 |
|
|
|
471 |
|
|
EOF |
472 |
|
|
else |
473 |
jmc |
1.24 |
cat << EOF >> summary.txt |
474 |
adcroft |
1.8 |
T S U V |
475 |
|
|
C D M c |
476 |
|
|
n p a R g m m m m m m m m |
477 |
|
|
f n k u 2 i a i a i a i a |
478 |
|
|
g d e n d n x n x n x n x |
479 |
|
|
|
480 |
|
|
EOF |
481 |
|
|
fi |
482 |
|
|
|
483 |
|
|
# Now configue, make, run and test in each directory |
484 |
|
|
for dir in $expts |
485 |
|
|
do |
486 |
|
|
if [ -r $dir/results/output.txt ]; then |
487 |
|
|
echo ------------------------------------------------------------------------------- |
488 |
|
|
echo |
489 |
|
|
echo Experiment: $dir |
490 |
|
|
echo |
491 |
edhill |
1.25 |
unset genmakepass makedepend make run |
492 |
adcroft |
1.12 |
if [ $longtest -gt 0 ]; then |
493 |
|
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
494 |
|
|
else |
495 |
|
|
results='-- -- -- -- -- -- -- -- --' |
496 |
|
|
fi |
497 |
adcroft |
1.23 |
if [ -r $dir/build ]; then |
498 |
|
|
seperatebuilddir=1 |
499 |
|
|
builddir=build |
500 |
|
|
rundir=build |
501 |
adcroft |
1.27 |
(cd $dir/input; rm -f *.{o,f,c,F,h} work* output.txt Make* make.log; ) |
502 |
adcroft |
1.23 |
else |
503 |
|
|
seperatebuilddir=0 |
504 |
|
|
builddir=input |
505 |
|
|
rundir=input |
506 |
|
|
fi |
507 |
edhill |
1.25 |
genmakemodel $dir/$builddir && genmakepass=Y \ |
508 |
adcroft |
1.23 |
&& makecleancompile $dir/$builddir \ |
509 |
|
|
&& makedependmodel $dir/$builddir && makedepend=Y \ |
510 |
|
|
&& makemodel $dir/$builddir && make=Y \ |
511 |
|
|
&& linkdata $seperatebuilddir $dir/$rundir \ |
512 |
|
|
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
513 |
|
|
&& results=`testoutput $dir $rundir` \ |
514 |
adcroft |
1.27 |
&& copynewresults $dir/$rundir \ |
515 |
adcroft |
1.23 |
&& makecleanupafter $dir/$builddir |
516 |
adcroft |
1.8 |
echo |
517 |
edhill |
1.25 |
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
518 |
adcroft |
1.8 |
echo |
519 |
edhill |
1.25 |
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results >> summary.txt |
520 |
adcroft |
1.8 |
fi |
521 |
|
|
done |
522 |
|
|
|
523 |
|
|
rm tmp_cmpnum.f a.out |
524 |
adcroft |
1.1 |
|
525 |
adcroft |
1.8 |
echo ------------------------------------------------------------------------------- |
526 |
|
|
echo |
527 |
jmc |
1.24 |
date >> summary.txt |
528 |
adcroft |
1.1 |
cat summary.txt |