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 " (-gsl) compile with \"-gsl\" flag" |
19 |
echo " (-of=|-optfile=)STRING list of optfiles to use" |
echo " (-of=|-optfile=)STRING list of optfiles to use" |
20 |
echo " (-a|-addr) STRING list of email recipients" |
echo " (-a|-addr) STRING list of email recipients" |
21 |
echo " (DEF=\"edhill@mitgcm.org\")" |
echo " (DEF=\"\" no email is sent)" |
22 |
echo " (-t|-tdir) STRING list of group and/or exp. dirs to test" |
echo " (-t|-tdir) STRING list of group and/or exp. dirs to test" |
23 |
echo " (recognized groups: basic, tutorials)" |
echo " (recognized groups: basic, tutorials)" |
24 |
echo " (DEF=\"\" which test all)" |
echo " (DEF=\"\" which test all)" |
175 |
return $digits_of_similarity |
return $digits_of_similarity |
176 |
} |
} |
177 |
|
|
|
dashnum() |
|
|
{ |
|
|
# dashnum n1 n2 n3 ... |
|
|
# |
|
|
# print numbers using %3i format or "--" if number = 99 |
|
|
|
|
|
for num in $@ ; do |
|
|
if [ $num = 99 ]; then |
|
|
printf ' --' |
|
|
else |
|
|
printf '%3i' $num |
|
|
fi |
|
|
done |
|
|
} |
|
|
|
|
178 |
check_for_add_mon_output() |
check_for_add_mon_output() |
179 |
{ |
{ |
180 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
328 |
if test "x$IEEE" != x ; then |
if test "x$IEEE" != x ; then |
329 |
command="$command -ieee" |
command="$command -ieee" |
330 |
fi |
fi |
331 |
|
if test "x$GSL" = xt ; then |
332 |
|
command="$command -gsl" |
333 |
|
fi |
334 |
if test "x$MPI" = xt ; then |
if test "x$MPI" = xt ; then |
335 |
command="$command -mpi" |
command="$command -mpi" |
336 |
fi |
fi |
403 |
find . -type l -exec rm {} \; |
find . -type l -exec rm {} \; |
404 |
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
405 |
rm -rf mnc_test_* |
rm -rf mnc_test_* |
406 |
|
rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
407 |
echo successful 1>&2 |
echo successful 1>&2 |
408 |
exit 0 |
exit 0 |
409 |
) |
) |
532 |
if test -h eedata ; then rm -f eedata ; fi |
if test -h eedata ; then rm -f eedata ; fi |
533 |
fi |
fi |
534 |
fi |
fi |
535 |
|
prevDir='NONE' |
536 |
for ldir in $* ; do |
for ldir in $* ; do |
537 |
if test -d "../"$ldir ; then |
if test -d "../"$ldir -a $ldir != $prevDir ; then |
538 |
printf 'ldir='${ldir} 1>&2 |
printf 'ldir='${ldir} 1>&2 |
539 |
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
540 |
for i in $files ; do |
for i in $files ; do |
550 |
fi |
fi |
551 |
printf ' ; ' 1>&2 |
printf ' ; ' 1>&2 |
552 |
fi |
fi |
553 |
|
prevDir=$ldir |
554 |
done |
done |
555 |
) |
) |
556 |
fi |
fi |
567 |
printf 'runmodel in %s ...' $1 1>&2 |
printf 'runmodel in %s ...' $1 1>&2 |
568 |
# make output.txt |
# make output.txt |
569 |
echo |
echo |
570 |
|
if test -L $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
571 |
|
diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1 |
572 |
|
outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; rm -f run.log ; fi |
573 |
|
fi |
574 |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
575 |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 |
576 |
ln -sf "../"$builddir"/"$EXECUTABLE . |
ln -sf "../"$builddir"/"$EXECUTABLE . |
722 |
debug=0 |
debug=0 |
723 |
verbose=1 |
verbose=1 |
724 |
clean=0 |
clean=0 |
|
expts='' |
|
|
# ieee=1 |
|
725 |
|
|
726 |
IEEE=true |
IEEE=true |
727 |
if test "x$MITGCM_IEEE" != x ; then |
if test "x$MITGCM_IEEE" != x ; then |
728 |
IEEE=$MITGCM_IEEE |
IEEE=$MITGCM_IEEE |
729 |
fi |
fi |
730 |
|
GSL=f |
731 |
|
|
732 |
CLEANUP=f |
CLEANUP=f |
733 |
QUICK=f |
QUICK=f |
857 |
|
|
858 |
-ieee) IEEE=true ;; |
-ieee) IEEE=true ;; |
859 |
-noieee) IEEE= ;; |
-noieee) IEEE= ;; |
860 |
|
-gsl) GSL=t ;; |
861 |
|
|
862 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
863 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
894 |
#- setting for forward or ADM testing |
#- setting for forward or ADM testing |
895 |
if test "x$ADM" = xt ; then |
if test "x$ADM" = xt ; then |
896 |
code_dir=code_ad |
code_dir=code_ad |
897 |
input_dirs='input_ad input' |
inputdir=input_ad |
898 |
ref_outp="output_adm.txt" |
ref_outp="output_adm.txt" |
899 |
EXECUTABLE="mitgcmuv_ad" |
EXECUTABLE="mitgcmuv_ad" |
900 |
else |
else |
901 |
code_dir=code |
code_dir=code |
902 |
input_dirs='input' |
inputdir=input |
903 |
ref_outp="output.txt" |
ref_outp="output.txt" |
904 |
EXECUTABLE="mitgcmuv" |
EXECUTABLE="mitgcmuv" |
905 |
fi |
fi |
986 |
fi |
fi |
987 |
|
|
988 |
# Create a uniquely named directory to store results |
# Create a uniquely named directory to store results |
989 |
|
CMDLINE=$0 |
990 |
|
for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done |
991 |
MACH=`hostname` |
MACH=`hostname` |
992 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
993 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
1008 |
exit 1 |
exit 1 |
1009 |
fi |
fi |
1010 |
SUMMARY="$DRESULTS/summary.txt" |
SUMMARY="$DRESULTS/summary.txt" |
|
printf "Start time: " >> $SUMMARY |
|
1011 |
start_date=`date` |
start_date=`date` |
1012 |
echo $start_date > $SUMMARY |
echo $start_date > $SUMMARY |
1013 |
|
echo 'run:' $CMDLINE >> $SUMMARY |
1014 |
|
echo 'on :' $UNAMEA >> $SUMMARY |
1015 |
|
|
1016 |
of_path= |
of_path= |
1017 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
1085 |
# ...and each test directory... |
# ...and each test directory... |
1086 |
for dir in $TESTDIRS ; do |
for dir in $TESTDIRS ; do |
1087 |
|
|
1088 |
|
# set builddir & rundir: |
1089 |
|
builddir="build" |
1090 |
|
if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi |
1091 |
|
rundir="run" |
1092 |
|
if test ! -d $dir/$rundir ; then |
1093 |
|
rundir=$builddir |
1094 |
|
fi |
1095 |
|
CODE_DIR=$dir/$code_dir |
1096 |
|
BUILD_DIR=$dir/$builddir |
1097 |
|
|
1098 |
# Cleanup only! |
# Cleanup only! |
1099 |
if test "x$CLEANUP" = xt ; then |
if test "x$CLEANUP" = xt ; then |
1100 |
if test -r $dir/build/Makefile ; then |
if test -r $BUILD_DIR/Makefile ; then |
1101 |
echo ' ------ clean dir:' $dir/build |
echo ' ------ clean dir:' $dir/build |
1102 |
( cd $dir/build ; make CLEAN ) |
( cd $BUILD_DIR ; make CLEAN ) |
1103 |
fi |
fi |
1104 |
if test -d $dir/run/CVS ; then |
if test -d $dir/$rundir/CVS ; then |
1105 |
echo ' ------ clean dir:' $dir/run |
echo ' ------ clean dir:' $dir/$rundir |
1106 |
run_clean $dir/run |
run_clean $dir/$rundir |
1107 |
fi |
fi |
1108 |
( |
( |
1109 |
cd $dir |
cd $dir |
1125 |
|
|
1126 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
1127 |
|
|
|
builddir="build" |
|
|
if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi |
|
|
rundir="run" |
|
|
if test ! -d $dir/$rundir ; then |
|
|
rundir=$builddir |
|
|
fi |
|
|
CODE_DIR=$dir/$code_dir |
|
|
BUILD_DIR=$dir/$builddir |
|
|
|
|
1128 |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then |
1129 |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
1130 |
continue |
continue |
1136 |
|
|
1137 |
# Check whether there are "extra runs" for this testdir |
# Check whether there are "extra runs" for this testdir |
1138 |
extra_runs= |
extra_runs= |
1139 |
if test "x$ADM" = x ; then |
ex_run_dirs=`( cd $dir ; echo $inputdir.* )` |
1140 |
ex_run_dirs=`( cd $dir ; echo input.* )` |
#echo "ex_run_dirs='$ex_run_dirs'" |
1141 |
#echo "ex_run_dirs='$ex_run_dirs'" |
for exd in $ex_run_dirs ; do |
1142 |
for exd in $ex_run_dirs ; do |
name=`echo $exd | sed -e "s/$inputdir\.//"` |
1143 |
name=`echo $exd | sed -e 's/input.//g'` |
refExOut=`echo $ref_outp | sed "s/\./.${name}./"` |
1144 |
outf="$dir/results/output.$name.txt" |
outf="$dir/results/$refExOut" |
1145 |
if test -f $outf -a -r $outf ; then |
if test -f $outf -a -r $outf ; then |
1146 |
if test "x$MULTI_THREAD" = "xt" ; then |
if test "x$MULTI_THREAD" = "xt" ; then |
1147 |
if test -r $dir"/"$exd"/eedata.mth" ; then |
if test -r $dir"/"$exd"/eedata.mth" ; then |
|
extra_runs="$extra_runs $name" |
|
|
#else echo $dir"/"$exd"/eedata.mth: not found" |
|
|
fi |
|
|
else |
|
1148 |
extra_runs="$extra_runs $name" |
extra_runs="$extra_runs $name" |
1149 |
|
#else echo $dir"/"$exd"/eedata.mth: not found" |
1150 |
fi |
fi |
1151 |
|
else |
1152 |
|
extra_runs="$extra_runs $name" |
1153 |
fi |
fi |
1154 |
done |
fi |
1155 |
fi |
done |
1156 |
|
|
1157 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1158 |
echo |
echo |
1181 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
&& symlink_mpifiles $dir $code_dir $builddir \ |
1182 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1183 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1184 |
&& linkdata $dir/$rundir $input_dirs \ |
&& linkdata $dir/$rundir $inputdir input \ |
1185 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1186 |
&& results=`testoutput_run $dir $rundir $ref_outp` |
&& results=`testoutput_run $dir $rundir $ref_outp` |
1187 |
fi |
fi |
1188 |
|
|
1189 |
echo |
echo |
|
# --> same processing for adjoint & forward test |
|
1190 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1191 |
echo |
echo |
1192 |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
1196 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1197 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1198 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1199 |
|
if test "x$ADM" = xt ; then |
1200 |
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
1201 |
|
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
1202 |
|
>> $CDIR"/summary.txt" |
1203 |
|
fi |
1204 |
|
|
1205 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1206 |
unset run |
unset run |
1207 |
results=$EMPTY_RESULTS |
results=$EMPTY_RESULTS |
1208 |
|
# reference output file |
1209 |
|
refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"` |
1210 |
# Create an output dir for each OPTFILE/tdir.ex combination |
# Create an output dir for each OPTFILE/tdir.ex combination |
1211 |
rel_CDIR=$DRESULTS"/"$dir"."$ex |
rel_CDIR=$DRESULTS"/"$dir"."$ex |
1212 |
mkdir $rel_CDIR |
mkdir $rel_CDIR |
1213 |
CDIR=`pwd`"/$rel_CDIR" |
CDIR=`pwd`"/$rel_CDIR" |
1214 |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
1215 |
run_clean $dir/tr_run.$ex |
run_clean $dir/tr_run.$ex |
1216 |
linkdata $dir/tr_run.$ex input.$ex input |
linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir input |
1217 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1218 |
&& results=`testoutput_run $dir tr_run.$ex "output.${ex}.txt"` |
&& results=`testoutput_run $dir tr_run.$ex $refExOut` |
1219 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1220 |
fres="$fres.$ex" |
fres="$fres.$ex" |
1221 |
echo |
echo |
1226 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1227 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1228 |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
1229 |
|
if test "x$ADM" = xt ; then |
1230 |
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
1231 |
|
grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \ |
1232 |
|
>> $CDIR"/summary.txt" |
1233 |
|
fi |
1234 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$POSTCLEAN" = xt ; then |
1235 |
run_clean $dir/tr_run.$ex |
run_clean $dir/tr_run.$ex |
1236 |
fi |
fi |
1237 |
done |
done |
|
# <-- same processing for adjoint & forward test |
|
|
if test "x$ADM" = xt ; then |
|
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
|
|
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
|
|
>> $CDIR"/summary.txt" |
|
|
fi |
|
1238 |
|
|
1239 |
#postclean $dir/$builddir |
#postclean $dir/$builddir |
1240 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$POSTCLEAN" = xt ; then |