15 |
echo " (-mpi) compile and run using MPI" |
echo " (-mpi) compile and run using MPI" |
16 |
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
17 |
echo " (DEF=\"-ieee\")" |
echo " (DEF=\"-ieee\")" |
18 |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
echo " (-of=|-optfile=)STRING list of optfiles to use" |
19 |
echo " (-a|-addr) STRING list of email recipients" |
echo " (-a|-addr) STRING list of email recipients" |
20 |
echo " (DEF=\"edhill@mitgcm.org\")" |
echo " (DEF=\"edhill@mitgcm.org\")" |
21 |
echo " (-t|-tdir) STRING list of test dirs to use" |
echo " (-t|-tdir) STRING list of group and/or exp. dirs to test" |
22 |
echo " (DEF=\"\" which builds all)" |
echo " (recognized groups: basic, tutorials)" |
23 |
|
echo " (DEF=\"\" which test all)" |
24 |
|
echo " (-skd|-skipdir) STRING list of exp. dirs to skip" |
25 |
|
echo " (DEF=\"\" which test all)" |
26 |
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
27 |
echo " Bourne-compatible \"sh\" shell" |
echo " Bourne-compatible \"sh\" shell" |
28 |
echo " (DEF=\"\" for \"bash\")" |
echo " (DEF=\"\" for \"bash\")" |
33 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
34 |
echo " (-odir) STRING used to build output directory name" |
echo " (-odir) STRING used to build output directory name" |
35 |
echo " (DEF=\"hostname\")" |
echo " (DEF=\"hostname\")" |
36 |
echo " (-ptracers|-ptr) STRING specify which ptracers to test" |
echo " (-ptr|-ptracers) STRING specify which ptracers to test" |
37 |
echo " (DEF=\"1 2 3 4 5\")" |
echo " (DEF=\"1 2 3 4 5\")" |
38 |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
39 |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
42 |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
43 |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
44 |
echo " (-deldir|-dd) on success, delete the output directory" |
echo " (-deldir|-dd) on success, delete the output directory" |
45 |
|
echo " (-ts) provide timing information per timestep" |
46 |
|
echo " (-papis) provide MFlop/s per timestep using PAPI" |
47 |
|
echo " (-pcls) provide MFlop/s per timestep using PCL" |
48 |
echo |
echo |
49 |
echo "and where STRING can be a whitespace-delimited list" |
echo "and where STRING can be a whitespace-delimited list" |
50 |
echo "such as:" |
echo "such as:" |
96 |
{ |
{ |
97 |
# testoutput_for_prop dir s1 label subdir extension |
# testoutput_for_prop dir s1 label subdir extension |
98 |
# |
# |
99 |
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
# compares files $dir/$subdir/$OUTPUTFILE and $dir/results/output.txt |
100 |
# using search strings s1 and text label |
# using search strings s1 and text label |
101 |
|
|
102 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
103 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
104 |
fi |
fi |
105 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/$OUTPUTFILE ]; then |
106 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt |
107 |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
108 |
if [ $lncntA -lt 3 ]; then |
if [ $lncntA -lt 3 ]; then |
109 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
112 |
return 99 |
return 99 |
113 |
fi |
fi |
114 |
else |
else |
115 |
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE from model run was not readable 1>&2 |
116 |
return 99 |
return 99 |
117 |
fi |
fi |
118 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
119 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 |
echo testoutput_for_prop: grep "$2" $1/results/output.$5 1>&2 |
120 |
fi |
fi |
121 |
grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt |
grep "$2" $1/results/output.$5 | sed 's/.*=//' | cat -n > tmp2.txt |
122 |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
123 |
if [ $lncntB -lt 3 ]; then |
if [ $lncntB -lt 3 ]; then |
124 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
134 |
fi |
fi |
135 |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
136 |
if [ $has_nan -gt 0 ] ; then |
if [ $has_nan -gt 0 ] ; then |
137 |
echo testoutput_for_prop: output.txt contains $has_nan NaN values 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
138 |
return 99 |
return 99 |
139 |
fi |
fi |
140 |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
141 |
if [ $has_inf -gt 0 ] ; then |
if [ $has_inf -gt 0 ] ; then |
142 |
echo testoutput_for_prop: output.txt contains $has_inf Inf values 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
143 |
return 99 |
return 99 |
144 |
fi |
fi |
145 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
189 |
testoutput_ad() |
testoutput_ad() |
190 |
{ |
{ |
191 |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt |
192 |
grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt |
grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt |
193 |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt |
194 |
grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt |
grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt |
195 |
join t05.txt t15.txt > t5.txt |
join t05.txt t15.txt > t5.txt |
196 |
join t06.txt t16.txt > t6.txt |
join t06.txt t16.txt > t6.txt |
197 |
echo "-1" >> t5.txt |
echo "-1" >> t5.txt |
321 |
if test "x$MPI" = xt ; then |
if test "x$MPI" = xt ; then |
322 |
command="$command -mpi" |
command="$command -mpi" |
323 |
fi |
fi |
324 |
|
if test "x$TS" = xt ; then |
325 |
|
command="$command -ts" |
326 |
|
fi |
327 |
|
if test "x$PAPIS" = xt ; then |
328 |
|
command="$command -papis" |
329 |
|
else |
330 |
|
if test "x$PCLS" = xt ; then |
331 |
|
command="$command -pcls" |
332 |
|
fi |
333 |
|
fi |
334 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
335 |
$command > make.log 2>&1 |
$command > make.log 2>&1 |
336 |
RETVAL=$? |
RETVAL=$? |
356 |
else |
else |
357 |
( |
( |
358 |
cd $1; |
cd $1; |
359 |
#if test -e output.txt ; then rm -f output.txt ; fi |
#if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi |
360 |
if test -r Makefile ; then |
if test -r Makefile ; then |
361 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
362 |
$MAKE Clean >> make.log 2>&1 |
$MAKE Clean >> make.log 2>&1 |
551 |
printf 'runmodel in %s ...' $1 1>&2 |
printf 'runmodel in %s ...' $1 1>&2 |
552 |
# make output.txt |
# make output.txt |
553 |
echo |
echo |
|
rm -f run.log |
|
554 |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
555 |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 |
556 |
ln -sf "../"$builddir"/"$EXECUTABLE . |
ln -sf "../"$builddir"/"$EXECUTABLE . |
|
else |
|
|
touch run.log |
|
557 |
fi |
fi |
558 |
if test ! -x $EXECUTABLE ; then |
if test ! -x $EXECUTABLE ; then |
559 |
|
rm -f run.log ; touch run.log |
560 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
561 |
echo " no executable:" $EXECUTABLE >> run.log |
echo " no executable:" $EXECUTABLE >> run.log |
562 |
RETVAL=8 |
RETVAL=8 |
563 |
|
ENDVAL=-1 |
564 |
else |
else |
565 |
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
566 |
|
rm -f run.log ; touch run.log |
567 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
568 |
( eval $COMMAND ) >> run.log 2>&1 |
( eval $COMMAND ) >> run.log 2>&1 |
569 |
RETVAL=$? |
RETVAL=$? |
570 |
else |
else |
|
echo " $OUTPUTFILE is up to date " >> run.log 2>&1 |
|
571 |
RETVAL=0 |
RETVAL=0 |
572 |
|
if test -f run.log ; then |
573 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
574 |
|
echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 |
575 |
|
else |
576 |
|
touch run.log |
577 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
578 |
|
echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 |
579 |
|
echo " no previous run.log: assume NORMAL END" >> run.log 2>&1 |
580 |
|
fi |
581 |
fi |
fi |
582 |
|
ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'` |
583 |
fi |
fi |
584 |
# echo "COMMAND='$COMMAND'" |
rm -f run.log_00 |
585 |
# echo "pwd='"`pwd`"'" |
#if test "x$RETVAL" = x0 ; then |
586 |
if test "x$RETVAL" = x0 ; then |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
587 |
tail run.log |
tail run.log |
588 |
echo successful 1>&2 |
echo successful 1>&2 |
589 |
# === Reduce the size of the testing emails! |
# === Reduce the size of the testing emails! |
590 |
# if test "x$ADM" = x ; then |
#cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE |
|
# cp output.txt $CDIR"/output.txt" |
|
|
# else |
|
|
# cp output_adm.txt $CDIR"/output_adm.txt" |
|
|
# fi |
|
591 |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
592 |
return 0 |
return 0 |
593 |
else |
else |
594 |
tail run.log |
tail run.log |
595 |
echo failed 1>&2 |
echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2 |
596 |
cp run.log $CDIR"/run.log" |
cp run.log $CDIR"/run.log" |
597 |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
598 |
return 1 |
return 1 |
666 |
|
|
667 |
} |
} |
668 |
|
|
|
show_help() |
|
|
{ |
|
|
cat - << EOF |
|
|
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
|
|
|
|
|
-help|-h Show this help message |
|
|
-quiet Reduce the amount of output |
|
|
-verbose Produce copious amounts of output |
|
|
-debug Produce even more output which will mean nothing to most |
|
|
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
|
|
-clean Do "make CLEAN" after compiling and testing. |
|
|
-cleanup Aggresively removes all model output, executables and object files |
|
|
and then exits. Use with care. |
|
|
|
|
|
Normal usage: |
|
|
$0 * Configure, compile, run and analyze in all experiment directories |
|
|
EOF |
|
|
} |
|
|
|
|
669 |
scandirs() |
scandirs() |
670 |
{ |
{ |
671 |
if [ $# -eq 1 ]; then |
if [ $# -eq 1 ]; then |
705 |
OPTFILE=NONE |
OPTFILE=NONE |
706 |
ADDRESSES= |
ADDRESSES= |
707 |
TESTDIRS= |
TESTDIRS= |
708 |
|
SKIPDIRS= |
709 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
710 |
HAVE_MPACK= |
HAVE_MPACK= |
711 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
761 |
-tdir=* | --tdir=*) |
-tdir=* | --tdir=*) |
762 |
TESTDIRS=$ac_optarg ;; |
TESTDIRS=$ac_optarg ;; |
763 |
|
|
764 |
|
-skipdir | --skipdir | -skd | --skd) |
765 |
|
ac_prev=SKIPDIRS ;; |
766 |
|
-skipdir=* | --skipdir=*) |
767 |
|
SKIPDIRS=$ac_optarg ;; |
768 |
|
|
769 |
-bash | --bash | -b | --b) |
-bash | --bash | -b | --b) |
770 |
ac_prev=BASH ;; |
ac_prev=BASH ;; |
771 |
-bash=* | --bash=*) |
-bash=* | --bash=*) |
824 |
|
|
825 |
-deldir | -dd) DELDIR=t ;; |
-deldir | -dd) DELDIR=t ;; |
826 |
|
|
827 |
|
-ts) TS=t;; |
828 |
|
|
829 |
|
-papis) PAPIS=t;; |
830 |
|
|
831 |
|
-pcls) PCL=t;; |
832 |
|
|
833 |
-*) |
-*) |
834 |
echo "Error: unrecognized option: "$ac_option |
echo "Error: unrecognized option: "$ac_option |
835 |
usage |
usage |
852 |
|
|
853 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
854 |
if test "x$ADM" = xt ; then |
if test "x$ADM" = xt ; then |
855 |
TESTDIRS=`scandirs results_ad` |
LIST=`scandirs results_ad` |
856 |
else |
else |
857 |
TESTDIRS=`scandirs results` |
LIST=`scandirs results` |
858 |
fi |
fi |
859 |
|
else |
860 |
|
#- expand group of experiments: |
861 |
|
LIST=" " |
862 |
|
for xx in $TESTDIRS |
863 |
|
do |
864 |
|
case $xx in |
865 |
|
'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce" |
866 |
|
LIST=${LIST}" lab_sea tutorial_baroclinic_gyre" |
867 |
|
LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope" |
868 |
|
;; |
869 |
|
'tutorials') |
870 |
|
LIST=${LIST}" "`ls | grep 'tutorial_'` ;; |
871 |
|
*) LIST=${LIST}" "$xx ;; |
872 |
|
esac |
873 |
|
done |
874 |
fi |
fi |
875 |
|
#echo 'LIST='${LIST}'<' |
876 |
|
#- skip dirs, remove duplicate and non-directory: |
877 |
|
TESTDIRS=" " |
878 |
|
count=0 |
879 |
|
for xx in $LIST |
880 |
|
do |
881 |
|
yy=`echo $SKIPDIRS | grep -c $xx` |
882 |
|
if test $yy = 0 ; then |
883 |
|
if test -d $xx ; then |
884 |
|
yy=`echo $TESTDIRS | grep -c $xx` |
885 |
|
if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi |
886 |
|
else count=1 ; |
887 |
|
echo ""; echo -n " -- skip \"$xx\" (not a directory !)" |
888 |
|
fi |
889 |
|
else |
890 |
|
if test $count = 1 ; then echo -n ", \"$xx\"" |
891 |
|
else count=1 ; echo "" ; echo -n " skip: \"$xx\"" |
892 |
|
fi |
893 |
|
fi |
894 |
|
done |
895 |
|
if test $count = 1 ; then echo "" ; echo -n " ... " ; fi |
896 |
|
#echo 'TESTDIRS='${TESTDIRS}'<' |
897 |
|
|
898 |
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
899 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
907 |
OUTPUTFILE="output.txt" |
OUTPUTFILE="output.txt" |
908 |
fi |
fi |
909 |
|
|
|
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
|
|
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
|
|
fi |
|
|
|
|
910 |
if test "x$COMMAND" = x ; then |
if test "x$COMMAND" = x ; then |
911 |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
912 |
fi |
fi |
913 |
|
if test "x$MPI" = xt ; then |
914 |
|
OUTPUTFILE="STDOUT.0000" |
915 |
|
fi |
916 |
|
|
917 |
#echo "OK" |
#echo "OK" |
918 |
echo "OK (COMMAND= $COMMAND )" |
echo "OK (COMMAND= $COMMAND )" |
1086 |
#echo "ex_run_dirs='$ex_run_dirs'" |
#echo "ex_run_dirs='$ex_run_dirs'" |
1087 |
for exd in $ex_run_dirs ; do |
for exd in $ex_run_dirs ; do |
1088 |
name=`echo $exd | sed -e 's/input.//g'` |
name=`echo $exd | sed -e 's/input.//g'` |
1089 |
outf="$dir/results/output.txt.$name" |
outf="$dir/results/output.$name.txt" |
1090 |
if test -f $outf -a -r $outf ; then |
if test -f $outf -a -r $outf ; then |
1091 |
if test "x$MULTI_THREAD" = "xt" ; then |
if test "x$MULTI_THREAD" = "xt" ; then |
1092 |
if test -r $dir"/"$exd"/eedata.mth" ; then |
if test -r $dir"/"$exd"/eedata.mth" ; then |
1129 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1130 |
&& linkdata $dir/$rundir $input_dirs \ |
&& linkdata $dir/$rundir $input_dirs \ |
1131 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1132 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir "txt"` |
1133 |
fi |
fi |
1134 |
|
|
1135 |
echo |
echo |
1154 |
run_clean $dir/tr_run.$ex |
run_clean $dir/tr_run.$ex |
1155 |
linkdata $dir/tr_run.$ex input.$ex input |
linkdata $dir/tr_run.$ex input.$ex input |
1156 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1157 |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
&& results=`testoutput $dir tr_run.$ex ${ex}".txt"` |
1158 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
1159 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1160 |
fres="$fres.$ex" |
fres="$fres.$ex" |