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 (e.g., if non-standard MPI setting)" |
23 |
|
echo " DEF='mitgcmuv' or ='mpirun -np TR_NPROC mitgcmuv'" |
24 |
|
echo " ---- testing options : ----" |
25 |
|
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')" |
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)" |
29 |
echo " (-gsl) compile with \"-gsl\" flag" |
echo " (-gsl) compile with \"-gsl\" flag" |
30 |
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\")" |
|
31 |
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" |
32 |
echo " (recognized groups: basic, tutorials)" |
echo " (recognized groups: basic, tutorials)" |
33 |
echo " (DEF=\"\" which test all)" |
echo " (DEF=\"\" which test all)" |
35 |
echo " test THIS_EXP + all the following)" |
echo " test THIS_EXP + all the following)" |
36 |
echo " (-skipdir|-skd) STRING list of exp. dirs to skip" |
echo " (-skipdir|-skd) STRING list of exp. dirs to skip" |
37 |
echo " (DEF=\"\" which test all)" |
echo " (DEF=\"\" which test all)" |
38 |
echo " (-bash|-b) STRING preferred location of a \"bash\" or" |
echo " (-ts) provide timing information per timestep" |
39 |
echo " Bourne-compatible \"sh\" shell" |
echo " (-papis) provide MFlop/s per timestep using PAPI" |
40 |
|
echo " (-pcls) provide MFlop/s per timestep using PCL" |
41 |
|
echo " ---- system options : ----" |
42 |
|
echo " (-bash|-b) STRING preferred location of a \"bash\" or \"sh\" shell" |
43 |
echo " (DEF=\"\" for \"bash\")" |
echo " (DEF=\"\" for \"bash\")" |
44 |
echo " (-tlm) perform a Tangent Linear run" |
echo " (-ef) STRING used as genmake2 \"-extra_flag\" argument" |
45 |
echo " (-adm|-ad) perform an adjoint run" |
echo " (-ncad) use genmake2 option \"-nocat4ad\" (-ncad)" |
46 |
echo " (-oad) perform an OpenAD adjoint run" |
echo " (-small_f) make target small_f before making target all" |
|
echo " (-command|-c) STRING command to run" |
|
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\")" |
50 |
echo " (-odir) STRING used to build output directory name" |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
51 |
echo " (DEF=\"hostname\")" |
echo " ---- output options : ----" |
|
# echo " (-ptracers|-ptr) STRING specify which ptracers to test" |
|
|
# echo " (DEF=\"1 2 3 4 5\")" |
|
52 |
echo " (-match) NUMBER Matching Criteria (number of digits)" |
echo " (-match) NUMBER Matching Criteria (number of digits)" |
53 |
echo " (DEF=\"$MATCH_CRIT\")" |
echo " (DEF=\"$MATCH_CRIT\")" |
54 |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
echo " (-odir) STRING used to build output directory name" |
55 |
echo " (-ef) STRING used as genmake2 \"-extra_flag\" argument" |
echo " (DEF=\"hostname\")" |
56 |
|
echo " (-addr|-a) STRING list of email recipients" |
57 |
|
echo " (DEF=\"\" no email is sent)" |
58 |
|
echo " (-send) STRING sending command (instead of using mpack)" |
59 |
|
echo " (-savdir|-sd) STRING location to save output tar file to send (DEF='$SAVDIR')" |
60 |
|
echo " (-mpackdir|-mpd) DIR location of the mpack utility" |
61 |
|
echo " (DEF=\"../tools/mpack-1.6\")" |
62 |
|
echo " -- do only some parts: --" |
63 |
echo " (-clean) *ONLY* run \"make CLEAN\" & clean run-dir" |
echo " (-clean) *ONLY* run \"make CLEAN\" & clean run-dir" |
64 |
echo " (-norun|-nr) skip the \"runmodel\" stage (stop after make)" |
echo " (-norun|-nr) skip the \"runmodel\" stage (stop after make)" |
65 |
echo " (-obj) only produces objects (=norun & no executable)" |
echo " (-obj) only produces objects (=norun & no executable)" |
71 |
echo " (-postclean|-pc) after each exp. test, clean build-dir & run-dir" |
echo " (-postclean|-pc) after each exp. test, clean build-dir & run-dir" |
72 |
echo " (-deloutp|-do) delete output files after successful run" |
echo " (-deloutp|-do) delete output files after successful run" |
73 |
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" |
|
74 |
echo |
echo |
75 |
echo "and where STRING can be a whitespace-delimited list" |
echo "and where STRING can be a whitespace-delimited list" |
76 |
echo "such as:" |
echo "such as:" |
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 > tmp1.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | nl > ${TMP}a.txt |
136 |
lncntA=`wc -l tmp1.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 |
139 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
140 |
fi |
fi |
141 |
rm -f tmp1.txt ; return 99 |
rm -f ${TMP}a.txt ; return 99 |
142 |
fi |
fi |
143 |
else |
else |
144 |
echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2 |
echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2 |
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 > tmp2.txt |
grep "$2" $1/$5 | sed 's/.*=//' | nl > ${TMP}b.txt |
151 |
lncntB=`wc -l tmp2.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 |
154 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
155 |
fi |
fi |
156 |
rm -f tmp1.txt tmp2.txt ; return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
157 |
fi |
fi |
158 |
if [ $lncntA -ne $lncntB ]; then |
if [ $lncntA -ne $lncntB ]; then |
159 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
160 |
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 |
161 |
fi |
fi |
162 |
rm -f tmp1.txt tmp2.txt ; return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
163 |
fi |
fi |
164 |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
has_nan=`cat ${TMP}a.txt | grep -i nan | wc -l` |
165 |
if [ $has_nan -gt 0 ] ; then |
if [ $has_nan -gt 0 ] ; then |
166 |
echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
167 |
rm -f tmp1.txt tmp2.txt ; return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
168 |
fi |
fi |
169 |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
has_inf=`cat ${TMP}a.txt | grep -i inf | wc -l` |
170 |
if [ $has_inf -gt 0 ] ; then |
if [ $has_inf -gt 0 ] ; then |
171 |
echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
172 |
rm -f tmp1.txt tmp2.txt ; return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
173 |
fi |
fi |
174 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
175 |
echo testoutput_var: join tmp1.txt tmp2.txt 1>&2 |
echo testoutput_var: join ${TMP}a.txt ${TMP}b.txt 1>&2 |
176 |
fi |
fi |
177 |
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 |
178 |
|
join ${TMP}a.txt ${TMP}b.txt | awk '{print $1 " " $2 " " $3}' | sed -e 's|:||g' > ${TMP}c.txt |
179 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
180 |
echo testoutput_var: compare_lines 1>&2 |
echo testoutput_var: compare_lines 1>&2 |
181 |
fi |
fi |
182 |
if [ $verbose -gt 1 ]; then |
if [ $verbose -gt 1 ]; then |
183 |
cat tmp3.txt 1>&2 |
cat ${TMP}c.txt 1>&2 |
184 |
fi |
fi |
185 |
echo "-1" >> tmp3.txt |
echo "-1" >> ${TMP}c.txt |
186 |
# 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` |
|
187 |
if [ $digits_of_similarity -eq 99 ]; then |
if [ $digits_of_similarity -eq 99 ]; then |
188 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
189 |
echo testoutput_var: No comparison was available for \"$3\" 1>&2 |
echo testoutput_var: No comparison was available for \"$3\" 1>&2 |
194 |
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 |
195 |
fi |
fi |
196 |
fi |
fi |
197 |
rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt |
rm -f ${TMP}a.txt ${TMP}b.txt ${TMP}c.txt |
198 |
|
|
199 |
return $digits_of_similarity |
return $digits_of_similarity |
200 |
} |
} |
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=$? ;; |
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 |
343 |
if test $xx = $sVar |
if test $xx = $sVar |
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 ../../OpenAD/code_oad_all'" |
|
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 |
437 |
makeclean() |
makeclean() |
438 |
{ |
{ |
439 |
# makeclean directory |
# makeclean directory |
440 |
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 |
441 |
if test "x$NOCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
442 |
echo "make Clean skipped!" |
echo "make Clean skipped!" |
443 |
else |
else |
469 |
if test "x$NOCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
470 |
echo "run_clean skipped!" |
echo "run_clean skipped!" |
471 |
else |
else |
472 |
( |
( |
473 |
cd $1; |
cd $1; |
474 |
printf 'clean run-dir ... ' |
printf 'clean run-dir ... ' |
475 |
# part of what is done after "make clean" when doing "make CLEAN" |
# part of what is done after "make clean" when doing "make CLEAN" |
476 |
find . -name "*.meta" -exec rm {} \; |
find . -name "*.meta" -exec rm {} \; |
477 |
find . -name "*.data" -exec rm {} \; |
find . -name "*.data" -exec rm {} \; |
478 |
find . -name "fort.*" -exec rm {} \; |
find . -name "fort.*" -exec rm {} \; |
479 |
find . -type l -exec rm {} \; |
find . -type l -exec rm {} \; |
480 |
#- should remove executable only if sym-link (alredy done above) |
#- should remove executable only if sym-link (already done above) |
481 |
rm -f $RUNLOG *.txt STD* w2_tile_topology.????.log *diagnostics.log datetime |
rm -f $RUNLOG *.txt STDOUT.* STDERR.* *diagnostics.log *.[0-9][0-9][0-9][0-9].log |
482 |
rm -rf mnc_test_* |
rm -f datetime costfinal divided.ctrl snapshot* output_adm.*.diva_* |
483 |
rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
484 |
echo successful |
rm -f oad_cp.[0-9][0-9][0-9].????? |
485 |
exit 0 |
rm -rf mnc_test_* |
486 |
) |
echo successful |
487 |
|
exit 0 |
488 |
|
) |
489 |
fi |
fi |
490 |
} |
} |
491 |
|
|
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 |
562 |
fi |
fi |
563 |
fi |
fi |
564 |
if test $KIND = 1 -a -f taf_ftl.log ; then |
if test $KIND = 1 -a -f taf_ftl.log ; then |
565 |
head -1 taf_ftl.log >> $CDIR"/summary.txt" |
head -1 taf_ftl.log >> $CDIR"/summary.txt" |
566 |
fi |
fi |
567 |
if test $KIND = 2 -a -f taf_ad.log ; then |
if test $KIND = 2 -a -f taf_ad.log ; then |
568 |
head -1 taf_ad.log >> $CDIR"/summary.txt" |
head -1 taf_ad.log >> $CDIR"/summary.txt" |
569 |
nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log` |
nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log` |
570 |
nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log` |
nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log` |
571 |
echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \ |
if test -f taf_output ; then |
572 |
|
n2er=`grep -c 'TAF *.* ERROR ' taf_output` |
573 |
|
n3er=`grep -c '\*ERROR\* ' taf_output` |
574 |
|
nerr=`expr $nerr + $n2er + $n3er` |
575 |
|
fi |
576 |
|
echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \ |
577 |
>> $CDIR"/summary.txt" |
>> $CDIR"/summary.txt" |
578 |
fi |
fi |
579 |
if test $mk_fail != 0 ; then return $mk_fail ; fi |
if test $mk_fail != 0 ; then return $mk_fail ; fi |
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 |
820 |
# output do not exist or is older than executable: |
# output do not exist or is older than executable: |
821 |
rm -f $OUTPUTFILE $RUNLOG ; touch $RUNLOG |
rm -f $OUTPUTFILE $RUNLOG ; touch $RUNLOG |
822 |
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
823 |
|
#- Divided Adjoint Run: |
824 |
|
# get the number of additional runs (add_DIVA_runs) from file "run_ADM_DIVA" |
825 |
|
if test $KIND = 2 -a -f run_ADM_DIVA ; then |
826 |
|
adm_diva_nb=`sed -n '/^ *add_DIVA_runs\>.*=/p' run_ADM_DIVA | sed 's/ //g'` |
827 |
|
echo " Divided Adjoint Run: $adm_diva_nb" >> $RUNLOG |
828 |
|
eval "let $adm_diva_nb" |
829 |
|
if [ $add_DIVA_runs -ge 1 ] ; then |
830 |
|
rm -f costf* divided.ctrl snapshot* |
831 |
|
echo -n "(add_DIVA_runs=$add_DIVA_runs) ... " |
832 |
|
for ii in `seq 1 $add_DIVA_runs` ; do |
833 |
|
( eval $COMMAND ) >> $RUNLOG 2>&1 |
834 |
|
echo " additional DIVA run # $ii : done" >> $RUNLOG |
835 |
|
mv -f $OUTPUTFILE ${OUTPUTFILE}.diva_${ii} |
836 |
|
done |
837 |
|
fi |
838 |
|
fi |
839 |
|
#- special DIVA processing ends here |
840 |
( eval $COMMAND ) >> $RUNLOG 2>&1 |
( eval $COMMAND ) >> $RUNLOG 2>&1 |
841 |
RETVAL=$? |
RETVAL=$? |
842 |
ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'` |
ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'` |
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 |
968 |
fi |
fi |
969 |
fi |
fi |
970 |
printf ' %s' $nm |
printf ' %s' $nm |
971 |
|
if test $KIND = 2 ; then |
972 |
|
#-- apppend taf repport summary: |
973 |
|
tafrep=`grep -c '^ TAF reports ' $CDIR/summary.txt` |
974 |
|
if test $tafrep = 1 ; then |
975 |
|
grep '^ TAF reports ' $CDIR/summary.txt | awk '{printf " (e=%i, w=%i)",$3,$6}' |
976 |
|
fi |
977 |
|
fi |
978 |
printf '\n' |
printf '\n' |
979 |
|
|
980 |
} |
} |
1060 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
1061 |
HAVE_MPACK= |
HAVE_MPACK= |
1062 |
MPACK= |
MPACK= |
1063 |
|
SENDCMD= |
1064 |
|
SAVDIR='.' |
1065 |
COMMAND= |
COMMAND= |
1066 |
MKDEPEND= |
MKDEPEND= |
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 ; |
1119 |
-mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;; |
-mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;; |
1120 |
-mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;; |
-mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;; |
1121 |
|
|
1122 |
|
-send | --send ) ac_prev=SENDCMD ;; |
1123 |
|
-send=* | --send=* ) SENDCMD=$ac_optarg ;; |
1124 |
|
-savdir | --savdir | -sd | --sd ) ac_prev=SAVDIR ;; |
1125 |
|
-savdir=* | --savdir=* | -sd=* | --sd=* ) SAVDIR=$ac_optarg ;; |
1126 |
|
|
1127 |
-tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;; |
-tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;; |
1128 |
-tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;; |
-tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;; |
1129 |
-skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;; |
-skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;; |
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 |
1324 |
|
|
1325 |
LOC_MFILE='tr_mpi_mfile' |
LOC_MFILE='tr_mpi_mfile' |
1326 |
RUNLOG="run.tr_log" |
RUNLOG="run.tr_log" |
1327 |
OUTPUTFILE=$ref_outp |
if test "x$MPI" = x0 ; then |
1328 |
if test "x$COMMAND" = x ; then |
OUTPUTFILE=$ref_outp |
1329 |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
if test "x$COMMAND" = x ; then COMMAND="./$EXECUTABLE > $OUTPUTFILE" ; fi |
1330 |
fi |
else |
1331 |
if test "x$MPI" != x0 ; then |
OUTPUTFILE="STDOUT.0000" |
1332 |
OUTPUTFILE="STDOUT.0000" |
if test "x$COMMAND" = x ; then COMMAND="mpirun -np TR_NPROC ./$EXECUTABLE" ; fi |
1333 |
fi |
fi |
1334 |
|
|
1335 |
echo "OK (COMMAND= $COMMAND )" |
echo "OK (COMMAND='$COMMAND')" |
1336 |
|
|
1337 |
|
#TMP=./tr_$$ |
1338 |
|
#- try to put temporary files in system-local /tmp dir |
1339 |
|
TMP=/tmp/tr_${USER}_$$ |
1340 |
|
touch $TMP ; retVal=$? |
1341 |
|
if [ $retVal -eq 0 ] ; then |
1342 |
|
if test ! -r $TMP ; then TMP=./tr_$$ ; fi |
1343 |
|
else |
1344 |
|
TMP=./tr_$$ |
1345 |
|
fi |
1346 |
|
rm -f $TMP |
1347 |
|
if [ $verbose -gt 1 ]; then echo " temp files: $TMP" ; fi |
1348 |
|
|
1349 |
# set the Default List of output variables to be checked: |
# set the Default List of output variables to be checked: |
1350 |
# (use default or load experiment-specific list from file "tr_checklist") |
# (use default or load experiment-specific list from file "tr_checklist") |
1374 |
fi |
fi |
1375 |
|
|
1376 |
# 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) |
1377 |
if test "x$ADDRESSES" = x ; then |
if test "x$ADDRESSES" = x -o "x$SENDCMD" != x ; then |
1378 |
echo "skipping mpack build" |
echo "skipping mpack build" |
1379 |
else |
else |
1380 |
build_mpack |
build_mpack |
1381 |
|
if test "x$HAVE_MPACK" = xt ; then SENDCMD=$MPACK ; fi |
1382 |
fi |
fi |
1383 |
|
|
1384 |
# Create a uniquely named directory to store results |
# Create a uniquely named directory to store results |
1391 |
CMDLINE="$CMDLINE $yy" ; fi |
CMDLINE="$CMDLINE $yy" ; fi |
1392 |
fi |
fi |
1393 |
done |
done |
|
#for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done |
|
1394 |
MACH=`hostname` |
MACH=`hostname` |
1395 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
1396 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
1398 |
if test "x$OUTDIR" != x ; then |
if test "x$OUTDIR" != x ; then |
1399 |
BASE="tr_"$OUTDIR"_"$DATE"_" |
BASE="tr_"$OUTDIR"_"$DATE"_" |
1400 |
else |
else |
1401 |
short_name=`hostname | sed 's/\..*$//'` |
#short_name=`hostname -s | tr '[:upper:]' '[:lower:]'` |
1402 |
|
# hostname -s is not universal (does work on AIX system) |
1403 |
|
short_name=`hostname | sed 's/\..*$//' | tr '[:upper:]' '[:lower:]'` |
1404 |
BASE="tr_"$short_name"_"$DATE"_" |
BASE="tr_"$short_name"_"$DATE"_" |
1405 |
fi |
fi |
1406 |
DNUM=0 |
DNUM=0 |
1518 |
rm -f $EXECUTABLE *.bak |
rm -f $EXECUTABLE *.bak |
1519 |
rm -f genmake_state genmake_*optfile genmake.log |
rm -f genmake_state genmake_*optfile genmake.log |
1520 |
rm -f SIZE.h.mpi genmake.tr_log make.tr_log |
rm -f SIZE.h.mpi genmake.tr_log make.tr_log |
1521 |
|
rm -rf mpi_headers |
1522 |
) |
) |
1523 |
if test -d $dir/$rundir/CVS ; then |
if test -d $dir/$rundir/CVS ; then |
1524 |
echo -n ' --- dir:' $dir/$rundir ': ' |
echo -n ' --- dir:' $dir/$rundir ': ' |
1693 |
linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir |
linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir |
1694 |
runmodel $dir/$pfxdir.$ex && run=Y \ |
runmodel $dir/$pfxdir.$ex && run=Y \ |
1695 |
&& results=`testoutput_run $dir $pfxdir.$ex $refExOut` |
&& results=`testoutput_run $dir $pfxdir.$ex $refExOut` |
1696 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir.$ex ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
|
fres="$fres.$ex" |
|
1697 |
echo 1>&2 |
echo 1>&2 |
1698 |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
1699 |
echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt" |
echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt" |
1706 |
if test -f $dir/$builddir/Makefile ; then |
if test -f $dir/$builddir/Makefile ; then |
1707 |
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/^# //'` |
1708 |
echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state |
echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state |
1709 |
sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state |
# sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state |
1710 |
|
# bsd-sed cannot do the above code |
1711 |
|
cat $dir/$builddir/Makefile | \ |
1712 |
|
sed -n '/^# executed by:/{N |
1713 |
|
p |
1714 |
|
}' >> $DRESULTS/genmake_state |
1715 |
echo " $mkOpt" >> $DRESULTS/genmake_state |
echo " $mkOpt" >> $DRESULTS/genmake_state |
1716 |
if test "x$OPTFILE" = xNONE ; then |
if test "x$OPTFILE" = xNONE ; then |
1717 |
eval $mkOpt |
eval $mkOpt |
1718 |
sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
# sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
1719 |
$SUMMARY > tmp.tr_log |
# $SUMMARY > tmp.tr_log |
1720 |
|
# bsd-sed requires a newline after "a\": |
1721 |
|
sed "/^No \"OPTFILE\" was specified ; genmake2/a\\ |
1722 |
|
OPTFILE=${OPTFILE}" $SUMMARY > tmp.tr_log |
1723 |
RETVAL=$? |
RETVAL=$? |
1724 |
if test "x$RETVAL" = x0 ; then rm -f $SUMMARY |
if test "x$RETVAL" = x0 ; then |
1725 |
cp tmp.tr_log $SUMMARY |
cp -f tmp.tr_log $SUMMARY |
|
else rm -f tmp.tr_log |
|
1726 |
fi |
fi |
1727 |
|
rm -f tmp.tr_log |
1728 |
fi |
fi |
1729 |
gmkLog=$dir/$builddir/genmake.log |
gmkLog=$dir/$builddir/genmake.log |
1730 |
if test -r $gmkLog ; then |
if test -r $gmkLog ; then |
1740 |
>> $DRESULTS/genmake_state |
>> $DRESULTS/genmake_state |
1741 |
rm -f tmp.tr_log |
rm -f tmp.tr_log |
1742 |
fi |
fi |
1743 |
echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state |
fi |
1744 |
echo "get NETCDF & LAPACK settings:" >> $DRESULTS/genmake_state |
gmkLog=$dir/$builddir/genmake_state |
1745 |
sed -n '/set HAVE_NETCDF=/p' $gmkLog >> $DRESULTS/genmake_state |
if test -r $gmkLog ; then |
1746 |
sed -n '/set HAVE_LAPACK=/p' $gmkLog >> $DRESULTS/genmake_state |
echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state |
1747 |
|
echo "get genmake settings:" >> $DRESULTS/genmake_state |
1748 |
|
sed -n '/^HAVE_/p' $gmkLog | sed 's/^./ &/' \ |
1749 |
|
>> $DRESULTS/genmake_state |
1750 |
fi |
fi |
1751 |
fi |
fi |
1752 |
fi |
fi |
1771 |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
1772 |
echo "No results email was sent." |
echo "No results email was sent." |
1773 |
else |
else |
1774 |
if test "x$HAVE_MPACK" = xt ; then |
if test "x$SENDCMD" != x ; then |
1775 |
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
if [ $verbose -gt 1 ]; then |
1776 |
&& gzip $DRESULTS".tar" \ |
echo " run: $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES" |
1777 |
&& $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES |
fi |
1778 |
|
tar -cf ${SAVDIR}/${DRESULTS}".tar" $DRESULTS > /dev/null 2>&1 \ |
1779 |
|
&& gzip ${SAVDIR}/${DRESULTS}".tar" \ |
1780 |
|
&& $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES |
1781 |
RETVAL=$? |
RETVAL=$? |
1782 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
1783 |
echo |
echo |
1790 |
echo "An email containing results was sent to the following addresses:" |
echo "An email containing results was sent to the following addresses:" |
1791 |
echo " \"$ADDRESSES\"" |
echo " \"$ADDRESSES\"" |
1792 |
echo |
echo |
1793 |
test -f $DRESULTS".tar" && rm -f $DRESULTS".tar" |
test -f ${SAVDIR}/${DRESULTS}".tar" && rm -f ${SAVDIR}/${DRESULTS}".tar" |
1794 |
test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz" |
test -f ${SAVDIR}/${DRESULTS}".tar.gz" && rm -f ${SAVDIR}/${DRESULTS}".tar.gz" |
1795 |
fi |
fi |
1796 |
fi |
fi |
1797 |
fi |
fi |