17 |
echo " (DEF=\"-ieee\")" |
echo " (DEF=\"-ieee\")" |
18 |
echo " (-of=|-optfile=)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=\"\" no email is sent)" |
21 |
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" |
22 |
echo " (recognized groups: basic, tutorials)" |
echo " (recognized groups: basic, tutorials)" |
23 |
echo " (DEF=\"\" which test all)" |
echo " (DEF=\"\" which test all)" |
174 |
return $digits_of_similarity |
return $digits_of_similarity |
175 |
} |
} |
176 |
|
|
|
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 |
|
|
} |
|
|
|
|
177 |
check_for_add_mon_output() |
check_for_add_mon_output() |
178 |
{ |
{ |
179 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
399 |
find . -type l -exec rm {} \; |
find . -type l -exec rm {} \; |
400 |
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
401 |
rm -rf mnc_test_* |
rm -rf mnc_test_* |
402 |
|
rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
403 |
echo successful 1>&2 |
echo successful 1>&2 |
404 |
exit 0 |
exit 0 |
405 |
) |
) |
528 |
if test -h eedata ; then rm -f eedata ; fi |
if test -h eedata ; then rm -f eedata ; fi |
529 |
fi |
fi |
530 |
fi |
fi |
531 |
|
prevDir='NONE' |
532 |
for ldir in $* ; do |
for ldir in $* ; do |
533 |
if test -d "../"$ldir ; then |
if test -d "../"$ldir -a $ldir != $prevDir ; then |
534 |
printf 'ldir='${ldir} 1>&2 |
printf 'ldir='${ldir} 1>&2 |
535 |
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
536 |
for i in $files ; do |
for i in $files ; do |
546 |
fi |
fi |
547 |
printf ' ; ' 1>&2 |
printf ' ; ' 1>&2 |
548 |
fi |
fi |
549 |
|
prevDir=$ldir |
550 |
done |
done |
551 |
) |
) |
552 |
fi |
fi |
563 |
printf 'runmodel in %s ...' $1 1>&2 |
printf 'runmodel in %s ...' $1 1>&2 |
564 |
# make output.txt |
# make output.txt |
565 |
echo |
echo |
566 |
|
if test -L $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
567 |
|
diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1 |
568 |
|
outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; rm -f run.log ; fi |
569 |
|
fi |
570 |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
571 |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 |
572 |
ln -sf "../"$builddir"/"$EXECUTABLE . |
ln -sf "../"$builddir"/"$EXECUTABLE . |
891 |
#- setting for forward or ADM testing |
#- setting for forward or ADM testing |
892 |
if test "x$ADM" = xt ; then |
if test "x$ADM" = xt ; then |
893 |
code_dir=code_ad |
code_dir=code_ad |
894 |
input_dirs='input_ad input' |
inputdir=input_ad |
895 |
ref_outp="output_adm.txt" |
ref_outp="output_adm.txt" |
896 |
EXECUTABLE="mitgcmuv_ad" |
EXECUTABLE="mitgcmuv_ad" |
897 |
else |
else |
898 |
code_dir=code |
code_dir=code |
899 |
input_dirs='input' |
inputdir=input |
900 |
ref_outp="output.txt" |
ref_outp="output.txt" |
901 |
EXECUTABLE="mitgcmuv" |
EXECUTABLE="mitgcmuv" |
902 |
fi |
fi |
1079 |
# ...and each test directory... |
# ...and each test directory... |
1080 |
for dir in $TESTDIRS ; do |
for dir in $TESTDIRS ; do |
1081 |
|
|
1082 |
|
# set builddir & rundir: |
1083 |
|
builddir="build" |
1084 |
|
if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi |
1085 |
|
rundir="run" |
1086 |
|
if test ! -d $dir/$rundir ; then |
1087 |
|
rundir=$builddir |
1088 |
|
fi |
1089 |
|
CODE_DIR=$dir/$code_dir |
1090 |
|
BUILD_DIR=$dir/$builddir |
1091 |
|
|
1092 |
# Cleanup only! |
# Cleanup only! |
1093 |
if test "x$CLEANUP" = xt ; then |
if test "x$CLEANUP" = xt ; then |
1094 |
if test -r $dir/build/Makefile ; then |
if test -r $BUILD_DIR/Makefile ; then |
1095 |
echo ' ------ clean dir:' $dir/build |
echo ' ------ clean dir:' $dir/build |
1096 |
( cd $dir/build ; make CLEAN ) |
( cd $BUILD_DIR ; make CLEAN ) |
1097 |
fi |
fi |
1098 |
if test -d $dir/run/CVS ; then |
if test -d $dir/$rundir/CVS ; then |
1099 |
echo ' ------ clean dir:' $dir/run |
echo ' ------ clean dir:' $dir/$rundir |
1100 |
run_clean $dir/run |
run_clean $dir/$rundir |
1101 |
fi |
fi |
1102 |
( |
( |
1103 |
cd $dir |
cd $dir |
1119 |
|
|
1120 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
1121 |
|
|
|
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 |
|
|
|
|
1122 |
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 |
1123 |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
1124 |
continue |
continue |
1130 |
|
|
1131 |
# Check whether there are "extra runs" for this testdir |
# Check whether there are "extra runs" for this testdir |
1132 |
extra_runs= |
extra_runs= |
1133 |
if test "x$ADM" = x ; then |
ex_run_dirs=`( cd $dir ; echo $inputdir.* )` |
1134 |
ex_run_dirs=`( cd $dir ; echo input.* )` |
#echo "ex_run_dirs='$ex_run_dirs'" |
1135 |
#echo "ex_run_dirs='$ex_run_dirs'" |
for exd in $ex_run_dirs ; do |
1136 |
for exd in $ex_run_dirs ; do |
name=`echo $exd | sed -e "s/$inputdir\.//"` |
1137 |
name=`echo $exd | sed -e 's/input.//g'` |
refExOut=`echo $ref_outp | sed "s/\./.${name}./"` |
1138 |
outf="$dir/results/output.$name.txt" |
outf="$dir/results/$refExOut" |
1139 |
if test -f $outf -a -r $outf ; then |
if test -f $outf -a -r $outf ; then |
1140 |
if test "x$MULTI_THREAD" = "xt" ; then |
if test "x$MULTI_THREAD" = "xt" ; then |
1141 |
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 |
|
1142 |
extra_runs="$extra_runs $name" |
extra_runs="$extra_runs $name" |
1143 |
|
#else echo $dir"/"$exd"/eedata.mth: not found" |
1144 |
fi |
fi |
1145 |
|
else |
1146 |
|
extra_runs="$extra_runs $name" |
1147 |
fi |
fi |
1148 |
done |
fi |
1149 |
fi |
done |
1150 |
|
|
1151 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1152 |
echo |
echo |
1175 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
&& symlink_mpifiles $dir $code_dir $builddir \ |
1176 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1177 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1178 |
&& linkdata $dir/$rundir $input_dirs \ |
&& linkdata $dir/$rundir $inputdir input \ |
1179 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1180 |
&& results=`testoutput_run $dir $rundir $ref_outp` |
&& results=`testoutput_run $dir $rundir $ref_outp` |
1181 |
fi |
fi |
1182 |
|
|
1183 |
echo |
echo |
|
# --> same processing for adjoint & forward test |
|
1184 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1185 |
echo |
echo |
1186 |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
1190 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1191 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1192 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1193 |
|
if test "x$ADM" = xt ; then |
1194 |
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
1195 |
|
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
1196 |
|
>> $CDIR"/summary.txt" |
1197 |
|
fi |
1198 |
|
|
1199 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1200 |
unset run |
unset run |
1201 |
results=$EMPTY_RESULTS |
results=$EMPTY_RESULTS |
1202 |
|
# reference output file |
1203 |
|
refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"` |
1204 |
# Create an output dir for each OPTFILE/tdir.ex combination |
# Create an output dir for each OPTFILE/tdir.ex combination |
1205 |
rel_CDIR=$DRESULTS"/"$dir"."$ex |
rel_CDIR=$DRESULTS"/"$dir"."$ex |
1206 |
mkdir $rel_CDIR |
mkdir $rel_CDIR |
1207 |
CDIR=`pwd`"/$rel_CDIR" |
CDIR=`pwd`"/$rel_CDIR" |
1208 |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
1209 |
run_clean $dir/tr_run.$ex |
run_clean $dir/tr_run.$ex |
1210 |
linkdata $dir/tr_run.$ex input.$ex input |
linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir input |
1211 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1212 |
&& results=`testoutput_run $dir tr_run.$ex "output.${ex}.txt"` |
&& results=`testoutput_run $dir tr_run.$ex $refExOut` |
1213 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1214 |
fres="$fres.$ex" |
fres="$fres.$ex" |
1215 |
echo |
echo |
1220 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1221 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1222 |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
1223 |
|
if test "x$ADM" = xt ; then |
1224 |
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
1225 |
|
grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \ |
1226 |
|
>> $CDIR"/summary.txt" |
1227 |
|
fi |
1228 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$POSTCLEAN" = xt ; then |
1229 |
run_clean $dir/tr_run.$ex |
run_clean $dir/tr_run.$ex |
1230 |
fi |
fi |
1231 |
done |
done |
|
# <-- same processing for adjoint & forward test |
|
|
if test "x$ADM" = xt ; then |
|
|
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
|
|
>> $CDIR"/summary.txt" |
|
|
fi |
|
1232 |
|
|
1233 |
#postclean $dir/$builddir |
#postclean $dir/$builddir |
1234 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$POSTCLEAN" = xt ; then |