1 |
edhill |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
edhill |
1.5 |
# $Header: /u/u3/gcmpack/MITgcm/verification/testreport,v 1.4 2003/09/03 20:02:47 edhill Exp $ |
4 |
edhill |
1.1 |
# |
5 |
|
|
|
6 |
|
|
usage() |
7 |
|
|
{ |
8 |
|
|
echo |
9 |
|
|
echo "Usage: $0 [OPTIONS]" |
10 |
|
|
echo |
11 |
|
|
echo "where possible OPTIONS are:" |
12 |
|
|
echo " (-help|-h) print usage" |
13 |
edhill |
1.6 |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
14 |
edhill |
1.1 |
echo " (-a|-addr)STRING list of email recipients" |
15 |
edhill |
1.6 |
echo " (DEF=\"edhill@mitgcm.org\")" |
16 |
|
|
echo " (-t|-tdir)STRING list of test dirs to use" |
17 |
|
|
echo " (DEF=\"\" which builds all)" |
18 |
|
|
echo " (-b|-bash)STRING location of \"bash\" executable" |
19 |
|
|
echo " (DEF=\"\" for \"/bin/bash\")" |
20 |
|
|
echo " (-c|-command)STRING command to run" |
21 |
|
|
echo " (DEF=\"make output.txt\")" |
22 |
|
|
echo |
23 |
|
|
echo "and where STRING follows a whitespace-delimited format" |
24 |
|
|
echo "such as:" |
25 |
|
|
echo " -t 'exp0 exp2 exp3' " |
26 |
|
|
echo " -addr='abc@123.com testing@home.org'" |
27 |
edhill |
1.1 |
echo |
28 |
|
|
exit 1 |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
# build the mpack utility |
32 |
|
|
build_mpack() |
33 |
|
|
{ |
34 |
|
|
echo -n "building the mpack utility... " |
35 |
|
|
if test ! -x "$MPACKDIR/mpack" ; then |
36 |
|
|
if test ! -d $MPACKDIR ; then |
37 |
|
|
echo "Error: can't find \"$MPACKDIR\"" |
38 |
|
|
echo " are you sure this program is being run in the correct " |
39 |
|
|
echo " (that is, \"MITGCM_ROOT\verification\") directory?" |
40 |
|
|
exit 1 |
41 |
|
|
fi |
42 |
|
|
echo -n "building mpack... " |
43 |
edhill |
1.6 |
( cd $MPACKDIR && ./configure && make ) > build_mpack.out 2>&1 |
44 |
edhill |
1.1 |
RETVAL=$? |
45 |
|
|
if test "x$RETVAL" != x0 ; then |
46 |
|
|
echo |
47 |
|
|
echo "Error building the mpack tools at: $MPACK_DIR" |
48 |
|
|
exit 1 |
49 |
|
|
fi |
50 |
|
|
fi |
51 |
|
|
echo "OK" |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
compare_lines() |
55 |
|
|
{ |
56 |
|
|
# use codelet to compare lines |
57 |
|
|
if [ $verbose -gt 1 ]; then |
58 |
|
|
cat tmp3.txt 1>&2 |
59 |
|
|
fi |
60 |
|
|
return `./a.out < tmp3.txt` |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
testoutput_for_prop() |
64 |
|
|
{ |
65 |
|
|
# testoutput_for_prop dir s1 label subdir |
66 |
|
|
# |
67 |
|
|
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
68 |
|
|
# using search strings s1 and text label |
69 |
|
|
|
70 |
|
|
if [ $debug -gt 0 ]; then |
71 |
|
|
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
72 |
|
|
fi |
73 |
|
|
if [ -r $1/$4/output.txt ]; then |
74 |
|
|
grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt |
75 |
|
|
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
76 |
|
|
if [ $lncnt -lt 3 ]; then |
77 |
|
|
if [ $verbose -gt 0 ]; then |
78 |
|
|
echo Not enough lines of output when searching for "$2" 1>&2 |
79 |
|
|
fi |
80 |
|
|
return 99 |
81 |
|
|
fi |
82 |
|
|
else |
83 |
|
|
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
84 |
|
|
return 99 |
85 |
|
|
fi |
86 |
|
|
if [ $debug -gt 0 ]; then |
87 |
|
|
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
88 |
|
|
fi |
89 |
|
|
grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt |
90 |
|
|
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
91 |
|
|
if [ $lncnt -lt 3 ]; then |
92 |
|
|
if [ $verbose -gt 0 ]; then |
93 |
|
|
echo Not enough lines of output when searching for "$2" 1>&2 |
94 |
|
|
fi |
95 |
|
|
return 99 |
96 |
|
|
fi |
97 |
|
|
if [ $debug -gt 0 ]; then |
98 |
|
|
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
99 |
|
|
fi |
100 |
|
|
join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt |
101 |
|
|
if [ $debug -gt 0 ]; then |
102 |
|
|
echo testoutput_for_prop: compare_lines 1>&2 |
103 |
|
|
fi |
104 |
|
|
compare_lines |
105 |
|
|
digits_of_similarity=$? |
106 |
|
|
if [ $digits_of_similarity -eq 99 ]; then |
107 |
|
|
if [ $verbose -gt 0 ]; then |
108 |
|
|
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
109 |
|
|
fi |
110 |
|
|
digits_of_similarity=99 |
111 |
|
|
else |
112 |
|
|
if [ $verbose -gt 0 ]; then |
113 |
|
|
echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2 |
114 |
|
|
fi |
115 |
|
|
fi |
116 |
|
|
rm tmp1.txt tmp2.txt tmp3.txt |
117 |
|
|
|
118 |
|
|
return $digits_of_similarity |
119 |
|
|
} |
120 |
|
|
|
121 |
|
|
dashnum() |
122 |
|
|
{ |
123 |
|
|
# dashnum n1 n2 n3 ... |
124 |
|
|
# |
125 |
|
|
# print numbers using %3i format or "--" if number = 99 |
126 |
|
|
|
127 |
|
|
for num in $@ ; do |
128 |
|
|
if [ $num = 99 ]; then |
129 |
|
|
printf ' --' |
130 |
|
|
else |
131 |
|
|
printf '%3i' $num |
132 |
|
|
fi |
133 |
|
|
done |
134 |
|
|
} |
135 |
|
|
|
136 |
|
|
testoutput() |
137 |
|
|
{ |
138 |
|
|
# testoutput diretory subdir |
139 |
|
|
# |
140 |
|
|
# test output in "directory" |
141 |
|
|
|
142 |
|
|
if [ $debug -gt 0 ]; then |
143 |
|
|
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
144 |
|
|
fi |
145 |
|
|
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$? |
146 |
|
|
if [ $debug -gt 0 ]; then |
147 |
|
|
echo testoutput: cg2dres=$cg2dres 1>&2 |
148 |
|
|
fi |
149 |
|
|
|
150 |
|
|
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
151 |
|
|
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
152 |
|
|
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
153 |
|
|
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$? |
154 |
|
|
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
155 |
|
|
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
156 |
|
|
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$? |
157 |
|
|
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$? |
158 |
|
|
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
159 |
|
|
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
160 |
|
|
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$? |
161 |
|
|
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$? |
162 |
|
|
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
163 |
|
|
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
164 |
|
|
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$? |
165 |
|
|
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$? |
166 |
|
|
|
167 |
|
|
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
168 |
|
|
$umin $umax $umean $usd $vmin $vmax $vmean $vsd |
169 |
|
|
} |
170 |
|
|
|
171 |
|
|
genmakemodel() |
172 |
|
|
{ |
173 |
|
|
# genmakemodel directory |
174 |
edhill |
1.4 |
GENMAKE2="$BASH ../../../tools/genmake2" |
175 |
edhill |
1.1 |
( |
176 |
|
|
cd $1; |
177 |
|
|
printf 'genmake ... ' 1>&2 |
178 |
|
|
# ../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
179 |
edhill |
1.6 |
$GENMAKE2 -ds --mods=../code "--optfile="$OPTFILE > make.log 2>&1 |
180 |
edhill |
1.1 |
RETVAL=$? |
181 |
|
|
for i in gm_state gm_optfile gm_local Makefile ; do |
182 |
|
|
if test -r $i ; then |
183 |
|
|
cp $i $CDIR |
184 |
|
|
fi |
185 |
|
|
done |
186 |
|
|
if test "x$RETVAL" != x0 ; then |
187 |
|
|
tail make.log |
188 |
|
|
echo "genmakemodel: genmake failed" 1>&2 |
189 |
|
|
cp make.log $CDIR |
190 |
|
|
return 1 |
191 |
|
|
else |
192 |
|
|
echo "succesful" 1>&2 |
193 |
|
|
fi |
194 |
|
|
) |
195 |
|
|
} |
196 |
|
|
|
197 |
|
|
makeclean() |
198 |
|
|
{ |
199 |
|
|
# makeclean directory |
200 |
|
|
( |
201 |
|
|
cd $1; |
202 |
edhill |
1.6 |
if test -e output.txt ; then |
203 |
|
|
rm -f output.txt |
204 |
|
|
fi |
205 |
edhill |
1.1 |
printf 'make CLEAN ... ' 2>&1 |
206 |
|
|
if test -r Makefile ; then |
207 |
edhill |
1.6 |
make CLEAN >> make.log 2>&1 |
208 |
edhill |
1.1 |
RETVAL=$? |
209 |
|
|
if test "x$RETVAL" != x0 ; then |
210 |
|
|
tail make.log |
211 |
|
|
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
212 |
|
|
cp make.log $CDIR"/make.log" |
213 |
|
|
return 1 |
214 |
|
|
fi |
215 |
|
|
fi |
216 |
|
|
echo succesful 1>&2 |
217 |
|
|
exit 0 |
218 |
|
|
) |
219 |
|
|
} |
220 |
|
|
|
221 |
|
|
makedependmodel() |
222 |
|
|
{ |
223 |
|
|
# makedependmodel directory |
224 |
|
|
( |
225 |
|
|
cd $1; |
226 |
|
|
printf 'make depend ... ' 1>&2 |
227 |
edhill |
1.6 |
make depend >> make.log 2>&1 |
228 |
edhill |
1.1 |
RETVAL=$? |
229 |
|
|
if test "x$RETVAL" != x0 ; then |
230 |
|
|
tail make.log |
231 |
|
|
echo "makedependmodel: make depend failed" 1>&2 |
232 |
|
|
cp make.log $CDIR"/make.log" |
233 |
|
|
return 1 |
234 |
|
|
else |
235 |
|
|
echo succesful 1>&2 |
236 |
|
|
fi |
237 |
|
|
) |
238 |
|
|
} |
239 |
|
|
|
240 |
|
|
makemodel() |
241 |
|
|
{ |
242 |
|
|
# makemodel directory |
243 |
|
|
( |
244 |
|
|
cd $1; |
245 |
|
|
if test -r Makefile ; then |
246 |
|
|
printf 'make ... ' 1>&2 |
247 |
edhill |
1.6 |
make >> make.log 2>&1 |
248 |
edhill |
1.1 |
RETVAL=$? |
249 |
|
|
if test "x$RETVAL" != x0 ; then |
250 |
|
|
tail make.log |
251 |
|
|
echo failed 1>&2 |
252 |
|
|
cp make.log $CDIR"/make.log" |
253 |
|
|
return 1 |
254 |
|
|
else |
255 |
|
|
echo succesful 1>&2 |
256 |
|
|
fi |
257 |
|
|
fi |
258 |
|
|
) |
259 |
|
|
} |
260 |
|
|
|
261 |
|
|
linkdata() |
262 |
|
|
{ |
263 |
|
|
# linkdata flag |
264 |
|
|
# |
265 |
|
|
# symbolically link data files to run directory |
266 |
|
|
if [ $1 -ne 0 ]; then |
267 |
|
|
( cd $2 ; ln -sf ../input/* . ) |
268 |
|
|
fi |
269 |
|
|
} |
270 |
|
|
|
271 |
|
|
runmodel() |
272 |
|
|
{ |
273 |
edhill |
1.6 |
# runmodel directory |
274 |
edhill |
1.1 |
# |
275 |
edhill |
1.6 |
# runs "$COMMAND" in "directory" |
276 |
|
|
# (where "$COMMAND" is relative to "directory") |
277 |
edhill |
1.1 |
( |
278 |
|
|
cd $1 |
279 |
edhill |
1.6 |
printf 'runmodel: ' 1>&2 |
280 |
|
|
# make output.txt |
281 |
|
|
$COMMAND |
282 |
|
|
RETVAL=$? |
283 |
|
|
if test "x$RETVAL" = x0 ; then |
284 |
|
|
cp output.txt $CDIR"/output.txt" |
285 |
|
|
return 0 |
286 |
|
|
else |
287 |
|
|
return 1 |
288 |
edhill |
1.1 |
fi |
289 |
|
|
) |
290 |
|
|
} |
291 |
|
|
|
292 |
|
|
createcodelet() |
293 |
|
|
{ |
294 |
|
|
# create codelet for comparing model output |
295 |
|
|
|
296 |
|
|
echo -n "creating the comparison code... " |
297 |
|
|
cat > tmp_cmpnum.f <<EOFA |
298 |
|
|
program cmpnum |
299 |
|
|
implicit none |
300 |
|
|
real*8 a,b,diff |
301 |
|
|
integer linnum,best |
302 |
|
|
best=-16 |
303 |
|
|
99 read(*,*,end=70,err=60) linnum,a,b |
304 |
|
|
diff=0.5*(abs(a)+abs(b)) |
305 |
|
|
c print *,a,b,diff,abs(a-b)/diff |
306 |
|
|
if (diff.gt.1.e-12) then |
307 |
|
|
diff=abs(a-b)/diff |
308 |
|
|
if (diff.gt.0.) then |
309 |
|
|
c print *,int(log10(diff)),diff |
310 |
|
|
linnum=int(log10(diff)) |
311 |
|
|
best=max(best,linnum) |
312 |
|
|
endif |
313 |
|
|
else |
314 |
|
|
if (best.eq.-16.and.diff.ne.0.) best=-22 |
315 |
|
|
endif |
316 |
|
|
goto 99 |
317 |
|
|
60 stop 'cmpnum: An error occured reading a,b' |
318 |
|
|
70 print *,-best |
319 |
|
|
end |
320 |
|
|
EOFA |
321 |
|
|
|
322 |
|
|
f77 tmp_cmpnum.f |
323 |
|
|
if [ -x ./a.out ]; then |
324 |
|
|
echo "OK" |
325 |
|
|
return 0 |
326 |
|
|
else |
327 |
|
|
echo |
328 |
edhill |
1.3 |
echo "createcodelet: failed to compile codelet" |
329 |
edhill |
1.1 |
exit 1 |
330 |
|
|
fi |
331 |
|
|
} |
332 |
|
|
|
333 |
|
|
formatresults() |
334 |
|
|
{ |
335 |
|
|
# formatresults expt genmake depend make run results* |
336 |
|
|
|
337 |
|
|
nm=$1 |
338 |
|
|
printf '%s %s %s %s' $2 $3 $4 $5 |
339 |
|
|
shift; shift; shift; shift; shift; |
340 |
|
|
printf '%3s' $@ |
341 |
|
|
|
342 |
|
|
if [ $1 = '--' ]; then |
343 |
|
|
printf ' N/O ' |
344 |
|
|
else |
345 |
|
|
if [ $1 -gt 12 ]; then |
346 |
|
|
printf ' pass' |
347 |
|
|
else |
348 |
|
|
printf ' FAIL' |
349 |
|
|
fi |
350 |
|
|
fi |
351 |
|
|
printf ' %s' $nm |
352 |
|
|
printf '\n' |
353 |
|
|
|
354 |
|
|
} |
355 |
|
|
|
356 |
|
|
show_help() |
357 |
|
|
{ |
358 |
|
|
cat - << EOF |
359 |
|
|
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
360 |
|
|
-help Show this help message |
361 |
|
|
-quick Skip "genmake" and "make depend" if the Makefile exists |
362 |
|
|
-quiet Reduce the amount of output |
363 |
|
|
-verbose Produce copious amounts of output |
364 |
|
|
-debug Produce even more output which will mean nothing to most |
365 |
|
|
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
366 |
|
|
-clean Do "make CLEAN" after compiling and testing. |
367 |
|
|
-noieee By default, $0 uses the -ieee option for genmake. This turns it off. |
368 |
|
|
-cleanup Aggresively removes all model output, executables and object files |
369 |
|
|
and then exits. Use with care. |
370 |
|
|
|
371 |
|
|
Normal usage: |
372 |
|
|
$0 * Configure, compile, run and analyze in all experiment directories |
373 |
|
|
EOF |
374 |
|
|
} |
375 |
|
|
|
376 |
|
|
scandirs() |
377 |
|
|
{ |
378 |
|
|
if [ $# -eq 0 ]; then |
379 |
|
|
for arg in * ; do |
380 |
|
|
test -d $arg/input && echo $arg |
381 |
|
|
done |
382 |
|
|
else |
383 |
|
|
echo $* |
384 |
|
|
fi |
385 |
|
|
} |
386 |
|
|
|
387 |
|
|
|
388 |
|
|
############################################################################### |
389 |
|
|
############################################################################### |
390 |
|
|
############################################################################### |
391 |
|
|
|
392 |
|
|
|
393 |
|
|
# Default properties |
394 |
|
|
debug=0 |
395 |
|
|
verbose=1 |
396 |
|
|
clean=0 |
397 |
|
|
expts='' |
398 |
edhill |
1.6 |
# ieee=1 |
399 |
|
|
# quick=0 |
400 |
edhill |
1.1 |
|
401 |
edhill |
1.4 |
BASH= |
402 |
edhill |
1.1 |
OPTFILES= |
403 |
|
|
ADDRESSES=edhill@mitgcm.org |
404 |
|
|
TESTDIRS= |
405 |
|
|
MPACKDIR="../tools/mpack-1.6" |
406 |
|
|
MPACK="$MPACKDIR/mpack" |
407 |
edhill |
1.6 |
COMMAND="make output.txt" |
408 |
edhill |
1.1 |
|
409 |
|
|
echo -n "parsing options... " |
410 |
|
|
|
411 |
|
|
ac_prev= |
412 |
|
|
for ac_option ; do |
413 |
|
|
|
414 |
|
|
# If the previous option needs an argument, assign it. |
415 |
|
|
if test -n "$ac_prev"; then |
416 |
|
|
eval "$ac_prev=\$ac_option" |
417 |
|
|
ac_prev= |
418 |
|
|
continue |
419 |
|
|
fi |
420 |
|
|
|
421 |
|
|
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` |
422 |
|
|
|
423 |
|
|
case $ac_option in |
424 |
|
|
|
425 |
|
|
-help | --help | -h | --h) |
426 |
|
|
usage ;; |
427 |
|
|
|
428 |
edhill |
1.2 |
-optfile | --optfile | -of | --of) |
429 |
edhill |
1.1 |
ac_prev=OPTFILES ;; |
430 |
edhill |
1.2 |
-optfile=* | --optfile=* | -of=* | --of=*) |
431 |
edhill |
1.1 |
OPTFILES=$ac_optarg ;; |
432 |
|
|
|
433 |
|
|
-addr | --addr | -a | --a) |
434 |
|
|
ac_prev=ADDRESSES ;; |
435 |
|
|
-addr=* | --addr=*) |
436 |
|
|
ADDRESSES=$ac_optarg ;; |
437 |
|
|
|
438 |
|
|
-tdir | --tdir | -t | --t) |
439 |
|
|
ac_prev=TESTDIRS ;; |
440 |
|
|
-tdir=* | --tdir=*) |
441 |
|
|
TESTDIRS=$ac_optarg ;; |
442 |
edhill |
1.4 |
|
443 |
|
|
-bash | --bash | -b | --b) |
444 |
|
|
ac_prev=BASH ;; |
445 |
|
|
-bash=* | --bash=*) |
446 |
|
|
BASH=$ac_optarg ;; |
447 |
edhill |
1.5 |
|
448 |
edhill |
1.6 |
-command | --command | -c | --c) |
449 |
|
|
ac_prev=COMMAND ;; |
450 |
|
|
-command=* | --command=*) |
451 |
|
|
COMMAND=$ac_optarg ;; |
452 |
edhill |
1.1 |
|
453 |
|
|
-verbose) verbose=2 ;; |
454 |
|
|
-debug) debug=1 ;; |
455 |
|
|
-clean) clean=1 ;; |
456 |
|
|
-quiet) verbose=0 ;; |
457 |
|
|
|
458 |
|
|
-*) |
459 |
|
|
echo "Error: unrecognized option: "$ac_option |
460 |
|
|
usage |
461 |
|
|
;; |
462 |
|
|
|
463 |
|
|
*) |
464 |
|
|
echo "Error: unrecognized argument: "$ac_option |
465 |
|
|
usage |
466 |
|
|
;; |
467 |
|
|
|
468 |
|
|
esac |
469 |
|
|
|
470 |
|
|
done |
471 |
|
|
|
472 |
|
|
if test "x$TESTDIRS" = x ; then |
473 |
|
|
TESTDIRS=`scandirs` |
474 |
|
|
fi |
475 |
|
|
|
476 |
|
|
echo "OK" |
477 |
|
|
|
478 |
|
|
# create the FORTRAN comparison code |
479 |
|
|
createcodelet |
480 |
|
|
|
481 |
|
|
# build the mpack utility |
482 |
|
|
build_mpack |
483 |
|
|
|
484 |
|
|
# Create a uniquely named directory to store results |
485 |
|
|
MACH=`hostname` |
486 |
edhill |
1.2 |
UNAMEA=`uname -a` |
487 |
edhill |
1.1 |
DATE=`date +%Y%m%d` |
488 |
|
|
BASE=$MACH"_"$DATE"_" |
489 |
|
|
DNUM=0 |
490 |
|
|
DRESULTS="$BASE$DNUM" |
491 |
|
|
while test -e $DRESULTS ; do |
492 |
|
|
DNUM=$(( $DNUM + 1 )) |
493 |
|
|
DRESULTS="$BASE$DNUM" |
494 |
|
|
done |
495 |
|
|
mkdir $DRESULTS |
496 |
|
|
RETVAL=$? |
497 |
|
|
if test "x$RETVAL" != x0 ; then |
498 |
|
|
echo "Error: can't create results directory \"./$DRESULTS\"" |
499 |
|
|
exit 1 |
500 |
|
|
fi |
501 |
|
|
SUMMARY="$DRESULTS/summary.txt" |
502 |
|
|
date > $SUMMARY |
503 |
|
|
cat << EOF >> $SUMMARY |
504 |
|
|
T S U V |
505 |
|
|
G D M c m s m s m s m s |
506 |
|
|
E p a R g m m e . m m e . m m e . m m e . |
507 |
|
|
N n k u 2 i a a d i a a d i a a d i a a d |
508 |
|
|
2 d e n d n x n . n x n . n x n . n x n . |
509 |
|
|
|
510 |
|
|
EOF |
511 |
|
|
|
512 |
|
|
NDIR=0 |
513 |
|
|
|
514 |
|
|
# For each optfile... |
515 |
|
|
for OPTFILE in $OPTFILES ; do |
516 |
|
|
|
517 |
|
|
OPTFILE=`pwd`"/$OPTFILE" |
518 |
|
|
if test ! -r $OPTFILE ; then |
519 |
|
|
echo "Error: can't read optfile \"$OPTFILE\"" |
520 |
|
|
exit 1 |
521 |
|
|
fi |
522 |
|
|
echo |
523 |
|
|
echo "OPTFILE=$OPTFILE" >> $SUMMARY |
524 |
|
|
echo >> $SUMMARY |
525 |
|
|
|
526 |
|
|
# ...and each test directory... |
527 |
|
|
for dir in $TESTDIRS ; do |
528 |
edhill |
1.3 |
|
529 |
|
|
# Verify that the testdir exists and contains previous |
530 |
|
|
# results in the correct location--or skip this directory! |
531 |
|
|
if test ! -r $dir"/results/output.txt" ; then |
532 |
|
|
echo | tee -a $SUMMARY |
533 |
|
|
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \ |
534 |
|
|
| tee -a $SUMMARY |
535 |
|
|
continue |
536 |
|
|
fi |
537 |
edhill |
1.1 |
|
538 |
|
|
# Create an output dir for each OPTFILE/tdir combination |
539 |
edhill |
1.2 |
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
540 |
edhill |
1.1 |
mkdir $CDIR |
541 |
|
|
CDIR=`pwd`"/$CDIR" |
542 |
|
|
|
543 |
|
|
# ...configue, make, run, and compare the output. |
544 |
|
|
echo "-------------------------------------------------------------------------------" |
545 |
|
|
echo |
546 |
|
|
echo "Experiment: $dir" |
547 |
|
|
echo |
548 |
|
|
unset genmake makedepend make run |
549 |
|
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
550 |
|
|
( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; ) |
551 |
|
|
if [ -r $dir/build ]; then |
552 |
|
|
seperatebuilddir=1 |
553 |
|
|
builddir=build |
554 |
|
|
rundir=build |
555 |
|
|
( cd $dir/build; ln -sf ../input/* . ) |
556 |
|
|
else |
557 |
|
|
seperatebuilddir=0 |
558 |
|
|
builddir=input |
559 |
|
|
rundir=input |
560 |
edhill |
1.2 |
fi |
561 |
|
|
|
562 |
edhill |
1.1 |
genmakemodel $dir/$builddir && genmake=Y \ |
563 |
|
|
&& makeclean $dir/$builddir \ |
564 |
|
|
&& makedependmodel $dir/$builddir && makedepend=Y \ |
565 |
|
|
&& makemodel $dir/$builddir && make=Y \ |
566 |
|
|
&& linkdata $seperatebuilddir $dir/$rundir \ |
567 |
edhill |
1.6 |
&& runmodel $dir/$builddir && run=Y \ |
568 |
edhill |
1.1 |
&& results=`testoutput $dir $rundir` |
569 |
|
|
echo |
570 |
edhill |
1.2 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
571 |
|
|
${run:-N} $results |
572 |
edhill |
1.1 |
echo |
573 |
edhill |
1.2 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
574 |
|
|
${run:-N} $results >> $SUMMARY |
575 |
|
|
echo "fresults='" > $CDIR"/summary.txt" |
576 |
|
|
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
577 |
|
|
${run:-N} $results >> $CDIR"/summary.txt" |
578 |
|
|
echo "'" >> $CDIR"/summary.txt" |
579 |
|
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
580 |
|
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
581 |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
582 |
|
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
583 |
|
|
|
584 |
|
|
( |
585 |
|
|
cd $DRESULTS |
586 |
|
|
tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1 |
587 |
|
|
gzip $NDIR".tar" |
588 |
|
|
) |
589 |
edhill |
1.1 |
|
590 |
edhill |
1.2 |
$MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES |
591 |
|
|
RETVAL=$? |
592 |
|
|
if test "x$RETVAL" != x0 ; then |
593 |
|
|
echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>" |
594 |
|
|
else |
595 |
|
|
rm -f $DRESULTS"/"$NDIR".tar*" |
596 |
|
|
fi |
597 |
edhill |
1.1 |
|
598 |
|
|
NDIR=$(( $NDIR + 1 )) |
599 |
|
|
|
600 |
|
|
done |
601 |
|
|
done |
602 |
|
|
|
603 |
edhill |
1.2 |
rm tmp_cmpnum.f a.out |
604 |
edhill |
1.1 |
|
605 |
|
|
cat $SUMMARY |
606 |
|
|
|