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 list of optfiles to use" |
26 |
echo " (-fast) use optfile default for compiler flags (no '-ieee')" |
echo " (-fast) use optfile default for compiler flags (no '-ieee')" |
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) used genmake2 option \"-nocat4ad\" (-ncad)" |
46 |
echo " (-makedepend|-md) STRING command to use for \"makedepend\"" |
echo " (-makedepend|-md) STRING command to use for \"makedepend\"" |
47 |
echo " (-make|-m) STRING command to use for \"make\"" |
echo " (-make|-m) STRING command to use for \"make\"" |
48 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
131 |
echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
132 |
fi |
fi |
133 |
if [ -r $1/$4/$OUTPUTFILE ]; then |
if [ -r $1/$4/$OUTPUTFILE ]; then |
134 |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > ${TMP}a.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | nl > ${TMP}a.txt |
135 |
lncntA=`wc -l ${TMP}a.txt | awk '{print $1}' ` |
lncntA=`wc -l ${TMP}a.txt | awk '{print $1}' ` |
136 |
if [ $lncntA -lt 2 ]; then |
if [ $lncntA -lt 2 ]; then |
137 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
146 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
147 |
echo testoutput_var: grep "$2" $1/$5 1>&2 |
echo testoutput_var: grep "$2" $1/$5 1>&2 |
148 |
fi |
fi |
149 |
grep "$2" $1/$5 | sed 's/.*=//' | cat -n > ${TMP}b.txt |
grep "$2" $1/$5 | sed 's/.*=//' | nl > ${TMP}b.txt |
150 |
lncntB=`wc -l ${TMP}b.txt | awk '{print $1}' ` |
lncntB=`wc -l ${TMP}b.txt | awk '{print $1}' ` |
151 |
if [ $lncntB -lt 2 ]; then |
if [ $lncntB -lt 2 ]; then |
152 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
332 |
'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=$? ;; |
333 |
'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=$? ;; |
334 |
'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=$? ;; |
335 |
|
'sbo_M') testoutput_var $1 "sbo_mass" "SBO mass" $2 $refoutp ; yy=$? ;; |
336 |
|
'sboFW') testoutput_var $1 "sbo_mass_fw" "SBO m-FW" $2 $refoutp ; yy=$? ;; |
337 |
|
'sboAc') testoutput_var $1 "sbo_zoamc" "SBO AM-C" $2 $refoutp ; yy=$? ;; |
338 |
|
'sboAp') testoutput_var $1 "sbo_zoamp" "SBO AM-P" $2 $refoutp ; yy=$? ;; |
339 |
'StrmIc') testoutput_var $1 "STREAMICE_FP_ERR" "StreamIce Solver" $2 $refoutp ; yy=$? ;; |
'StrmIc') testoutput_var $1 "STREAMICE_FP_ERR" "StreamIce Solver" $2 $refoutp ; yy=$? ;; |
340 |
*) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;; |
*) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;; |
341 |
esac |
esac |
373 |
if test "x$MKDEPEND" != x ; then |
if test "x$MKDEPEND" != x ; then |
374 |
command="$command -makedepend=$MKDEPEND" |
command="$command -makedepend=$MKDEPEND" |
375 |
fi |
fi |
376 |
if test $KIND = 1 -o $KIND = 2 ; then |
if test $KIND = 4 ; then |
377 |
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" |
|
378 |
else |
else |
379 |
command="$command -mods=../code" |
command="$command -mods=../$code_dir" |
380 |
fi |
fi |
381 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
382 |
command="$command -optfile=$OPTFILE" |
command="$command -optfile=$OPTFILE" |
403 |
if test "x$EXTRFLG" != x ; then |
if test "x$EXTRFLG" != x ; then |
404 |
command="$command -extra_flag $EXTRFLG" |
command="$command -extra_flag $EXTRFLG" |
405 |
fi |
fi |
406 |
|
if test "x$NOCATAD" = xt ; then |
407 |
|
command="$command -nocat4ad" |
408 |
|
fi |
409 |
if test "x$TS" = xt ; then |
if test "x$TS" = xt ; then |
410 |
command="$command -ts" |
command="$command -ts" |
411 |
fi |
fi |
436 |
makeclean() |
makeclean() |
437 |
{ |
{ |
438 |
# makeclean directory |
# makeclean directory |
439 |
if test "x$NODEPEND" = xf ; then rm -f $1/make.tr_log ; fi |
if test "x$NOGENMAKE" = xf ; then rm -f $1/make.tr_log ; fi |
440 |
if test "x$NOCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
441 |
echo "make Clean skipped!" |
echo "make Clean skipped!" |
442 |
else |
else |
528 |
cd $1; |
cd $1; |
529 |
if test -r Makefile ; then |
if test -r Makefile ; then |
530 |
printf 'make ... ' |
printf 'make ... ' |
531 |
if test "x$REPLMAKE" = x ; then |
$MAKE_CMD $TARG >> make.tr_log 2>&1 |
|
$MAKE $TARG >> make.tr_log 2>&1 |
|
|
else |
|
|
$REPLMAKE $TARG >> make.tr_log 2>&1 |
|
|
fi |
|
532 |
RETVAL=$? |
RETVAL=$? |
533 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
534 |
tail make.tr_log |
tail make.tr_log |
776 |
if test "x$MPI" != x0 ; then |
if test "x$MPI" != x0 ; then |
777 |
#- adjust the MPI run command with the right number of Procs |
#- adjust the MPI run command with the right number of Procs |
778 |
#echo '' ; echo " COMMAND='$COMMAND'" |
#echo '' ; echo " COMMAND='$COMMAND'" |
779 |
COMMAND=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"` |
COMMAND=`echo $COMMAND | sed "s/ TR_NPROC/ $LOC_NPROC/"` |
780 |
if test "x$MPI_MFILE" != x ; then |
if test "x$MPI_MFILE" != x ; then |
781 |
COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"` |
COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"` |
782 |
fi |
fi |
842 |
if test -f $OUTPUTFILE ; then |
if test -f $OUTPUTFILE ; then |
843 |
grep '(PID\.TID 0000\.0001) n.. =' $OUTPUTFILE \ |
grep '(PID\.TID 0000\.0001) n.. =' $OUTPUTFILE \ |
844 |
| sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
| sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
845 |
grep -A3 'Seconds in section "ALL' $OUTPUTFILE \ |
# grep -A3 'Seconds in section "ALL' $OUTPUTFILE \ |
846 |
| sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
# | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
847 |
|
# some implementations of grep cannot do contextual searches so we |
848 |
|
# replace the above with a sed command |
849 |
|
cat $OUTPUTFILE | sed -n '/Seconds in section "ALL/{N |
850 |
|
N |
851 |
|
N |
852 |
|
p |
853 |
|
}' | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
854 |
fi |
fi |
855 |
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 |
856 |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
1051 |
if test "x$MAKE" = x ; then |
if test "x$MAKE" = x ; then |
1052 |
MAKE=make |
MAKE=make |
1053 |
fi |
fi |
1054 |
REPLMAKE= |
MAKE_CMD= |
1055 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
1056 |
CC=cc |
CC=cc |
1057 |
fi |
fi |
1064 |
DELDIR= |
DELDIR= |
1065 |
USE_R4= |
USE_R4= |
1066 |
EXTRFLG= |
EXTRFLG= |
1067 |
|
NOCATAD= |
1068 |
|
|
1069 |
#- type of testing (KIND): |
#- type of testing (KIND): |
1070 |
# KIND=0 : forward (= default) ; KIND=1 : Tangent Linear with TAF ; |
# KIND=0 : forward (= default) ; KIND=1 : Tangent Linear with TAF ; |
1124 |
-make | --make | -m | --m) ac_prev=MAKE ;; |
-make | --make | -m | --m) ac_prev=MAKE ;; |
1125 |
-make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;; |
-make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;; |
1126 |
|
|
1127 |
-repl_mk | --repl_mk ) ac_prev=REPLMAKE ;; |
-repl_mk | --repl_mk ) ac_prev=MAKE_CMD ;; |
1128 |
-repl_mk=* | --repl_mk=*) REPLMAKE=$ac_optarg ;; |
-repl_mk=* | --repl_mk=*) MAKE_CMD=$ac_optarg ;; |
1129 |
|
|
1130 |
-odir | --odir) ac_prev=OUTDIR ;; |
-odir | --odir) ac_prev=OUTDIR ;; |
1131 |
-odir=* | --odir=*) OUTDIR=$ac_optarg ;; |
-odir=* | --odir=*) OUTDIR=$ac_optarg ;; |
1173 |
-oad) if test $KIND = 0 ; then KIND=4 ; NODEPEND=t ; else |
-oad) if test $KIND = 0 ; then KIND=4 ; NODEPEND=t ; else |
1174 |
echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage |
echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage |
1175 |
fi ;; |
fi ;; |
1176 |
|
-ncad) NOCATAD=t ;; |
1177 |
|
|
1178 |
-ieee) echo "Warning: ignore option '-ieee' (already the default)" |
-ieee) echo "Warning: ignore option '-ieee' (already the default)" |
1179 |
printf " ... " ;; |
printf " ... " ;; |
1193 |
|
|
1194 |
-ts) TS=t;; |
-ts) TS=t;; |
1195 |
-papis) PAPIS=t;; |
-papis) PAPIS=t;; |
1196 |
-pcls) PCL=t;; |
-pcls) PCLS=t;; |
1197 |
|
|
1198 |
-*) echo "Error: unrecognized option: "$ac_option |
-*) echo "Error: unrecognized option: "$ac_option |
1199 |
usage ;; |
usage ;; |
1209 |
NOCLEAN=t |
NOCLEAN=t |
1210 |
NODEPEND=t |
NODEPEND=t |
1211 |
fi |
fi |
1212 |
|
if test "x$MAKE_CMD" = x ; then MAKE_CMD=$MAKE ; fi |
1213 |
|
|
1214 |
#- check length of MPI machine file: |
#- check length of MPI machine file: |
1215 |
if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then |
if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then |
1248 |
ref_outp="output_oadm.txt" |
ref_outp="output_oadm.txt" |
1249 |
EXECUTABLE="mitgcmuv_ad" |
EXECUTABLE="mitgcmuv_ad" |
1250 |
else |
else |
|
if test "x$JOBS" != x ; then TARG="-j $JOBS $TARG" ; fi |
|
1251 |
code_dir=code |
code_dir=code |
1252 |
inputdir=input |
inputdir=input |
1253 |
ref_outp="output.txt" |
ref_outp="output.txt" |
1254 |
EXECUTABLE="mitgcmuv" |
EXECUTABLE="mitgcmuv" |
1255 |
fi |
fi |
1256 |
|
if test "x$JOBS" != x ; then TARG="-j $JOBS $TARG" ; fi |
1257 |
|
|
1258 |
xx=`echo $TESTDIRS | awk '{print $1}'` |
xx=`echo $TESTDIRS | awk '{print $1}'` |
1259 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
1306 |
|
|
1307 |
LOC_MFILE='tr_mpi_mfile' |
LOC_MFILE='tr_mpi_mfile' |
1308 |
RUNLOG="run.tr_log" |
RUNLOG="run.tr_log" |
1309 |
OUTPUTFILE=$ref_outp |
if test "x$MPI" = x0 ; then |
1310 |
if test "x$COMMAND" = x ; then |
OUTPUTFILE=$ref_outp |
1311 |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
if test "x$COMMAND" = x ; then COMMAND="./$EXECUTABLE > $OUTPUTFILE" ; fi |
1312 |
fi |
else |
1313 |
if test "x$MPI" != x0 ; then |
OUTPUTFILE="STDOUT.0000" |
1314 |
OUTPUTFILE="STDOUT.0000" |
if test "x$COMMAND" = x ; then COMMAND="mpirun -v -np TR_NPROC ./$EXECUTABLE" ; fi |
1315 |
fi |
fi |
1316 |
|
|
1317 |
echo "OK (COMMAND= $COMMAND )" |
echo "OK (COMMAND='$COMMAND')" |
1318 |
|
|
1319 |
TMP=./tr_$$ |
#TMP=./tr_$$ |
1320 |
#- try to put temporary files in system-local /tmp dir |
#- try to put temporary files in system-local /tmp dir |
1321 |
#TMP=/tmp/tr_$$ |
TMP=/tmp/tr_${USER}_$$ |
1322 |
#touch $TMP ; retVal=$? |
touch $TMP ; retVal=$? |
1323 |
#if [ $retVal -eq 0 ] ; then |
if [ $retVal -eq 0 ] ; then |
1324 |
# if test ! -r $TMP ; then TMP=./tr_$$ ; fi |
if test ! -r $TMP ; then TMP=./tr_$$ ; fi |
1325 |
#else |
else |
1326 |
# TMP=./tr_$$ |
TMP=./tr_$$ |
1327 |
#fi |
fi |
1328 |
#rm -f $TMP |
rm -f $TMP |
1329 |
#if [ $verbose -gt 1 ]; then echo " temp files: $TMP" ; fi |
if [ $verbose -gt 1 ]; then echo " temp files: $TMP" ; fi |
1330 |
|
|
1331 |
# set the Default List of output variables to be checked: |
# set the Default List of output variables to be checked: |
1332 |
# (use default or load experiment-specific list from file "tr_checklist") |
# (use default or load experiment-specific list from file "tr_checklist") |
1373 |
CMDLINE="$CMDLINE $yy" ; fi |
CMDLINE="$CMDLINE $yy" ; fi |
1374 |
fi |
fi |
1375 |
done |
done |
|
#for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done |
|
1376 |
MACH=`hostname` |
MACH=`hostname` |
1377 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
1378 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
1380 |
if test "x$OUTDIR" != x ; then |
if test "x$OUTDIR" != x ; then |
1381 |
BASE="tr_"$OUTDIR"_"$DATE"_" |
BASE="tr_"$OUTDIR"_"$DATE"_" |
1382 |
else |
else |
1383 |
short_name=`hostname | sed 's/\..*$//'` |
#short_name=`hostname -s | tr '[:upper:]' '[:lower:]'` |
1384 |
|
# hostname -s is not universal (does work on AIX system) |
1385 |
|
short_name=`hostname | sed 's/\..*$//' | tr '[:upper:]' '[:lower:]'` |
1386 |
BASE="tr_"$short_name"_"$DATE"_" |
BASE="tr_"$short_name"_"$DATE"_" |
1387 |
fi |
fi |
1388 |
DNUM=0 |
DNUM=0 |
1688 |
if test -f $dir/$builddir/Makefile ; then |
if test -f $dir/$builddir/Makefile ; then |
1689 |
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/^# //'` |
1690 |
echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state |
echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state |
1691 |
sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state |
# sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state |
1692 |
|
# bsd-sed cannot do the above code |
1693 |
|
cat $dir/$builddir/Makefile | \ |
1694 |
|
sed -n '/^# executed by:/{N |
1695 |
|
p |
1696 |
|
}' >> $DRESULTS/genmake_state |
1697 |
echo " $mkOpt" >> $DRESULTS/genmake_state |
echo " $mkOpt" >> $DRESULTS/genmake_state |
1698 |
if test "x$OPTFILE" = xNONE ; then |
if test "x$OPTFILE" = xNONE ; then |
1699 |
eval $mkOpt |
eval $mkOpt |
1700 |
sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
# sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
1701 |
$SUMMARY > tmp.tr_log |
# $SUMMARY > tmp.tr_log |
1702 |
|
# bsd-sed requires a newline after "a\": |
1703 |
|
sed "/^No \"OPTFILE\" was specified ; genmake2/a\\ |
1704 |
|
OPTFILE=${OPTFILE}" $SUMMARY > tmp.tr_log |
1705 |
RETVAL=$? |
RETVAL=$? |
1706 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1707 |
cp -f tmp.tr_log $SUMMARY |
cp -f tmp.tr_log $SUMMARY |