19 |
echo " (-mpi) use MPI to compile and run on 2 processors" |
echo " (-mpi) use MPI to compile and run on 2 processors" |
20 |
echo " (-MPI) NUMBER use MPI to compile and run on max NUMBER procs" |
echo " (-MPI) NUMBER use MPI to compile and run on max NUMBER procs" |
21 |
echo " (-mfile|-mf) STRING MPI: file with list of possible machines to run on" |
echo " (-mfile|-mf) STRING MPI: file with list of possible machines to run on" |
22 |
echo " (-command|-c) STRING command to run (needed for MPI run)" |
echo " (-command|-c) STRING command to run (e.g., if non-standard MPI setting)" |
23 |
|
echo " DEF='mitgcmuv' or ='mpirun -np TR_NPROC mitgcmuv'" |
24 |
echo " ---- testing options : ----" |
echo " ---- testing options : ----" |
25 |
echo " (-optfile|-of) STRING list of optfiles to use" |
echo " (-optfile|-of) STRING optfile to use" |
26 |
echo " (-fast) use optfile default for compiler flags (no '-ieee')" |
echo " (-fast) use optfile default for compiler flags (no '-ieee')" |
27 |
echo " DEF=off => use IEEE numerics option (if available)" |
echo " DEF=off => use IEEE numerics option (if available)" |
28 |
echo " (-devel) use optfile developement flags (if available)" |
echo " (-devel) use optfile developement flags (if available)" |
42 |
echo " (-bash|-b) STRING preferred location of a \"bash\" or \"sh\" shell" |
echo " (-bash|-b) STRING preferred location of a \"bash\" or \"sh\" shell" |
43 |
echo " (DEF=\"\" for \"bash\")" |
echo " (DEF=\"\" for \"bash\")" |
44 |
echo " (-ef) STRING used as genmake2 \"-extra_flag\" argument" |
echo " (-ef) STRING used as genmake2 \"-extra_flag\" argument" |
45 |
|
echo " (-ncad) use genmake2 option \"-nocat4ad\" (-ncad)" |
46 |
|
echo " (-small_f) make target small_f before making target all" |
47 |
echo " (-makedepend|-md) STRING command to use for \"makedepend\"" |
echo " (-makedepend|-md) STRING command to use for \"makedepend\"" |
48 |
echo " (-make|-m) STRING command to use for \"make\"" |
echo " (-make|-m) STRING command to use for \"make\"" |
49 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
132 |
echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
133 |
fi |
fi |
134 |
if [ -r $1/$4/$OUTPUTFILE ]; then |
if [ -r $1/$4/$OUTPUTFILE ]; then |
135 |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > ${TMP}a.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | nl > ${TMP}a.txt |
136 |
lncntA=`wc -l ${TMP}a.txt | awk '{print $1}' ` |
lncntA=`wc -l ${TMP}a.txt | awk '{print $1}' ` |
137 |
if [ $lncntA -lt 2 ]; then |
if [ $lncntA -lt 2 ]; then |
138 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
147 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
148 |
echo testoutput_var: grep "$2" $1/$5 1>&2 |
echo testoutput_var: grep "$2" $1/$5 1>&2 |
149 |
fi |
fi |
150 |
grep "$2" $1/$5 | sed 's/.*=//' | cat -n > ${TMP}b.txt |
grep "$2" $1/$5 | sed 's/.*=//' | nl > ${TMP}b.txt |
151 |
lncntB=`wc -l ${TMP}b.txt | awk '{print $1}' ` |
lncntB=`wc -l ${TMP}b.txt | awk '{print $1}' ` |
152 |
if [ $lncntB -lt 2 ]; then |
if [ $lncntB -lt 2 ]; then |
153 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
333 |
'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North-av" $2 $refoutp ; yy=$? ;; |
'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North-av" $2 $refoutp ; yy=$? ;; |
334 |
'HthMxS') testoutput_var $1 "thSI_IceH_max_S" "thSIc H South-max" $2 $refoutp ; yy=$? ;; |
'HthMxS') testoutput_var $1 "thSI_IceH_max_S" "thSIc H South-max" $2 $refoutp ; yy=$? ;; |
335 |
'HthMxN') testoutput_var $1 "thSI_IceH_max_N" "thSIc H North-max" $2 $refoutp ; yy=$? ;; |
'HthMxN') testoutput_var $1 "thSI_IceH_max_N" "thSIc H North-max" $2 $refoutp ; yy=$? ;; |
336 |
|
'sbo_M') testoutput_var $1 "sbo_mass" "SBO mass" $2 $refoutp ; yy=$? ;; |
337 |
|
'sboFW') testoutput_var $1 "sbo_mass_fw" "SBO m-FW" $2 $refoutp ; yy=$? ;; |
338 |
|
'sboAc') testoutput_var $1 "sbo_zoamc" "SBO AM-C" $2 $refoutp ; yy=$? ;; |
339 |
|
'sboAp') testoutput_var $1 "sbo_zoamp" "SBO AM-P" $2 $refoutp ; yy=$? ;; |
340 |
'StrmIc') testoutput_var $1 "STREAMICE_FP_ERR" "StreamIce Solver" $2 $refoutp ; yy=$? ;; |
'StrmIc') testoutput_var $1 "STREAMICE_FP_ERR" "StreamIce Solver" $2 $refoutp ; yy=$? ;; |
341 |
*) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;; |
*) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;; |
342 |
esac |
esac |
374 |
if test "x$MKDEPEND" != x ; then |
if test "x$MKDEPEND" != x ; then |
375 |
command="$command -makedepend=$MKDEPEND" |
command="$command -makedepend=$MKDEPEND" |
376 |
fi |
fi |
377 |
if test $KIND = 1 -o $KIND = 2 ; then |
if test $KIND = 4 ; then |
378 |
command="$command --mods=../code_ad" |
command="$command -oad -mods=../$code_dir" |
|
elif test $KIND = 4 ; then |
|
|
command="$command -adof ../../../tools/adjoint_options/adjoint_oad -mods ../code_oad" |
|
379 |
else |
else |
380 |
command="$command -mods=../code" |
command="$command -mods=../$code_dir" |
381 |
fi |
fi |
382 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
383 |
command="$command -optfile=$OPTFILE" |
command="$command -optfile=$OPTFILE" |
404 |
if test "x$EXTRFLG" != x ; then |
if test "x$EXTRFLG" != x ; then |
405 |
command="$command -extra_flag $EXTRFLG" |
command="$command -extra_flag $EXTRFLG" |
406 |
fi |
fi |
407 |
|
if test "x$NOCATAD" = xt ; then |
408 |
|
command="$command -nocat4ad" |
409 |
|
fi |
410 |
if test "x$TS" = xt ; then |
if test "x$TS" = xt ; then |
411 |
command="$command -ts" |
command="$command -ts" |
412 |
fi |
fi |
528 |
else |
else |
529 |
cd $1; |
cd $1; |
530 |
if test -r Makefile ; then |
if test -r Makefile ; then |
531 |
printf 'make ... ' |
if test "x$MKSMALLF" = xt ; then |
532 |
if test "x$REPLMAKE" = x ; then |
printf 'make small_f ... ' |
533 |
$MAKE $TARG >> make.tr_log 2>&1 |
$MAKE_CMD small_f >> make.tr_log 2>&1 |
534 |
else |
RETVAL=$? |
535 |
$REPLMAKE $TARG >> make.tr_log 2>&1 |
if test "x$RETVAL" != x0 ; then |
536 |
|
tail make.tr_log |
537 |
|
echo failed |
538 |
|
cp genmake.log genmake.tr_log $CDIR |
539 |
|
tail -$NBLINES_MKLOG make.tr_log > $CDIR"/make.tr_log_tail" |
540 |
|
rm -f $EXECUTABLE |
541 |
|
mk_fail=1 |
542 |
|
else |
543 |
|
echo successful |
544 |
|
fi |
545 |
fi |
fi |
546 |
|
printf 'make ... ' |
547 |
|
$MAKE_CMD $TARG >> make.tr_log 2>&1 |
548 |
RETVAL=$? |
RETVAL=$? |
549 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
550 |
tail make.tr_log |
tail make.tr_log |
792 |
if test "x$MPI" != x0 ; then |
if test "x$MPI" != x0 ; then |
793 |
#- adjust the MPI run command with the right number of Procs |
#- adjust the MPI run command with the right number of Procs |
794 |
#echo '' ; echo " COMMAND='$COMMAND'" |
#echo '' ; echo " COMMAND='$COMMAND'" |
795 |
COMMAND=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"` |
COMMAND=`echo $COMMAND | sed "s/ TR_NPROC/ $LOC_NPROC/"` |
796 |
if test "x$MPI_MFILE" != x ; then |
if test "x$MPI_MFILE" != x ; then |
797 |
COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"` |
COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"` |
798 |
fi |
fi |
858 |
if test -f $OUTPUTFILE ; then |
if test -f $OUTPUTFILE ; then |
859 |
grep '(PID\.TID 0000\.0001) n.. =' $OUTPUTFILE \ |
grep '(PID\.TID 0000\.0001) n.. =' $OUTPUTFILE \ |
860 |
| sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
| sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
861 |
grep -A3 'Seconds in section "ALL' $OUTPUTFILE \ |
# grep -A3 'Seconds in section "ALL' $OUTPUTFILE \ |
862 |
| sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
# | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
863 |
|
# some implementations of grep cannot do contextual searches so we |
864 |
|
# replace the above with a sed command |
865 |
|
cat $OUTPUTFILE | sed -n '/Seconds in section "ALL/{N |
866 |
|
N |
867 |
|
N |
868 |
|
p |
869 |
|
}' | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
870 |
fi |
fi |
871 |
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 |
872 |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
1067 |
if test "x$MAKE" = x ; then |
if test "x$MAKE" = x ; then |
1068 |
MAKE=make |
MAKE=make |
1069 |
fi |
fi |
1070 |
REPLMAKE= |
MAKE_CMD= |
1071 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
1072 |
CC=cc |
CC=cc |
1073 |
fi |
fi |
1080 |
DELDIR= |
DELDIR= |
1081 |
USE_R4= |
USE_R4= |
1082 |
EXTRFLG= |
EXTRFLG= |
1083 |
|
NOCATAD= |
1084 |
|
MKSMALLF= |
1085 |
|
|
1086 |
#- type of testing (KIND): |
#- type of testing (KIND): |
1087 |
# KIND=0 : forward (= default) ; KIND=1 : Tangent Linear with TAF ; |
# KIND=0 : forward (= default) ; KIND=1 : Tangent Linear with TAF ; |
1141 |
-make | --make | -m | --m) ac_prev=MAKE ;; |
-make | --make | -m | --m) ac_prev=MAKE ;; |
1142 |
-make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;; |
-make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;; |
1143 |
|
|
1144 |
-repl_mk | --repl_mk ) ac_prev=REPLMAKE ;; |
-repl_mk | --repl_mk ) ac_prev=MAKE_CMD ;; |
1145 |
-repl_mk=* | --repl_mk=*) REPLMAKE=$ac_optarg ;; |
-repl_mk=* | --repl_mk=*) MAKE_CMD=$ac_optarg ;; |
1146 |
|
|
1147 |
-odir | --odir) ac_prev=OUTDIR ;; |
-odir | --odir) ac_prev=OUTDIR ;; |
1148 |
-odir=* | --odir=*) OUTDIR=$ac_optarg ;; |
-odir=* | --odir=*) OUTDIR=$ac_optarg ;; |
1190 |
-oad) if test $KIND = 0 ; then KIND=4 ; NODEPEND=t ; else |
-oad) if test $KIND = 0 ; then KIND=4 ; NODEPEND=t ; else |
1191 |
echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage |
echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage |
1192 |
fi ;; |
fi ;; |
1193 |
|
-ncad) NOCATAD=t ;; |
1194 |
|
-small_f) MKSMALLF=t ;; |
1195 |
|
|
1196 |
-ieee) echo "Warning: ignore option '-ieee' (already the default)" |
-ieee) echo "Warning: ignore option '-ieee' (already the default)" |
1197 |
printf " ... " ;; |
printf " ... " ;; |
1211 |
|
|
1212 |
-ts) TS=t;; |
-ts) TS=t;; |
1213 |
-papis) PAPIS=t;; |
-papis) PAPIS=t;; |
1214 |
-pcls) PCL=t;; |
-pcls) PCLS=t;; |
1215 |
|
|
1216 |
-*) echo "Error: unrecognized option: "$ac_option |
-*) echo "Error: unrecognized option: "$ac_option |
1217 |
usage ;; |
usage ;; |
1227 |
NOCLEAN=t |
NOCLEAN=t |
1228 |
NODEPEND=t |
NODEPEND=t |
1229 |
fi |
fi |
1230 |
|
if test "x$MAKE_CMD" = x ; then MAKE_CMD=$MAKE ; fi |
1231 |
|
|
1232 |
#- check length of MPI machine file: |
#- check length of MPI machine file: |
1233 |
if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then |
if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then |
1266 |
ref_outp="output_oadm.txt" |
ref_outp="output_oadm.txt" |
1267 |
EXECUTABLE="mitgcmuv_ad" |
EXECUTABLE="mitgcmuv_ad" |
1268 |
else |
else |
|
if test "x$JOBS" != x ; then TARG="-j $JOBS $TARG" ; fi |
|
1269 |
code_dir=code |
code_dir=code |
1270 |
inputdir=input |
inputdir=input |
1271 |
ref_outp="output.txt" |
ref_outp="output.txt" |
1272 |
EXECUTABLE="mitgcmuv" |
EXECUTABLE="mitgcmuv" |
1273 |
fi |
fi |
1274 |
|
if test "x$JOBS" != x ; then TARG="-j $JOBS $TARG" ; fi |
1275 |
|
|
1276 |
xx=`echo $TESTDIRS | awk '{print $1}'` |
xx=`echo $TESTDIRS | awk '{print $1}'` |
1277 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
1318 |
if test $count = 1 ; then echo "" ; echo -n " ... " ; fi |
if test $count = 1 ; then echo "" ; echo -n " ... " ; fi |
1319 |
#echo 'TESTDIRS='${TESTDIRS}'<' |
#echo 'TESTDIRS='${TESTDIRS}'<' |
1320 |
|
|
|
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
|
|
OPTFILE=$MITGCM_OF |
|
|
fi |
|
|
|
|
1321 |
LOC_MFILE='tr_mpi_mfile' |
LOC_MFILE='tr_mpi_mfile' |
1322 |
RUNLOG="run.tr_log" |
RUNLOG="run.tr_log" |
1323 |
OUTPUTFILE=$ref_outp |
if test "x$MPI" = x0 ; then |
1324 |
if test "x$COMMAND" = x ; then |
OUTPUTFILE=$ref_outp |
1325 |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
if test "x$COMMAND" = x ; then COMMAND="./$EXECUTABLE > $OUTPUTFILE" ; fi |
1326 |
fi |
else |
1327 |
if test "x$MPI" != x0 ; then |
OUTPUTFILE="STDOUT.0000" |
1328 |
OUTPUTFILE="STDOUT.0000" |
if test "x$COMMAND" = x ; then COMMAND="mpirun -np TR_NPROC ./$EXECUTABLE" ; fi |
1329 |
fi |
fi |
1330 |
|
|
1331 |
echo "OK (COMMAND= $COMMAND )" |
echo "OK (COMMAND='$COMMAND')" |
1332 |
|
|
1333 |
TMP=./tr_$$ |
#TMP=./tr_$$ |
1334 |
#- try to put temporary files in system-local /tmp dir |
#- try to put temporary files in system-local /tmp dir |
1335 |
#TMP=/tmp/tr_$$ |
TMP=/tmp/tr_${USER}_$$ |
1336 |
#touch $TMP ; retVal=$? |
touch $TMP ; retVal=$? |
1337 |
#if [ $retVal -eq 0 ] ; then |
if [ $retVal -eq 0 ] ; then |
1338 |
# if test ! -r $TMP ; then TMP=./tr_$$ ; fi |
if test ! -r $TMP ; then TMP=./tr_$$ ; fi |
1339 |
#else |
else |
1340 |
# TMP=./tr_$$ |
TMP=./tr_$$ |
1341 |
#fi |
fi |
1342 |
#rm -f $TMP |
rm -f $TMP |
1343 |
#if [ $verbose -gt 1 ]; then echo " temp files: $TMP" ; fi |
if [ $verbose -gt 1 ]; then echo " temp files: $TMP" ; fi |
1344 |
|
|
1345 |
# set the Default List of output variables to be checked: |
# set the Default List of output variables to be checked: |
1346 |
# (use default or load experiment-specific list from file "tr_checklist") |
# (use default or load experiment-specific list from file "tr_checklist") |
1387 |
CMDLINE="$CMDLINE $yy" ; fi |
CMDLINE="$CMDLINE $yy" ; fi |
1388 |
fi |
fi |
1389 |
done |
done |
|
#for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done |
|
1390 |
MACH=`hostname` |
MACH=`hostname` |
1391 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
1392 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
1394 |
if test "x$OUTDIR" != x ; then |
if test "x$OUTDIR" != x ; then |
1395 |
BASE="tr_"$OUTDIR"_"$DATE"_" |
BASE="tr_"$OUTDIR"_"$DATE"_" |
1396 |
else |
else |
1397 |
short_name=`hostname | sed 's/\..*$//'` |
#short_name=`hostname -s | tr '[:upper:]' '[:lower:]'` |
1398 |
|
# hostname -s is not universal (does work on AIX system) |
1399 |
|
short_name=`hostname | sed 's/\..*$//' | tr '[:upper:]' '[:lower:]'` |
1400 |
BASE="tr_"$short_name"_"$DATE"_" |
BASE="tr_"$short_name"_"$DATE"_" |
1401 |
fi |
fi |
1402 |
DNUM=0 |
DNUM=0 |
1702 |
if test -f $dir/$builddir/Makefile ; then |
if test -f $dir/$builddir/Makefile ; then |
1703 |
mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'` |
mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'` |
1704 |
echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state |
echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state |
1705 |
sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state |
# sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state |
1706 |
|
# bsd-sed cannot do the above code |
1707 |
|
cat $dir/$builddir/Makefile | \ |
1708 |
|
sed -n '/^# executed by:/{N |
1709 |
|
p |
1710 |
|
}' >> $DRESULTS/genmake_state |
1711 |
echo " $mkOpt" >> $DRESULTS/genmake_state |
echo " $mkOpt" >> $DRESULTS/genmake_state |
1712 |
if test "x$OPTFILE" = xNONE ; then |
if test "x$OPTFILE" = xNONE ; then |
1713 |
eval $mkOpt |
eval $mkOpt |
1714 |
sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
# sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
1715 |
$SUMMARY > tmp.tr_log |
# $SUMMARY > tmp.tr_log |
1716 |
|
# bsd-sed requires a newline after "a\": |
1717 |
|
sed "/^No \"OPTFILE\" was specified ; genmake2/a\\ |
1718 |
|
OPTFILE=${OPTFILE}" $SUMMARY > tmp.tr_log |
1719 |
RETVAL=$? |
RETVAL=$? |
1720 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1721 |
cp -f tmp.tr_log $SUMMARY |
cp -f tmp.tr_log $SUMMARY |
1736 |
>> $DRESULTS/genmake_state |
>> $DRESULTS/genmake_state |
1737 |
rm -f tmp.tr_log |
rm -f tmp.tr_log |
1738 |
fi |
fi |
1739 |
echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state |
fi |
1740 |
echo "get NETCDF & LAPACK settings:" >> $DRESULTS/genmake_state |
gmkLog=$dir/$builddir/genmake_state |
1741 |
sed -n '/set HAVE_NETCDF=/p' $gmkLog >> $DRESULTS/genmake_state |
if test -r $gmkLog ; then |
1742 |
sed -n '/set HAVE_LAPACK=/p' $gmkLog >> $DRESULTS/genmake_state |
echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state |
1743 |
|
echo "get genmake settings:" >> $DRESULTS/genmake_state |
1744 |
|
sed -n '/^HAVE_/p' $gmkLog | sed 's/^./ &/' \ |
1745 |
|
>> $DRESULTS/genmake_state |
1746 |
fi |
fi |
1747 |
fi |
fi |
1748 |
fi |
fi |