18 |
echo " (DEF=\"\" which builds all)" |
echo " (DEF=\"\" which builds all)" |
19 |
echo " (-b|-bash)STRING location of \"bash\" executable" |
echo " (-b|-bash)STRING location of \"bash\" executable" |
20 |
echo " (DEF=\"\" for \"/bin/bash\")" |
echo " (DEF=\"\" for \"/bin/bash\")" |
21 |
echo " (-c|-command)STRING command to run" |
echo " (-command)STRING command to run" |
22 |
echo " (DEF=\"make output.txt\")" |
echo " (DEF=\"make output.txt\")" |
23 |
echo " (-m|-make)STRING command to use for \"make\"" |
echo " (-m|-make)STRING command to use for \"make\"" |
24 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
25 |
|
echo " (-clean) *ONLY* run \"make CLEAN\"" |
26 |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
27 |
echo " (-nogenmake|-ng) skip the genmake stage" |
echo " (-nogenmake|-ng) skip the genmake stage" |
28 |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
186 |
( |
( |
187 |
cd $1; |
cd $1; |
188 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
189 |
# ../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
command="$GENMAKE2 -ds -m $MAKE --mods=../code" |
190 |
$GENMAKE2 -ds -m $MAKE --mods=../code "--optfile="$OPTFILE > make.log 2>&1 |
if test "x$OPTFILE" != xNONE ; then |
191 |
|
command="$command --optfile=$OPTFILE" |
192 |
|
# echo " command=\"$command\"" |
193 |
|
fi |
194 |
|
$command > make.log 2>&1 |
195 |
RETVAL=$? |
RETVAL=$? |
196 |
for i in gm_state gm_optfile gm_local Makefile ; do |
for i in genmake_state genmake_optfile genmake_local Makefile ; do |
197 |
if test -r $i ; then |
if test -r $i ; then |
198 |
cp $i $CDIR |
cp $i $CDIR |
199 |
fi |
fi |
428 |
NODEPEND=f |
NODEPEND=f |
429 |
|
|
430 |
BASH= |
BASH= |
431 |
OPTFILES= |
OPTFILE=NONE |
432 |
ADDRESSES= |
ADDRESSES= |
433 |
TESTDIRS= |
TESTDIRS= |
434 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
457 |
usage ;; |
usage ;; |
458 |
|
|
459 |
-optfile | --optfile | -of | --of) |
-optfile | --optfile | -of | --of) |
460 |
ac_prev=OPTFILES ;; |
ac_prev=OPTFILE ;; |
461 |
-optfile=* | --optfile=* | -of=* | --of=*) |
-optfile=* | --optfile=* | -of=* | --of=*) |
462 |
OPTFILES=$ac_optarg ;; |
OPTFILE=$ac_optarg ;; |
463 |
|
|
464 |
-addr | --addr | -a | --a) |
-addr | --addr | -a | --a) |
465 |
ac_prev=ADDRESSES ;; |
ac_prev=ADDRESSES ;; |
486 |
-make=* | --make=*) |
-make=* | --make=*) |
487 |
MAKE=$ac_optarg ;; |
MAKE=$ac_optarg ;; |
488 |
|
|
489 |
-clean | --clean | -c | --c) |
-clean | --clean) |
490 |
CLEANUP=t ;; |
CLEANUP=t ;; |
491 |
|
|
492 |
-quick | --quick | -q | --q) |
-quick | --quick | -q | --q) |
501 |
-mpi) MPI=t ;; |
-mpi) MPI=t ;; |
502 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
503 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
|
-clean) clean=1 ;; |
|
504 |
-quiet) verbose=0 ;; |
-quiet) verbose=0 ;; |
505 |
|
|
506 |
-*) |
-*) |
527 |
TESTDIRS=`scandirs` |
TESTDIRS=`scandirs` |
528 |
fi |
fi |
529 |
|
|
530 |
if test "x$OPTFILES" = x ; then |
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
531 |
OPTFILES=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
|
fi |
|
|
if test "x$OPTFILES" = x ; then |
|
|
echo "Error: please specify an optfile using either the command-line or" |
|
|
echo " the MITGCM_OF environment variable. Also, examples are located " |
|
|
echo " in \$ROOTDIR/tools/build_options" |
|
|
exit 1 |
|
532 |
fi |
fi |
533 |
|
|
534 |
echo "OK" |
echo "OK" |
569 |
|
|
570 |
NDIR=0 |
NDIR=0 |
571 |
|
|
572 |
# For each optfile... |
if test "x$OPTFILE" != xNONE ; then |
573 |
for OPTFILE in $OPTFILES ; do |
if test -r $OPTFILE ; then |
574 |
|
OPTFILE=`pwd`"/$OPTFILE" |
|
OPTFILE=`pwd`"/$OPTFILE" |
|
|
if test ! -r $OPTFILE ; then |
|
|
echo "Error: can't read optfile \"$OPTFILE\"" |
|
|
exit 1 |
|
575 |
fi |
fi |
576 |
echo |
fi |
577 |
echo "OPTFILE=$OPTFILE" >> $SUMMARY |
echo |
578 |
echo >> $SUMMARY |
echo "OPTFILE=$OPTFILE" >> $SUMMARY |
579 |
|
echo >> $SUMMARY |
|
# ...and each test directory... |
|
|
for dir in $TESTDIRS ; do |
|
580 |
|
|
581 |
# Cleanup only! |
# ...and each test directory... |
582 |
if test "x$CLEANUP" = xt ; then |
for dir in $TESTDIRS ; do |
583 |
if test -r $dir/build/Makefile ; then |
|
584 |
( cd $dir/build ; make CLEAN ) |
# Cleanup only! |
585 |
fi |
if test "x$CLEANUP" = xt ; then |
586 |
if test -r $dir/input/Makefile ; then |
if test -r $dir/build/Makefile ; then |
587 |
( cd $dir/input ; make CLEAN ) |
( cd $dir/build ; make CLEAN ) |
|
fi |
|
|
continue |
|
588 |
fi |
fi |
589 |
|
if test -r $dir/input/Makefile ; then |
590 |
# Verify that the testdir exists and contains previous |
( cd $dir/input ; make CLEAN ) |
|
# results in the correct location--or skip this directory! |
|
|
if test ! -r $dir"/results/output.txt" ; then |
|
|
echo | tee -a $SUMMARY |
|
|
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \ |
|
|
| tee -a $SUMMARY |
|
|
continue |
|
|
fi |
|
|
|
|
|
# Is this an MPI run? |
|
|
if test "x$MPI" = xt ; then |
|
|
if test ! -r $dir"/code/CPP_EEOPTIONS.h_mpi" -o ! -r $dir"/code/SIZE.h_mpi" ; then |
|
|
echo | tee -a $SUMMARY |
|
|
echo "can't read \"$dir/code/CPP_EEOPTIONS.h_mpi\" or \"$dir/code/SIZE.h_mpi\"" \ |
|
|
| tee -a $SUMMARY |
|
|
continue |
|
|
else |
|
|
cmp $dir"/code/CPP_EEOPTIONS.h_mpi" $dir"/code/CPP_EEOPTIONS.h" |
|
|
RETVAL=$? |
|
|
if test "x$RETVAL" != x0 ; then |
|
|
cp $dir"/code/CPP_EEOPTIONS.h_mpi" $dir"/code/CPP_EEOPTIONS.h" |
|
|
fi |
|
|
cmp $dir"/code/SIZE.h_mpi" $dir"/code/SIZE.h" |
|
|
RETVAL=$? |
|
|
if test "x$RETVAL" != x0 ; then |
|
|
cp $dir"/code/SIZE.h_mpi" $dir"/code/SIZE.h" |
|
|
fi |
|
|
fi |
|
|
else |
|
|
if test -r $dir"/code/CPP_EEOPTIONS.h_nompi" ; then |
|
|
cmp $dir"/code/CPP_EEOPTIONS.h_nompi" $dir"/code/CPP_EEOPTIONS.h" |
|
|
RETVAL=$? |
|
|
if test "x$RETVAL" != x0 ; then |
|
|
cp $dir"/code/CPP_EEOPTIONS.h_nompi" $dir"/code/CPP_EEOPTIONS.h" |
|
|
fi |
|
|
fi |
|
|
if test -r $dir"/code/SIZE.h_nompi" ; then |
|
|
cmp $dir"/code/SIZE.h_nompi" $dir"/code/SIZE.h" |
|
|
RETVAL=$? |
|
|
if test "x$RETVAL" != x0 ; then |
|
|
cp $dir"/code/SIZE.h_nompi" $dir"/code/SIZE.h" |
|
|
fi |
|
|
fi |
|
591 |
fi |
fi |
592 |
|
continue |
593 |
|
fi |
594 |
|
|
595 |
# Create an output dir for each OPTFILE/tdir combination |
# Verify that the testdir exists and contains previous |
596 |
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
# results in the correct location--or skip this directory! |
597 |
mkdir $CDIR |
if test ! -r $dir"/results/output.txt" ; then |
598 |
CDIR=`pwd`"/$CDIR" |
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" |
599 |
|
continue |
600 |
# ...configue, make, run, and compare the output. |
fi |
|
echo "-------------------------------------------------------------------------------" |
|
|
echo |
|
|
echo "Experiment: $dir" |
|
|
echo |
|
|
unset genmake makedepend make run |
|
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
|
601 |
|
|
602 |
if [ -r $dir/build ]; then |
echo "-------------------------------------------------------------------------------" |
603 |
seperatebuilddir=1 |
echo |
604 |
builddir=build |
echo "Experiment: $dir" |
605 |
rundir=build |
echo |
606 |
( cd $dir/build; ln -sf ../input/* . ) |
unset genmake makedepend make run |
607 |
else |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
|
seperatebuilddir=0 |
|
|
builddir=input |
|
|
rundir=input |
|
|
fi |
|
608 |
|
|
609 |
if test "x$CLEANUP" = xt ; then |
if [ -r $dir/build ]; then |
610 |
makeclean $dir/$builddir |
seperatebuilddir=1 |
611 |
else |
builddir=build |
612 |
genmakemodel $dir/$builddir && genmake=Y \ |
rundir=build |
613 |
&& makeclean $dir/$builddir \ |
( cd $dir/build; ln -sf ../input/* . ) |
614 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
else |
615 |
&& makemodel $dir/$builddir && make=Y \ |
seperatebuilddir=0 |
616 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
builddir=input |
617 |
&& runmodel $dir/$builddir && run=Y \ |
rundir=input |
618 |
&& results=`testoutput $dir $rundir` |
fi |
619 |
|
|
620 |
|
CODE_DIR=$dir/code |
621 |
|
BUILD_DIR=$dir/$builddir |
622 |
|
MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi" |
623 |
|
NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi" |
624 |
|
|
625 |
|
# Is this an MPI run? |
626 |
|
if test "x$MPI" = xt ; then |
627 |
|
FILES=$MPI_FILES |
628 |
|
else |
629 |
|
FILES=$NOMPI_FILES |
630 |
|
fi |
631 |
|
|
632 |
|
# Check to see that we have the files |
633 |
|
have_files=t |
634 |
|
for i in $FILES ; do |
635 |
|
if test ! -r $CODE_DIR/$i ; then |
636 |
|
echo "Warning: can't read file $CODE_DIR/$i" |
637 |
|
have_files=f |
638 |
fi |
fi |
639 |
|
done |
640 |
echo |
if test "x$have_files" != xt -a "x$MPI" = xt ; then |
641 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
echo "Skipping $dir due to lack of input files (see above warning)" |
642 |
${run:-N} $results |
continue |
643 |
echo |
fi |
644 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
|
645 |
${run:-N} $results >> $SUMMARY |
# If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR |
646 |
echo "fresults='" > $CDIR"/summary.txt" |
if test "x$have_files" = xt ; then |
647 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
for i in $FILES ; do |
648 |
${run:-N} $results >> $CDIR"/summary.txt" |
cmp $CODE_DIR/$i $BUILD_DIR/$i > /dev/null 2>&1 |
|
echo "'" >> $CDIR"/summary.txt" |
|
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
|
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
|
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
|
|
|
|
|
( |
|
|
cd $DRESULTS |
|
|
tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1 |
|
|
gzip $NDIR".tar" |
|
|
) |
|
|
|
|
|
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
|
|
echo "No mail sent" |
|
|
else |
|
|
$MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES |
|
649 |
RETVAL=$? |
RETVAL=$? |
650 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
651 |
echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>" |
cp $CODE_DIR/$i $BUILD_DIR/$i |
|
else |
|
|
rm -f $DRESULTS"/"$NDIR".tar*" |
|
652 |
fi |
fi |
653 |
|
done |
654 |
|
fi |
655 |
|
|
656 |
|
# Create an output dir for each OPTFILE/tdir combination |
657 |
|
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
658 |
|
mkdir $CDIR |
659 |
|
CDIR=`pwd`"/$CDIR" |
660 |
|
|
661 |
|
if test "x$CLEANUP" = xt ; then |
662 |
|
makeclean $dir/$builddir |
663 |
|
else |
664 |
|
genmakemodel $dir/$builddir && genmake=Y \ |
665 |
|
&& makeclean $dir/$builddir \ |
666 |
|
&& makedependmodel $dir/$builddir && makedepend=Y \ |
667 |
|
&& makemodel $dir/$builddir && make=Y \ |
668 |
|
&& linkdata $seperatebuilddir $dir/$rundir \ |
669 |
|
&& runmodel $dir/$builddir && run=Y \ |
670 |
|
&& results=`testoutput $dir $rundir` |
671 |
|
fi |
672 |
|
|
673 |
|
echo |
674 |
|
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
675 |
|
${run:-N} $results |
676 |
|
echo |
677 |
|
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
678 |
|
${run:-N} $results >> $SUMMARY |
679 |
|
echo "fresults='" > $CDIR"/summary.txt" |
680 |
|
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
681 |
|
${run:-N} $results >> $CDIR"/summary.txt" |
682 |
|
echo "'" >> $CDIR"/summary.txt" |
683 |
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
684 |
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
685 |
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
686 |
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
687 |
|
|
688 |
|
( |
689 |
|
cd $DRESULTS |
690 |
|
tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1 |
691 |
|
gzip $NDIR".tar" |
692 |
|
) |
693 |
|
|
694 |
|
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
695 |
|
echo "No mail sent" |
696 |
|
else |
697 |
|
$MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES |
698 |
|
RETVAL=$? |
699 |
|
if test "x$RETVAL" != x0 ; then |
700 |
|
echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>" |
701 |
|
else |
702 |
|
rm -f $DRESULTS"/"$NDIR".tar*" |
703 |
fi |
fi |
704 |
|
fi |
705 |
|
|
706 |
NDIR=$(( $NDIR + 1 )) |
echo "-------------------------------------------------------------------------------" |
707 |
|
|
708 |
done |
NDIR=$(( $NDIR + 1 )) |
709 |
|
|
710 |
done |
done |
711 |
|
|
712 |
rm tmp_cmpnum.f a.out |
rm tmp_cmpnum.f a.out |