11 |
echo |
echo |
12 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
13 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
14 |
|
echo " ---- type of test : ----" |
15 |
|
echo " (-tlm) perform a Tangent Linear run" |
16 |
|
echo " (-adm|-ad) perform an adjoint run" |
17 |
|
echo " (-oad) perform an OpenAD adjoint run" |
18 |
echo " (-mth) run multi-threaded (using eedata.mth)" |
echo " (-mth) run multi-threaded (using eedata.mth)" |
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)" |
23 |
|
echo " ---- testing options : ----" |
24 |
|
echo " (-optfile|-of) STRING list of optfiles to use" |
25 |
echo " (-fast) use optfile default for compiler flags (no '-ieee')" |
echo " (-fast) use optfile default for compiler flags (no '-ieee')" |
26 |
echo " DEF=off => use IEEE numerics option (if available)" |
echo " DEF=off => use IEEE numerics option (if available)" |
27 |
echo " (-devel) use optfile developement flags (if available)" |
echo " (-devel) use optfile developement flags (if available)" |
28 |
echo " (-gsl) compile with \"-gsl\" flag" |
echo " (-gsl) compile with \"-gsl\" flag" |
29 |
echo " (-use_r4|-ur4) if allowed, use real*4 type for '_RS' variable" |
echo " (-use_r4|-ur4) if allowed, use real*4 type for '_RS' variable" |
|
echo " (-optfile|-of) STRING list of optfiles to use" |
|
|
echo " (-addr|-a) STRING list of email recipients" |
|
|
echo " (DEF=\"\" no email is sent)" |
|
|
echo " (-mpackdir|-mpd) DIR location of the mpack utility" |
|
|
echo " (DEF=\"../tools/mpack-1.6\")" |
|
30 |
echo " (-tdir|-t) STRING list of group and/or exp. dirs to test" |
echo " (-tdir|-t) STRING list of group and/or exp. dirs to test" |
31 |
echo " (recognized groups: basic, tutorials)" |
echo " (recognized groups: basic, tutorials)" |
32 |
echo " (DEF=\"\" which test all)" |
echo " (DEF=\"\" which test all)" |
34 |
echo " test THIS_EXP + all the following)" |
echo " test THIS_EXP + all the following)" |
35 |
echo " (-skipdir|-skd) STRING list of exp. dirs to skip" |
echo " (-skipdir|-skd) STRING list of exp. dirs to skip" |
36 |
echo " (DEF=\"\" which test all)" |
echo " (DEF=\"\" which test all)" |
37 |
echo " (-bash|-b) STRING preferred location of a \"bash\" or" |
echo " (-ts) provide timing information per timestep" |
38 |
echo " Bourne-compatible \"sh\" shell" |
echo " (-papis) provide MFlop/s per timestep using PAPI" |
39 |
|
echo " (-pcls) provide MFlop/s per timestep using PCL" |
40 |
|
echo " ---- system options : ----" |
41 |
|
echo " (-bash|-b) STRING preferred location of a \"bash\" or \"sh\" shell" |
42 |
echo " (DEF=\"\" for \"bash\")" |
echo " (DEF=\"\" for \"bash\")" |
43 |
echo " (-tlm) perform a Tangent Linear run" |
echo " (-ef) STRING used as genmake2 \"-extra_flag\" argument" |
|
echo " (-adm|-ad) perform an adjoint run" |
|
|
echo " (-oad) perform an OpenAD adjoint run" |
|
|
echo " (-command|-c) STRING command to run" |
|
44 |
echo " (-makedepend|-md) STRING command to use for \"makedepend\"" |
echo " (-makedepend|-md) STRING command to use for \"makedepend\"" |
45 |
echo " (-make|-m) STRING command to use for \"make\"" |
echo " (-make|-m) STRING command to use for \"make\"" |
46 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
47 |
echo " (-odir) STRING used to build output directory name" |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
48 |
echo " (DEF=\"hostname\")" |
echo " ---- output options : ----" |
|
# echo " (-ptracers|-ptr) STRING specify which ptracers to test" |
|
|
# echo " (DEF=\"1 2 3 4 5\")" |
|
49 |
echo " (-match) NUMBER Matching Criteria (number of digits)" |
echo " (-match) NUMBER Matching Criteria (number of digits)" |
50 |
echo " (DEF=\"$MATCH_CRIT\")" |
echo " (DEF=\"$MATCH_CRIT\")" |
51 |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
echo " (-odir) STRING used to build output directory name" |
52 |
echo " (-ef) STRING used as genmake2 \"-extra_flag\" argument" |
echo " (DEF=\"hostname\")" |
53 |
|
echo " (-addr|-a) STRING list of email recipients" |
54 |
|
echo " (DEF=\"\" no email is sent)" |
55 |
|
echo " (-send) STRING sending command (instead of using mpack)" |
56 |
|
echo " (-savdir|-sd) STRING location to save output tar file to send (DEF='$SAVDIR')" |
57 |
|
echo " (-mpackdir|-mpd) DIR location of the mpack utility" |
58 |
|
echo " (DEF=\"../tools/mpack-1.6\")" |
59 |
|
echo " -- do only some parts: --" |
60 |
echo " (-clean) *ONLY* run \"make CLEAN\" & clean run-dir" |
echo " (-clean) *ONLY* run \"make CLEAN\" & clean run-dir" |
61 |
echo " (-norun|-nr) skip the \"runmodel\" stage (stop after make)" |
echo " (-norun|-nr) skip the \"runmodel\" stage (stop after make)" |
62 |
echo " (-obj) only produces objects (=norun & no executable)" |
echo " (-obj) only produces objects (=norun & no executable)" |
68 |
echo " (-postclean|-pc) after each exp. test, clean build-dir & run-dir" |
echo " (-postclean|-pc) after each exp. test, clean build-dir & run-dir" |
69 |
echo " (-deloutp|-do) delete output files after successful run" |
echo " (-deloutp|-do) delete output files after successful run" |
70 |
echo " (-deldir|-dd) on success, delete the output directory" |
echo " (-deldir|-dd) on success, delete the output directory" |
|
echo " (-ts) provide timing information per timestep" |
|
|
echo " (-papis) provide MFlop/s per timestep using PAPI" |
|
|
echo " (-pcls) provide MFlop/s per timestep using PCL" |
|
71 |
echo |
echo |
72 |
echo "and where STRING can be a whitespace-delimited list" |
echo "and where STRING can be a whitespace-delimited list" |
73 |
echo "such as:" |
echo "such as:" |
129 |
echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
130 |
fi |
fi |
131 |
if [ -r $1/$4/$OUTPUTFILE ]; then |
if [ -r $1/$4/$OUTPUTFILE ]; then |
132 |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > ${TMP}a.txt |
133 |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
lncntA=`wc -l ${TMP}a.txt | awk '{print $1}' ` |
134 |
if [ $lncntA -lt 2 ]; then |
if [ $lncntA -lt 2 ]; then |
135 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
136 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
137 |
fi |
fi |
138 |
rm -f tmp1.txt ; return 99 |
rm -f ${TMP}a.txt ; return 99 |
139 |
fi |
fi |
140 |
else |
else |
141 |
echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2 |
echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2 |
144 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
145 |
echo testoutput_var: grep "$2" $1/$5 1>&2 |
echo testoutput_var: grep "$2" $1/$5 1>&2 |
146 |
fi |
fi |
147 |
grep "$2" $1/$5 | sed 's/.*=//' | cat -n > tmp2.txt |
grep "$2" $1/$5 | sed 's/.*=//' | cat -n > ${TMP}b.txt |
148 |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
lncntB=`wc -l ${TMP}b.txt | awk '{print $1}' ` |
149 |
if [ $lncntB -lt 2 ]; then |
if [ $lncntB -lt 2 ]; then |
150 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
151 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
152 |
fi |
fi |
153 |
rm -f tmp1.txt tmp2.txt ; return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
154 |
fi |
fi |
155 |
if [ $lncntA -ne $lncntB ]; then |
if [ $lncntA -ne $lncntB ]; then |
156 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
157 |
echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2 |
echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2 |
158 |
fi |
fi |
159 |
rm -f tmp1.txt tmp2.txt ; return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
160 |
fi |
fi |
161 |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
has_nan=`cat ${TMP}a.txt | grep -i nan | wc -l` |
162 |
if [ $has_nan -gt 0 ] ; then |
if [ $has_nan -gt 0 ] ; then |
163 |
echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
164 |
rm -f tmp1.txt tmp2.txt ; return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
165 |
fi |
fi |
166 |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
has_inf=`cat ${TMP}a.txt | grep -i inf | wc -l` |
167 |
if [ $has_inf -gt 0 ] ; then |
if [ $has_inf -gt 0 ] ; then |
168 |
echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
169 |
rm -f tmp1.txt tmp2.txt ; return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
170 |
fi |
fi |
171 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
172 |
echo testoutput_var: join tmp1.txt tmp2.txt 1>&2 |
echo testoutput_var: join ${TMP}a.txt ${TMP}b.txt 1>&2 |
173 |
fi |
fi |
174 |
join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt |
# On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number |
175 |
|
join ${TMP}a.txt ${TMP}b.txt | awk '{print $1 " " $2 " " $3}' | sed -e 's|:||g' > ${TMP}c.txt |
176 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
177 |
echo testoutput_var: compare_lines 1>&2 |
echo testoutput_var: compare_lines 1>&2 |
178 |
fi |
fi |
179 |
if [ $verbose -gt 1 ]; then |
if [ $verbose -gt 1 ]; then |
180 |
cat tmp3.txt 1>&2 |
cat ${TMP}c.txt 1>&2 |
181 |
fi |
fi |
182 |
echo "-1" >> tmp3.txt |
echo "-1" >> ${TMP}c.txt |
183 |
# On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number |
digits_of_similarity=`./tr_cmpnum < ${TMP}c.txt` |
|
cat tmp3.txt | sed -e 's|:||g' > tmp4.txt |
|
|
digits_of_similarity=`./tr_cmpnum < tmp4.txt` |
|
184 |
if [ $digits_of_similarity -eq 99 ]; then |
if [ $digits_of_similarity -eq 99 ]; then |
185 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
186 |
echo testoutput_var: No comparison was available for \"$3\" 1>&2 |
echo testoutput_var: No comparison was available for \"$3\" 1>&2 |
191 |
echo There were $digits_of_similarity decimal places of similarity for \"$3\" 1>&2 |
echo There were $digits_of_similarity decimal places of similarity for \"$3\" 1>&2 |
192 |
fi |
fi |
193 |
fi |
fi |
194 |
rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt |
rm -f ${TMP}a.txt ${TMP}b.txt ${TMP}c.txt |
195 |
|
|
196 |
return $digits_of_similarity |
return $digits_of_similarity |
197 |
} |
} |
1034 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
1035 |
HAVE_MPACK= |
HAVE_MPACK= |
1036 |
MPACK= |
MPACK= |
1037 |
|
SENDCMD= |
1038 |
|
SAVDIR='.' |
1039 |
COMMAND= |
COMMAND= |
1040 |
MKDEPEND= |
MKDEPEND= |
1041 |
if test "x$MAKE" = x ; then |
if test "x$MAKE" = x ; then |
1091 |
-mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;; |
-mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;; |
1092 |
-mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;; |
-mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;; |
1093 |
|
|
1094 |
|
-send | --send ) ac_prev=SENDCMD ;; |
1095 |
|
-send=* | --send=* ) SENDCMD=$ac_optarg ;; |
1096 |
|
-savdir | --savdir | -sd | --sd ) ac_prev=SAVDIR ;; |
1097 |
|
-savdir=* | --savdir=* | -sd=* | --sd=* ) SAVDIR=$ac_optarg ;; |
1098 |
|
|
1099 |
-tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;; |
-tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;; |
1100 |
-tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;; |
-tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;; |
1101 |
-skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;; |
-skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;; |
1303 |
|
|
1304 |
echo "OK (COMMAND= $COMMAND )" |
echo "OK (COMMAND= $COMMAND )" |
1305 |
|
|
1306 |
|
TMP=./tr_$$ |
1307 |
|
#- try to put temporary files in system-local /tmp dir |
1308 |
|
#TMP=/tmp/tr_$$ |
1309 |
|
#touch $TMP ; retVal=$? |
1310 |
|
#if [ $retVal -eq 0 ] ; then |
1311 |
|
# if test ! -r $TMP ; then TMP=./tr_$$ ; fi |
1312 |
|
#else |
1313 |
|
# TMP=./tr_$$ |
1314 |
|
#fi |
1315 |
|
#rm -f $TMP |
1316 |
|
#if [ $verbose -gt 1 ]; then echo " temp files: $TMP" ; fi |
1317 |
|
|
1318 |
# set the Default List of output variables to be checked: |
# set the Default List of output variables to be checked: |
1319 |
# (use default or load experiment-specific list from file "tr_checklist") |
# (use default or load experiment-specific list from file "tr_checklist") |
1320 |
# content : 1rst = main variable used to decide if it pass or FAIL |
# content : 1rst = main variable used to decide if it pass or FAIL |
1343 |
fi |
fi |
1344 |
|
|
1345 |
# build the mpack utility (if ADDRESSES = NONE, do it to test the build) |
# build the mpack utility (if ADDRESSES = NONE, do it to test the build) |
1346 |
if test "x$ADDRESSES" = x ; then |
if test "x$ADDRESSES" = x -o "x$SENDCMD" != x ; then |
1347 |
echo "skipping mpack build" |
echo "skipping mpack build" |
1348 |
else |
else |
1349 |
build_mpack |
build_mpack |
1350 |
|
if test "x$HAVE_MPACK" = xt ; then SENDCMD=$MPACK ; fi |
1351 |
fi |
fi |
1352 |
|
|
1353 |
# Create a uniquely named directory to store results |
# Create a uniquely named directory to store results |
1681 |
sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
1682 |
$SUMMARY > tmp.tr_log |
$SUMMARY > tmp.tr_log |
1683 |
RETVAL=$? |
RETVAL=$? |
1684 |
if test "x$RETVAL" = x0 ; then rm -f $SUMMARY |
if test "x$RETVAL" = x0 ; then |
1685 |
cp tmp.tr_log $SUMMARY |
cp -f tmp.tr_log $SUMMARY |
|
else rm -f tmp.tr_log |
|
1686 |
fi |
fi |
1687 |
|
rm -f tmp.tr_log |
1688 |
fi |
fi |
1689 |
gmkLog=$dir/$builddir/genmake.log |
gmkLog=$dir/$builddir/genmake.log |
1690 |
if test -r $gmkLog ; then |
if test -r $gmkLog ; then |
1728 |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
1729 |
echo "No results email was sent." |
echo "No results email was sent." |
1730 |
else |
else |
1731 |
if test "x$HAVE_MPACK" = xt ; then |
if test "x$SENDCMD" != x ; then |
1732 |
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
if [ $verbose -gt 1 ]; then |
1733 |
&& gzip $DRESULTS".tar" \ |
echo " run: $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES" |
1734 |
&& $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES |
fi |
1735 |
|
tar -cf ${SAVDIR}/${DRESULTS}".tar" $DRESULTS > /dev/null 2>&1 \ |
1736 |
|
&& gzip ${SAVDIR}/${DRESULTS}".tar" \ |
1737 |
|
&& $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES |
1738 |
RETVAL=$? |
RETVAL=$? |
1739 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
1740 |
echo |
echo |
1747 |
echo "An email containing results was sent to the following addresses:" |
echo "An email containing results was sent to the following addresses:" |
1748 |
echo " \"$ADDRESSES\"" |
echo " \"$ADDRESSES\"" |
1749 |
echo |
echo |
1750 |
test -f $DRESULTS".tar" && rm -f $DRESULTS".tar" |
test -f ${SAVDIR}/${DRESULTS}".tar" && rm -f ${SAVDIR}/${DRESULTS}".tar" |
1751 |
test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz" |
test -f ${SAVDIR}/${DRESULTS}".tar.gz" && rm -f ${SAVDIR}/${DRESULTS}".tar.gz" |
1752 |
fi |
fi |
1753 |
fi |
fi |
1754 |
fi |
fi |