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)" |
74 |
echo |
echo |
75 |
HAVE_MPACK=f |
HAVE_MPACK=f |
76 |
fi |
fi |
|
printf "building mpack... " |
|
77 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
78 |
export CC=cc |
export CC=cc |
79 |
fi |
fi |
80 |
|
printf "building mpack (using CC=$CC)... " |
81 |
( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1 |
( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1 |
82 |
RETVAL=$? |
RETVAL=$? |
83 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
88 |
else |
else |
89 |
rm -f tr_build_mpack.out |
rm -f tr_build_mpack.out |
90 |
HAVE_MPACK=t |
HAVE_MPACK=t |
91 |
|
echo "OK" |
92 |
fi |
fi |
93 |
else |
else |
94 |
HAVE_MPACK=t |
HAVE_MPACK=t |
95 |
|
echo "done" |
96 |
fi |
fi |
|
echo "OK" |
|
97 |
} |
} |
98 |
|
|
99 |
testoutput_var() |
testoutput_var() |
176 |
return $digits_of_similarity |
return $digits_of_similarity |
177 |
} |
} |
178 |
|
|
|
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 |
|
|
} |
|
|
|
|
179 |
check_for_add_mon_output() |
check_for_add_mon_output() |
180 |
{ |
{ |
181 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
329 |
if test "x$IEEE" != x ; then |
if test "x$IEEE" != x ; then |
330 |
command="$command -ieee" |
command="$command -ieee" |
331 |
fi |
fi |
332 |
|
if test "x$GSL" = xt ; then |
333 |
|
command="$command -gsl" |
334 |
|
fi |
335 |
if test "x$MPI" = xt ; then |
if test "x$MPI" = xt ; then |
336 |
command="$command -mpi" |
command="$command -mpi" |
337 |
fi |
fi |
404 |
find . -type l -exec rm {} \; |
find . -type l -exec rm {} \; |
405 |
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
406 |
rm -rf mnc_test_* |
rm -rf mnc_test_* |
407 |
|
rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
408 |
echo successful 1>&2 |
echo successful 1>&2 |
409 |
exit 0 |
exit 0 |
410 |
) |
) |
475 |
CODE_DIR=$dir/$code_dir |
CODE_DIR=$dir/$code_dir |
476 |
|
|
477 |
# These are files that should replace their counter-part when using -mpi |
# These are files that should replace their counter-part when using -mpi |
478 |
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")` |
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)` |
479 |
|
|
480 |
# Is this an MPI run? |
# Is this an MPI run? |
481 |
if test "x$MPI" = xt ; then |
if test "x$MPI" = xt ; then |
533 |
if test -h eedata ; then rm -f eedata ; fi |
if test -h eedata ; then rm -f eedata ; fi |
534 |
fi |
fi |
535 |
fi |
fi |
536 |
|
prevDir='NONE' |
537 |
for ldir in $* ; do |
for ldir in $* ; do |
538 |
if test -d "../"$ldir ; then |
if test -d "../"$ldir -a $ldir != $prevDir ; then |
539 |
printf 'ldir='${ldir} 1>&2 |
printf 'ldir='${ldir} 1>&2 |
540 |
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
541 |
for i in $files ; do |
for i in $files ; do |
551 |
fi |
fi |
552 |
printf ' ; ' 1>&2 |
printf ' ; ' 1>&2 |
553 |
fi |
fi |
554 |
|
prevDir=$ldir |
555 |
done |
done |
556 |
) |
) |
557 |
fi |
fi |
626 |
{ |
{ |
627 |
# create codelet for comparing model output |
# create codelet for comparing model output |
628 |
|
|
629 |
printf "creating the comparison code... " |
printf "creating the comparison code (using CC=$CC)... " |
630 |
cat > tr_cmpnum.c <<EOF |
cat > tr_cmpnum.c <<EOF |
631 |
#include <stdio.h> |
#include <stdio.h> |
632 |
#include <math.h> |
#include <math.h> |
723 |
debug=0 |
debug=0 |
724 |
verbose=1 |
verbose=1 |
725 |
clean=0 |
clean=0 |
|
expts='' |
|
|
# ieee=1 |
|
726 |
|
|
727 |
IEEE=true |
IEEE=true |
728 |
if test "x$MITGCM_IEEE" != x ; then |
if test "x$MITGCM_IEEE" != x ; then |
729 |
IEEE=$MITGCM_IEEE |
IEEE=$MITGCM_IEEE |
730 |
fi |
fi |
731 |
|
GSL=f |
732 |
|
|
733 |
CLEANUP=f |
CLEANUP=f |
734 |
QUICK=f |
QUICK=f |
858 |
|
|
859 |
-ieee) IEEE=true ;; |
-ieee) IEEE=true ;; |
860 |
-noieee) IEEE= ;; |
-noieee) IEEE= ;; |
861 |
|
-gsl) GSL=t ;; |
862 |
|
|
863 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
864 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
895 |
#- setting for forward or ADM testing |
#- setting for forward or ADM testing |
896 |
if test "x$ADM" = xt ; then |
if test "x$ADM" = xt ; then |
897 |
code_dir=code_ad |
code_dir=code_ad |
898 |
input_dirs='input_ad input' |
inputdir=input_ad |
899 |
ref_outp="output_adm.txt" |
ref_outp="output_adm.txt" |
900 |
EXECUTABLE="mitgcmuv_ad" |
EXECUTABLE="mitgcmuv_ad" |
901 |
else |
else |
902 |
code_dir=code |
code_dir=code |
903 |
input_dirs='input' |
inputdir=input |
904 |
ref_outp="output.txt" |
ref_outp="output.txt" |
905 |
EXECUTABLE="mitgcmuv" |
EXECUTABLE="mitgcmuv" |
906 |
fi |
fi |
979 |
# create the FORTRAN comparison code |
# create the FORTRAN comparison code |
980 |
createcodelet |
createcodelet |
981 |
|
|
982 |
# build the mpack utility |
# build the mpack utility (if ADDRESSES = NONE, do it to test the build) |
983 |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
if test "x$ADDRESSES" = x ; then |
984 |
echo "skipping mpack build" |
echo "skipping mpack build" |
985 |
else |
else |
986 |
build_mpack |
build_mpack |
987 |
fi |
fi |
988 |
|
|
989 |
# Create a uniquely named directory to store results |
# Create a uniquely named directory to store results |
990 |
|
CMDLINE=$0 |
991 |
|
for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done |
992 |
MACH=`hostname` |
MACH=`hostname` |
993 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
994 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
1009 |
exit 1 |
exit 1 |
1010 |
fi |
fi |
1011 |
SUMMARY="$DRESULTS/summary.txt" |
SUMMARY="$DRESULTS/summary.txt" |
|
printf "Start time: " >> $SUMMARY |
|
1012 |
start_date=`date` |
start_date=`date` |
1013 |
echo $start_date > $SUMMARY |
echo $start_date > $SUMMARY |
1014 |
|
echo 'run:' $CMDLINE >> $SUMMARY |
1015 |
|
echo 'on :' $UNAMEA >> $SUMMARY |
1016 |
|
|
1017 |
of_path= |
of_path= |
1018 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
1137 |
|
|
1138 |
# Check whether there are "extra runs" for this testdir |
# Check whether there are "extra runs" for this testdir |
1139 |
extra_runs= |
extra_runs= |
1140 |
if test "x$ADM" = x ; then |
ex_run_dirs=`( cd $dir ; echo $inputdir.* )` |
1141 |
ex_run_dirs=`( cd $dir ; echo input.* )` |
#echo "ex_run_dirs='$ex_run_dirs'" |
1142 |
#echo "ex_run_dirs='$ex_run_dirs'" |
for exd in $ex_run_dirs ; do |
1143 |
for exd in $ex_run_dirs ; do |
name=`echo $exd | sed -e "s/$inputdir\.//"` |
1144 |
name=`echo $exd | sed -e 's/input.//g'` |
refExOut=`echo $ref_outp | sed "s/\./.${name}./"` |
1145 |
outf="$dir/results/output.$name.txt" |
outf="$dir/results/$refExOut" |
1146 |
if test -f $outf -a -r $outf ; then |
if test -f $outf -a -r $outf ; then |
1147 |
if test "x$MULTI_THREAD" = "xt" ; then |
if test "x$MULTI_THREAD" = "xt" ; then |
1148 |
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 |
|
1149 |
extra_runs="$extra_runs $name" |
extra_runs="$extra_runs $name" |
1150 |
|
#else echo $dir"/"$exd"/eedata.mth: not found" |
1151 |
fi |
fi |
1152 |
|
else |
1153 |
|
extra_runs="$extra_runs $name" |
1154 |
fi |
fi |
1155 |
done |
fi |
1156 |
fi |
done |
1157 |
|
|
1158 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1159 |
echo |
echo |
1182 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
&& symlink_mpifiles $dir $code_dir $builddir \ |
1183 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1184 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1185 |
&& linkdata $dir/$rundir $input_dirs \ |
&& linkdata $dir/$rundir $inputdir input \ |
1186 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1187 |
&& results=`testoutput_run $dir $rundir $ref_outp` |
&& results=`testoutput_run $dir $rundir $ref_outp` |
1188 |
fi |
fi |
1189 |
|
|
1190 |
echo |
echo |
|
# --> same processing for adjoint & forward test |
|
1191 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1192 |
echo |
echo |
1193 |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
1197 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1198 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1199 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1200 |
|
if test "x$ADM" = xt ; then |
1201 |
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
1202 |
|
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
1203 |
|
>> $CDIR"/summary.txt" |
1204 |
|
fi |
1205 |
|
|
1206 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1207 |
unset run |
unset run |
1214 |
CDIR=`pwd`"/$rel_CDIR" |
CDIR=`pwd`"/$rel_CDIR" |
1215 |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
1216 |
run_clean $dir/tr_run.$ex |
run_clean $dir/tr_run.$ex |
1217 |
linkdata $dir/tr_run.$ex input.$ex input |
linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir input |
1218 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1219 |
&& results=`testoutput_run $dir tr_run.$ex $refExOut` |
&& results=`testoutput_run $dir tr_run.$ex $refExOut` |
1220 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1227 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1228 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1229 |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
1230 |
|
if test "x$ADM" = xt ; then |
1231 |
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
1232 |
|
grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \ |
1233 |
|
>> $CDIR"/summary.txt" |
1234 |
|
fi |
1235 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$POSTCLEAN" = xt ; then |
1236 |
run_clean $dir/tr_run.$ex |
run_clean $dir/tr_run.$ex |
1237 |
fi |
fi |
1238 |
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 |
|
1239 |
|
|
1240 |
#postclean $dir/$builddir |
#postclean $dir/$builddir |
1241 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$POSTCLEAN" = xt ; then |