1 |
#!/bin/bash |
#! /usr/bin/env bash |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
|
# $Name$ |
5 |
# |
# |
6 |
|
|
7 |
usage() |
usage() |
11 |
echo |
echo |
12 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
13 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
14 |
echo " (-optfile=|-of=)STRING list of genmake2 \"optfiles\"" |
echo " (-mpi) use MPI input files" |
15 |
echo " (-a|-addr)STRING list of email recipients" |
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
16 |
echo " (-t|-tdir)STRING list of \"test\" dirs" |
echo " (DEF=\"noieee\")" |
17 |
|
echo " (-optfile=|-of=)STRING list of optfiles to use" |
18 |
|
echo " (-a|-addr) STRING list of email recipients" |
19 |
|
echo " (DEF=\"edhill@mitgcm.org\")" |
20 |
|
echo " (-t|-tdir) STRING list of test dirs to use" |
21 |
|
echo " (DEF=\"\" which builds all)" |
22 |
|
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
23 |
|
echo " Bourne-compatible \"sh\" shell" |
24 |
|
echo " (DEF=\"\" for \"bash\")" |
25 |
|
echo " (-command) STRING command to run" |
26 |
|
echo " (DEF=\"make output.txt\")" |
27 |
|
echo " (-m|-make) STRING command to use for \"make\"" |
28 |
|
echo " (DEF=\"make\")" |
29 |
|
echo " (-clean) *ONLY* run \"make CLEAN\"" |
30 |
|
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
31 |
|
echo " (-nogenmake|-ng) skip the genmake stage" |
32 |
|
echo " (-noclean|-nc) skip the \"make clean\" stage" |
33 |
|
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
34 |
|
echo |
35 |
|
echo "and where STRING follows a whitespace-delimited format" |
36 |
|
echo "such as:" |
37 |
|
echo " -t 'exp0 exp2 exp3' " |
38 |
|
echo " -addr='abc@123.com testing@home.org'" |
39 |
echo |
echo |
40 |
exit 1 |
exit 1 |
41 |
} |
} |
46 |
echo -n "building the mpack utility... " |
echo -n "building the mpack utility... " |
47 |
if test ! -x "$MPACKDIR/mpack" ; then |
if test ! -x "$MPACKDIR/mpack" ; then |
48 |
if test ! -d $MPACKDIR ; then |
if test ! -d $MPACKDIR ; then |
49 |
|
echo |
50 |
echo "Error: can't find \"$MPACKDIR\"" |
echo "Error: can't find \"$MPACKDIR\"" |
51 |
echo " are you sure this program is being run in the correct " |
echo " are you sure this program is being run in the correct " |
52 |
echo " (that is, \"MITGCM_ROOT\verification\") directory?" |
echo " (that is, \"MITGCM_ROOT\verification\") directory?" |
53 |
exit 1 |
echo |
54 |
|
HAVE_MPACK=f |
55 |
fi |
fi |
56 |
echo -n "building mpack... " |
echo -n "building mpack... " |
57 |
( cd $MPACKDIR && ./configure && make ) > build_mpack.out 2>&1 |
( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1 |
58 |
RETVAL=$? |
RETVAL=$? |
59 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
60 |
echo |
echo |
61 |
echo "Error building the mpack tools at: $MPACK_DIR" |
echo "Error building the mpack tools at: $MPACK_DIR" |
62 |
exit 1 |
echo |
63 |
|
HAVE_MPACK=f |
64 |
|
else |
65 |
|
HAVE_MPACK=t |
66 |
fi |
fi |
67 |
|
else |
68 |
|
HAVE_MPACK=t |
69 |
fi |
fi |
70 |
echo "OK" |
echo "OK" |
71 |
} |
} |
90 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
91 |
fi |
fi |
92 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/output.txt ]; then |
93 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
94 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
95 |
if [ $lncnt -lt 3 ]; then |
if [ $lncnt -lt 3 ]; then |
96 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
105 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
106 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
107 |
fi |
fi |
108 |
grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt |
grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt |
109 |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
110 |
if [ $lncnt -lt 3 ]; then |
if [ $lncnt -lt 3 ]; then |
111 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
165 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
166 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
167 |
fi |
fi |
|
|
|
168 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
169 |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
170 |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
189 |
genmakemodel() |
genmakemodel() |
190 |
{ |
{ |
191 |
# genmakemodel directory |
# genmakemodel directory |
192 |
GENMAKE2="../../../tools/genmake2" |
if test "x$NOGENMAKE" = xt ; then |
193 |
( |
echo "genmake skipped!" |
194 |
cd $1; |
else |
195 |
printf 'genmake ... ' 1>&2 |
GENMAKE2="$BASH ../../../tools/genmake2" |
196 |
# ../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
( |
197 |
$GENMAKE2 -ds --mods=../code "--optfile="$OPTFILE > make.log 2>&1 |
cd $1; |
198 |
RETVAL=$? |
command="$GENMAKE2 -ds -m $MAKE --mods=../code" |
199 |
for i in gm_state gm_optfile gm_local Makefile ; do |
if test "x$OPTFILE" != xNONE ; then |
200 |
if test -r $i ; then |
command="$command --optfile=$OPTFILE" |
|
cp $i $CDIR |
|
201 |
fi |
fi |
202 |
done |
if test "x$IEEE" != x ; then |
203 |
if test "x$RETVAL" != x0 ; then |
command="$command -ieee" |
204 |
tail make.log |
fi |
205 |
echo "genmakemodel: genmake failed" 1>&2 |
printf 'genmake ... ' 1>&2 |
206 |
cp make.log $CDIR |
$command > make.log 2>&1 |
207 |
return 1 |
RETVAL=$? |
208 |
else |
cp Makefile $CDIR |
209 |
echo "succesful" 1>&2 |
if test "x$RETVAL" != x0 ; then |
210 |
fi |
tail make.log |
211 |
) |
echo "genmakemodel: genmake failed" 1>&2 |
212 |
|
cp genmake_* make.log $CDIR |
213 |
|
return 1 |
214 |
|
else |
215 |
|
echo "successful" 1>&2 |
216 |
|
fi |
217 |
|
) |
218 |
|
fi |
219 |
} |
} |
220 |
|
|
221 |
makeclean() |
makeclean() |
222 |
{ |
{ |
223 |
# makeclean directory |
# makeclean directory |
224 |
( |
if test "x$NOCLEAN" = xt ; then |
225 |
cd $1; |
echo "make CLEAN skipped!" |
226 |
rm -f output.txt |
else |
227 |
printf 'make CLEAN ... ' 2>&1 |
( |
228 |
if test -r Makefile ; then |
cd $1; |
229 |
make CLEAN >> make.log 2>&1 |
if test -e output.txt ; then |
230 |
RETVAL=$? |
rm -f output.txt |
|
if test "x$RETVAL" != x0 ; then |
|
|
tail make.log |
|
|
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
|
|
cp make.log $CDIR"/make.log" |
|
|
return 1 |
|
231 |
fi |
fi |
232 |
fi |
printf 'make CLEAN ... ' 2>&1 |
233 |
echo succesful 1>&2 |
if test -r Makefile ; then |
234 |
exit 0 |
$MAKE CLEAN >> make.log 2>&1 |
235 |
) |
RETVAL=$? |
236 |
|
if test "x$RETVAL" != x0 ; then |
237 |
|
tail make.log |
238 |
|
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
239 |
|
cp make.log $CDIR"/make.log" |
240 |
|
return 1 |
241 |
|
fi |
242 |
|
fi |
243 |
|
echo successful 1>&2 |
244 |
|
exit 0 |
245 |
|
) |
246 |
|
fi |
247 |
} |
} |
248 |
|
|
249 |
makedependmodel() |
makedependmodel() |
250 |
{ |
{ |
251 |
# makedependmodel directory |
# makedependmodel directory |
252 |
( |
if test "x$NODEPEND" = xt ; then |
253 |
cd $1; |
echo "make depend skipped!" |
254 |
printf 'make depend ... ' 1>&2 |
else |
255 |
make depend >> make.log 2>&1 |
( |
256 |
RETVAL=$? |
cd $1; |
257 |
if test "x$RETVAL" != x0 ; then |
printf 'make depend ... ' 1>&2 |
258 |
tail make.log |
$MAKE depend >> make.log 2>&1 |
259 |
echo "makedependmodel: make depend failed" 1>&2 |
RETVAL=$? |
260 |
cp make.log $CDIR"/make.log" |
if test "x$RETVAL" != x0 ; then |
261 |
return 1 |
tail make.log |
262 |
else |
echo "makedependmodel: make depend failed" 1>&2 |
263 |
echo succesful 1>&2 |
cp make.log $CDIR"/make.log" |
264 |
fi |
return 1 |
265 |
) |
else |
266 |
|
echo successful 1>&2 |
267 |
|
fi |
268 |
|
) |
269 |
|
fi |
270 |
} |
} |
271 |
|
|
272 |
makemodel() |
makemodel() |
276 |
cd $1; |
cd $1; |
277 |
if test -r Makefile ; then |
if test -r Makefile ; then |
278 |
printf 'make ... ' 1>&2 |
printf 'make ... ' 1>&2 |
279 |
make >> make.log 2>&1 |
$MAKE >> make.log 2>&1 |
280 |
RETVAL=$? |
RETVAL=$? |
281 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
282 |
tail make.log |
tail make.log |
284 |
cp make.log $CDIR"/make.log" |
cp make.log $CDIR"/make.log" |
285 |
return 1 |
return 1 |
286 |
else |
else |
287 |
echo succesful 1>&2 |
echo successful 1>&2 |
288 |
fi |
fi |
289 |
fi |
fi |
290 |
) |
) |
295 |
# linkdata flag |
# linkdata flag |
296 |
# |
# |
297 |
# symbolically link data files to run directory |
# symbolically link data files to run directory |
298 |
if [ $1 -ne 0 ]; then |
if test "x$1" = x1 ; then |
299 |
( cd $2 ; ln -sf ../input/* . ) |
( |
300 |
|
cd $2 |
301 |
|
files=`( cd ../input ; ls -1 | grep -v CVS )` |
302 |
|
for i in $files ; do |
303 |
|
if test ! -d "../input/"$i ; then |
304 |
|
ln -sf "../input/"$i $i |
305 |
|
fi |
306 |
|
done |
307 |
|
) |
308 |
fi |
fi |
309 |
} |
} |
310 |
|
|
311 |
runmodel() |
runmodel() |
312 |
{ |
{ |
313 |
# runmodel directory exe |
# runmodel directory |
314 |
# |
# |
315 |
# runs the model "exe" in "directory" (exe is relative to directory) |
# runs "$COMMAND" in "directory" |
316 |
|
# (where "$COMMAND" is relative to "directory") |
317 |
( |
( |
318 |
cd $1 |
cd $1 |
319 |
if [ -x $2 ]; then |
printf 'runmodel ... ' 1>&2 |
320 |
if [ $quick -eq 0 ]; then |
# make output.txt |
321 |
rm -f output.txt |
$COMMAND >> run.log 2>&1 |
322 |
fi |
RETVAL=$? |
323 |
printf 'runmodel: ' 1>&2 |
if test "x$RETVAL" = x0 ; then |
324 |
make output.txt |
echo successful 1>&2 |
325 |
RETVAL=$? |
cp output.txt $CDIR"/output.txt" |
326 |
if test "x$RETVAL" = x0 ; then |
return 0 |
327 |
cp output.txt $CDIR"/output.txt" |
else |
328 |
return 0 |
tail run.log |
329 |
else |
echo failed 1>&2 |
330 |
return 1 |
cp run.log $CDIR"/run.log" |
331 |
fi |
return 1 |
332 |
fi |
fi |
333 |
) |
) |
334 |
} |
} |
363 |
end |
end |
364 |
EOFA |
EOFA |
365 |
|
|
366 |
f77 tmp_cmpnum.f |
f77 -o a.out tmp_cmpnum.f |
367 |
if [ -x ./a.out ]; then |
if [ -x ./a.out ]; then |
368 |
echo "OK" |
echo "OK" |
369 |
return 0 |
return 0 |
370 |
else |
else |
371 |
echo |
echo |
372 |
echo "createcodelet: failed to compile codelet" |
echo "ERROR: failed to compile comparison code" |
373 |
exit 1 |
exit 1 |
374 |
fi |
fi |
375 |
} |
} |
401 |
{ |
{ |
402 |
cat - << EOF |
cat - << EOF |
403 |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
404 |
-help Show this help message |
|
405 |
-quick Skip "genmake" and "make depend" if the Makefile exists |
-help|-h Show this help message |
406 |
-quiet Reduce the amount of output |
-quiet Reduce the amount of output |
407 |
-verbose Produce copious amounts of output |
-verbose Produce copious amounts of output |
408 |
-debug Produce even more output which will mean nothing to most |
-debug Produce even more output which will mean nothing to most |
409 |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
410 |
-clean Do "make CLEAN" after compiling and testing. |
-clean Do "make CLEAN" after compiling and testing. |
|
-noieee By default, $0 uses the -ieee option for genmake. This turns it off. |
|
411 |
-cleanup Aggresively removes all model output, executables and object files |
-cleanup Aggresively removes all model output, executables and object files |
412 |
and then exits. Use with care. |
and then exits. Use with care. |
413 |
|
|
429 |
|
|
430 |
|
|
431 |
############################################################################### |
############################################################################### |
|
############################################################################### |
|
|
############################################################################### |
|
432 |
|
|
433 |
|
|
434 |
# Default properties |
# Default properties |
435 |
debug=0 |
debug=0 |
436 |
verbose=1 |
verbose=1 |
|
quick=0 |
|
437 |
clean=0 |
clean=0 |
|
ieee=1 |
|
438 |
expts='' |
expts='' |
439 |
|
# ieee=1 |
440 |
|
|
441 |
|
IEEE= |
442 |
|
if test "x$MITGCM_IEEE" != x ; then |
443 |
|
IEEE=$MITGCM_IEEE |
444 |
|
fi |
445 |
|
|
446 |
OPTFILES= |
|
447 |
ADDRESSES=edhill@mitgcm.org |
CLEANUP=f |
448 |
|
QUICK=f |
449 |
|
NOGENMAKE=f |
450 |
|
NOCLEAN=f |
451 |
|
NODEPEND=f |
452 |
|
|
453 |
|
BASH= |
454 |
|
OPTFILE=NONE |
455 |
|
ADDRESSES= |
456 |
TESTDIRS= |
TESTDIRS= |
457 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
458 |
|
HAVE_MPACK= |
459 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
460 |
|
COMMAND="make output.txt" |
461 |
|
MAKE=make |
462 |
|
MPI=f |
463 |
|
|
464 |
echo -n "parsing options... " |
echo -n "parsing options... " |
465 |
|
|
481 |
usage ;; |
usage ;; |
482 |
|
|
483 |
-optfile | --optfile | -of | --of) |
-optfile | --optfile | -of | --of) |
484 |
ac_prev=OPTFILES ;; |
ac_prev=OPTFILE ;; |
485 |
-optfile=* | --optfile=* | -of=* | --of=*) |
-optfile=* | --optfile=* | -of=* | --of=*) |
486 |
OPTFILES=$ac_optarg ;; |
OPTFILE=$ac_optarg ;; |
487 |
|
|
488 |
-addr | --addr | -a | --a) |
-addr | --addr | -a | --a) |
489 |
ac_prev=ADDRESSES ;; |
ac_prev=ADDRESSES ;; |
495 |
-tdir=* | --tdir=*) |
-tdir=* | --tdir=*) |
496 |
TESTDIRS=$ac_optarg ;; |
TESTDIRS=$ac_optarg ;; |
497 |
|
|
498 |
-quick) quick=1 ;; |
-bash | --bash | -b | --b) |
499 |
|
ac_prev=BASH ;; |
500 |
|
-bash=* | --bash=*) |
501 |
|
BASH=$ac_optarg ;; |
502 |
|
|
503 |
|
-command | --command | -c | --c) |
504 |
|
ac_prev=COMMAND ;; |
505 |
|
-command=* | --command=*) |
506 |
|
COMMAND=$ac_optarg ;; |
507 |
|
|
508 |
|
-make | --make | -m | --m) |
509 |
|
ac_prev=MAKE ;; |
510 |
|
-make=* | --make=*) |
511 |
|
MAKE=$ac_optarg ;; |
512 |
|
|
513 |
|
-clean | --clean) |
514 |
|
CLEANUP=t ;; |
515 |
|
|
516 |
|
-quick | --quick | -q | --q) |
517 |
|
QUICK=t ;; |
518 |
|
-nogenmake | --nogenmake | -ng | --ng) |
519 |
|
NOGENMAKE=t ;; |
520 |
|
-noclean | --noclean | -nc | --nc) |
521 |
|
NOCLEAN=t ;; |
522 |
|
-nodepend | --nodepend | -nd | --nd) |
523 |
|
NODEPEND=t ;; |
524 |
|
|
525 |
|
-mpi) MPI=t ;; |
526 |
|
|
527 |
|
-ieee) IEEE=true ;; |
528 |
|
-noieee) IEEE= ;; |
529 |
|
|
530 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
531 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
|
-clean) clean=1 ;; |
|
|
-noieee) ieee=0 ;; |
|
532 |
-quiet) verbose=0 ;; |
-quiet) verbose=0 ;; |
533 |
|
|
534 |
-*) |
-*) |
545 |
|
|
546 |
done |
done |
547 |
|
|
548 |
|
if test "x$QUICK" = xt ; then |
549 |
|
NOGENMAKE=t |
550 |
|
NOCLEAN=t |
551 |
|
NODEPEND=t |
552 |
|
fi |
553 |
|
|
554 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
555 |
TESTDIRS=`scandirs` |
TESTDIRS=`scandirs` |
556 |
fi |
fi |
557 |
|
|
558 |
|
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
559 |
|
OPTFILE=$MITGCM_OF |
560 |
|
fi |
561 |
|
|
562 |
echo "OK" |
echo "OK" |
563 |
|
|
564 |
# create the FORTRAN comparison code |
# create the FORTRAN comparison code |
581 |
mkdir $DRESULTS |
mkdir $DRESULTS |
582 |
RETVAL=$? |
RETVAL=$? |
583 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
584 |
echo "Error: can't create results directory \"./$DRESULTS\"" |
echo "ERROR: Can't create results directory \"./$DRESULTS\"" |
585 |
exit 1 |
exit 1 |
586 |
fi |
fi |
587 |
SUMMARY="$DRESULTS/summary.txt" |
SUMMARY="$DRESULTS/summary.txt" |
588 |
date > $SUMMARY |
echo -n "Start time: " >> $SUMMARY |
589 |
cat << EOF >> $SUMMARY |
start_date=`date` |
590 |
|
echo $start_date > $SUMMARY |
591 |
|
|
592 |
|
of_path= |
593 |
|
if test "x$OPTFILE" != xNONE ; then |
594 |
|
if test -r $OPTFILE ; then |
595 |
|
# get the path |
596 |
|
path=${OPTFILE%/*} |
597 |
|
if test "x$path" = x ; then |
598 |
|
of_path=`pwd` |
599 |
|
else |
600 |
|
of_path=`( cd $path > /dev/null 2>&1 ; pwd )` |
601 |
|
fi |
602 |
|
file=${OPTFILE##*/} |
603 |
|
OPTFILE=$of_path/$file |
604 |
|
cp $OPTFILE $DRESULTS |
605 |
|
echo >> $SUMMARY |
606 |
|
echo " OPTFILE=$OPTFILE" >> $SUMMARY |
607 |
|
else |
608 |
|
echo | tee $SUMMARY |
609 |
|
echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY |
610 |
|
exit 1 |
611 |
|
fi |
612 |
|
else |
613 |
|
echo >> $SUMMARY |
614 |
|
echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY |
615 |
|
echo " so the genmake default will be used." >> $SUMMARY |
616 |
|
fi |
617 |
|
echo |
618 |
|
echo >> $SUMMARY |
619 |
|
cat << EOF | tee -a $SUMMARY |
620 |
T S U V |
T S U V |
621 |
G D M c m s m s m s m s |
G D M c m s m s m s m s |
622 |
E p a R g m m e . m m e . m m e . m m e . |
E p a R g m m e . m m e . m m e . m m e . |
625 |
|
|
626 |
EOF |
EOF |
627 |
|
|
628 |
NDIR=0 |
# ...and each test directory... |
629 |
|
for dir in $TESTDIRS ; do |
630 |
# For each optfile... |
|
631 |
for OPTFILE in $OPTFILES ; do |
# Cleanup only! |
632 |
|
if test "x$CLEANUP" = xt ; then |
633 |
|
if test -r $dir/build/Makefile ; then |
634 |
|
( cd $dir/build ; make CLEAN ) |
635 |
|
fi |
636 |
|
if test -r $dir/input/Makefile ; then |
637 |
|
( cd $dir/input ; make CLEAN ) |
638 |
|
fi |
639 |
|
continue |
640 |
|
fi |
641 |
|
|
642 |
OPTFILE=`pwd`"/$OPTFILE" |
# Verify that the testdir exists and contains previous |
643 |
if test ! -r $OPTFILE ; then |
# results in the correct location--or skip this directory! |
644 |
echo "Error: can't read optfile \"$OPTFILE\"" |
if test ! -r $dir"/results/output.txt" ; then |
645 |
exit 1 |
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" |
646 |
|
continue |
647 |
fi |
fi |
|
echo |
|
|
echo "OPTFILE=$OPTFILE" >> $SUMMARY |
|
|
echo >> $SUMMARY |
|
|
|
|
|
# ...and each test directory... |
|
|
for dir in $TESTDIRS ; do |
|
648 |
|
|
649 |
# Verify that the testdir exists and contains previous |
echo "-------------------------------------------------------------------------------" |
650 |
# results in the correct location--or skip this directory! |
echo |
651 |
if test ! -r $dir"/results/output.txt" ; then |
echo "Experiment: $dir" |
652 |
echo | tee -a $SUMMARY |
echo |
653 |
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \ |
unset genmake makedepend make run |
654 |
| tee -a $SUMMARY |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
|
continue |
|
|
fi |
|
|
|
|
|
# Create an output dir for each OPTFILE/tdir combination |
|
|
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
|
|
mkdir $CDIR |
|
|
CDIR=`pwd`"/$CDIR" |
|
655 |
|
|
656 |
# ...configue, make, run, and compare the output. |
builddir="input" |
657 |
echo "-------------------------------------------------------------------------------" |
rundir="input" |
658 |
echo |
use_seperate_build=0 |
659 |
echo "Experiment: $dir" |
if test -d $dir/build -a -r $dir/build ; then |
660 |
echo |
builddir="build" |
661 |
unset genmake makedepend make run |
rundir="build" |
662 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
use_seperate_build=1 |
663 |
( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; ) |
linkdata $use_seperate_build $dir/$rundir |
664 |
if [ -r $dir/build ]; then |
fi |
665 |
seperatebuilddir=1 |
|
666 |
builddir=build |
CODE_DIR=$dir/code |
667 |
rundir=build |
BUILD_DIR=$dir/$builddir |
668 |
( cd $dir/build; ln -sf ../input/* . ) |
MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi" |
669 |
else |
NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi" |
670 |
seperatebuilddir=0 |
|
671 |
builddir=input |
# Is this an MPI run? |
672 |
rundir=input |
if test "x$MPI" = xt ; then |
673 |
|
FILES=$MPI_FILES |
674 |
|
endings="_mpi" |
675 |
|
else |
676 |
|
FILES=$NOMPI_FILES |
677 |
|
endings="_nompi" |
678 |
|
fi |
679 |
|
|
680 |
|
# Check to see that we have the files |
681 |
|
have_files=t |
682 |
|
for i in $FILES ; do |
683 |
|
if test ! -r $CODE_DIR/$i ; then |
684 |
|
echo "Warning: can't read file $CODE_DIR/$i" |
685 |
|
have_files=f |
686 |
fi |
fi |
687 |
|
done |
688 |
|
if test "x$have_files" != xt -a "x$MPI" = xt ; then |
689 |
|
echo "Skipping $dir due to lack of input files (see above warning)" |
690 |
|
continue |
691 |
|
fi |
692 |
|
|
693 |
|
# If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR |
694 |
|
if test "x$have_files" = xt ; then |
695 |
|
for i in $FILES ; do |
696 |
|
sstr="s|$endings||" |
697 |
|
name=`echo $i | sed -e $sstr ` |
698 |
|
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
699 |
|
RETVAL=$? |
700 |
|
if test "x$RETVAL" != x0 ; then |
701 |
|
cp $CODE_DIR/$i $BUILD_DIR/$name |
702 |
|
fi |
703 |
|
done |
704 |
|
fi |
705 |
|
|
706 |
|
# Create an output dir for each OPTFILE/tdir combination |
707 |
|
rel_CDIR=$DRESULTS"/"$dir |
708 |
|
mkdir $rel_CDIR |
709 |
|
CDIR=`pwd`"/$rel_CDIR" |
710 |
|
|
711 |
|
if test "x$CLEANUP" = xt ; then |
712 |
|
makeclean $dir/$builddir |
713 |
|
else |
714 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
715 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
716 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
717 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
718 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
&& linkdata $use_seperate_build $dir/$rundir \ |
719 |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
720 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir` |
721 |
echo |
fi |
722 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
|
723 |
${run:-N} $results |
echo |
724 |
echo |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
725 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
echo |
726 |
${run:-N} $results >> $SUMMARY |
echo "$fres" >> $SUMMARY |
727 |
echo "fresults='" > $CDIR"/summary.txt" |
echo "fresults='$fres'" > $CDIR"/summary.txt" |
728 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
729 |
${run:-N} $results >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
730 |
echo "'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
731 |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
732 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
|
733 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "-------------------------------------------------------------------------------" |
734 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
|
735 |
|
done |
|
( |
|
|
cd $DRESULTS |
|
|
tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1 |
|
|
gzip $NDIR".tar" |
|
|
) |
|
736 |
|
|
737 |
$MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES |
echo -n "Start time: " >> $SUMMARY |
738 |
|
echo $start_date >> $SUMMARY |
739 |
|
echo -n "End time: " >> $SUMMARY |
740 |
|
date >> $SUMMARY |
741 |
|
|
742 |
|
# If addresses were supplied and mpack built successfully, then try |
743 |
|
# to send email using mpack. |
744 |
|
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
745 |
|
echo "No results email was sent." |
746 |
|
else |
747 |
|
if test "x$HAVE_MPACK" = xt ; then |
748 |
|
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
749 |
|
&& gzip $DRESULTS".tar" \ |
750 |
|
&& $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES |
751 |
RETVAL=$? |
RETVAL=$? |
752 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
753 |
echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>" |
echo |
754 |
|
echo "Warning: The tar, gzip, & mpack step failed. Please send email" |
755 |
|
echo " to <MITgcm-support@mitgcm.org> for help. You may copy the " |
756 |
|
echo " summary of results from the directory \"$DRESULTS\"." |
757 |
|
echo |
758 |
else |
else |
759 |
rm -f $DRESULTS"/"$NDIR".tar*" |
echo |
760 |
|
echo "An email containing results was sent to the following addresses:" |
761 |
|
echo " \"$ADDRESSES\"" |
762 |
|
echo |
763 |
fi |
fi |
764 |
|
test -f $DRESULTS".tar" && rm -f $DRESULTS".tar" |
765 |
NDIR=$(( $NDIR + 1 )) |
test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz" |
766 |
|
fi |
767 |
done |
fi |
|
done |
|
768 |
|
|
769 |
rm tmp_cmpnum.f a.out |
rm tmp_cmpnum.f a.out |
770 |
|
|
771 |
cat $SUMMARY |
if test "x$CLEANUP" != xt ; then |
772 |
|
cat $SUMMARY |
773 |
|
if test -e tr.out ; then |
774 |
|
mv tr.out tr.out.old |
775 |
|
fi |
776 |
|
cat $SUMMARY > tr.out |
777 |
|
fi |
778 |
|
|