10 |
echo |
echo |
11 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
12 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
13 |
echo " (-optfile=|-of=)STRING list of genmake2 \"optfiles\"" |
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" |
echo " (-a|-addr)STRING list of email recipients" |
16 |
echo " (-t|-tdir)STRING list of \"test\" dirs" |
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 |
24 |
|
echo "and where STRING follows a whitespace-delimited format" |
25 |
|
echo "such as:" |
26 |
|
echo " -t 'exp0 exp2 exp3' " |
27 |
|
echo " -addr='abc@123.com testing@home.org'" |
28 |
echo |
echo |
29 |
exit 1 |
exit 1 |
30 |
} |
} |
172 |
genmakemodel() |
genmakemodel() |
173 |
{ |
{ |
174 |
# genmakemodel directory |
# genmakemodel directory |
175 |
GENMAKE2="../../../tools/genmake2" |
GENMAKE2="$BASH ../../../tools/genmake2" |
176 |
( |
( |
177 |
cd $1; |
cd $1; |
178 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
200 |
# makeclean directory |
# makeclean directory |
201 |
( |
( |
202 |
cd $1; |
cd $1; |
203 |
rm -f output.txt |
if test -e output.txt ; then |
204 |
|
rm -f output.txt |
205 |
|
fi |
206 |
printf 'make CLEAN ... ' 2>&1 |
printf 'make CLEAN ... ' 2>&1 |
207 |
if test -r Makefile ; then |
if test -r Makefile ; then |
208 |
make CLEAN >> make.log 2>&1 |
make CLEAN >> make.log 2>&1 |
271 |
|
|
272 |
runmodel() |
runmodel() |
273 |
{ |
{ |
274 |
# runmodel directory exe |
# runmodel directory |
275 |
# |
# |
276 |
# runs the model "exe" in "directory" (exe is relative to directory) |
# runs "$COMMAND" in "directory" |
277 |
|
# (where "$COMMAND" is relative to "directory") |
278 |
( |
( |
279 |
cd $1 |
cd $1 |
280 |
if [ -x $2 ]; then |
printf 'runmodel: ' 1>&2 |
281 |
if [ $quick -eq 0 ]; then |
# make output.txt |
282 |
rm -f output.txt |
$COMMAND |
283 |
fi |
RETVAL=$? |
284 |
printf 'runmodel: ' 1>&2 |
if test "x$RETVAL" = x0 ; then |
285 |
make output.txt |
cp output.txt $CDIR"/output.txt" |
286 |
RETVAL=$? |
return 0 |
287 |
if test "x$RETVAL" = x0 ; then |
else |
288 |
cp output.txt $CDIR"/output.txt" |
return 1 |
|
return 0 |
|
|
else |
|
|
return 1 |
|
|
fi |
|
289 |
fi |
fi |
290 |
) |
) |
291 |
} |
} |
394 |
# Default properties |
# Default properties |
395 |
debug=0 |
debug=0 |
396 |
verbose=1 |
verbose=1 |
|
quick=0 |
|
397 |
clean=0 |
clean=0 |
|
ieee=1 |
|
398 |
expts='' |
expts='' |
399 |
|
# ieee=1 |
400 |
|
# quick=0 |
401 |
|
|
402 |
|
BASH= |
403 |
OPTFILES= |
OPTFILES= |
404 |
ADDRESSES=edhill@mitgcm.org |
ADDRESSES=edhill@mitgcm.org |
405 |
TESTDIRS= |
TESTDIRS= |
406 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
407 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
408 |
|
COMMAND="make output.txt" |
409 |
|
MPI=f |
410 |
|
|
411 |
echo -n "parsing options... " |
echo -n "parsing options... " |
412 |
|
|
442 |
-tdir=* | --tdir=*) |
-tdir=* | --tdir=*) |
443 |
TESTDIRS=$ac_optarg ;; |
TESTDIRS=$ac_optarg ;; |
444 |
|
|
445 |
-quick) quick=1 ;; |
-bash | --bash | -b | --b) |
446 |
|
ac_prev=BASH ;; |
447 |
|
-bash=* | --bash=*) |
448 |
|
BASH=$ac_optarg ;; |
449 |
|
|
450 |
|
-command | --command | -c | --c) |
451 |
|
ac_prev=COMMAND ;; |
452 |
|
-command=* | --command=*) |
453 |
|
COMMAND=$ac_optarg ;; |
454 |
|
|
455 |
|
-mpi) MPI=t ;; |
456 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
457 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
458 |
-clean) clean=1 ;; |
-clean) clean=1 ;; |
|
-noieee) ieee=0 ;; |
|
459 |
-quiet) verbose=0 ;; |
-quiet) verbose=0 ;; |
460 |
|
|
461 |
-*) |
-*) |
537 |
| tee -a $SUMMARY |
| tee -a $SUMMARY |
538 |
continue |
continue |
539 |
fi |
fi |
540 |
|
|
541 |
|
# Is this an MPI run? |
542 |
|
if test "x$MPI" = xt ; then |
543 |
|
if test ! -r $dir"/code/CPP_EEOPTIONS.h_mpi" -o ! -r $dir"/code/SIZE.h_mpi" ; then |
544 |
|
echo | tee -a $SUMMARY |
545 |
|
echo "can't read \"$dir/code/CPP_EEOPTIONS.h_mpi\" or \"$dir/code/SIZE.h_mpi\"" \ |
546 |
|
| tee -a $SUMMARY |
547 |
|
continue |
548 |
|
else |
549 |
|
cp $dir"/code/CPP_EEOPTIONS.h_mpi" $dir"/code/CPP_EEOPTIONS.h" |
550 |
|
cp $dir"/code/SIZE.h_mpi" $dir"/code/SIZE.h" |
551 |
|
fi |
552 |
|
else |
553 |
|
if test -r $dir"/code/CPP_EEOPTIONS.h_nompi" ; then |
554 |
|
cp $dir"/code/CPP_EEOPTIONS.h_nompi" $dir"/code/CPP_EEOPTIONS.h" |
555 |
|
fi |
556 |
|
if test -r $dir"/code/SIZE.h_nompi" ; then |
557 |
|
cp $dir"/code/SIZE.h_nompi" $dir"/code/SIZE.h" |
558 |
|
fi |
559 |
|
fi |
560 |
|
|
561 |
# Create an output dir for each OPTFILE/tdir combination |
# Create an output dir for each OPTFILE/tdir combination |
562 |
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
563 |
mkdir $CDIR |
mkdir $CDIR |
587 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
588 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
589 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
&& linkdata $seperatebuilddir $dir/$rundir \ |
590 |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
&& runmodel $dir/$builddir && run=Y \ |
591 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir` |
592 |
echo |
echo |
593 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |