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