--- MITgcm/verification/testreport 2006/07/16 04:02:49 1.86 +++ MITgcm/verification/testreport 2007/09/07 00:44:37 1.95 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.86 2006/07/16 04:02:49 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.95 2007/09/07 00:44:37 jmc Exp $ # $Name: $ # @@ -15,12 +15,14 @@ echo " (-mpi) compile and run using MPI" echo " (-ieee|-noieee) if possible, use IEEE compiler flags" echo " (DEF=\"-ieee\")" - echo " (-optfile=|-of=)STRING list of optfiles to use" + echo " (-of=|-optfile=)STRING list of optfiles to use" echo " (-a|-addr) STRING list of email recipients" echo " (DEF=\"edhill@mitgcm.org\")" echo " (-t|-tdir) STRING list of group and/or exp. dirs to test" echo " (recognized groups: basic, tutorials)" echo " (DEF=\"\" which test all)" + echo " (-skd|-skipdir) STRING list of exp. dirs to skip" + echo " (DEF=\"\" which test all)" echo " (-b|-bash) STRING preferred location of a \"bash\" or" echo " Bourne-compatible \"sh\" shell" echo " (DEF=\"\" for \"bash\")" @@ -31,8 +33,10 @@ echo " (DEF=\"make\")" echo " (-odir) STRING used to build output directory name" echo " (DEF=\"hostname\")" - echo " (-ptracers|-ptr) STRING specify which ptracers to test" + echo " (-ptr|-ptracers) STRING specify which ptracers to test" echo " (DEF=\"1 2 3 4 5\")" + echo " (-match) NUMBER Matching Criteria (number of digits)" + echo " (DEF=\"12\")" echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" echo " (-clean) *ONLY* run \"make CLEAN\"" echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" @@ -40,6 +44,9 @@ echo " (-noclean|-nc) skip the \"make clean\" stage" echo " (-nodepend|-nd) skip the \"make depend\" stage" 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" echo echo "and where STRING can be a whitespace-delimited list" echo "such as:" @@ -87,18 +94,19 @@ echo "OK" } -testoutput_for_prop() +testoutput_var() { - # testoutput_for_prop dir s1 label subdir extension + # testoutput_var dir s1 label subdir extension # - # compares files in $dir/$subdir/output.txt and $dir/results/output.txt - # using search strings s1 and text label + # compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE + # with same output from reference file $dir/results/output.$extension + # using search strings s1 and text label if [ $debug -gt 0 ]; then - echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 + echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 fi - if [ -r $1/$4/output.txt ]; then - grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt + if [ -r $1/$4/$OUTPUTFILE ]; then + grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt lncntA=`wc -l tmp1.txt | awk '{print $1}' ` if [ $lncntA -lt 3 ]; then if [ $verbose -gt 0 ]; then @@ -107,11 +115,11 @@ return 99 fi else - echo testoutput_for_prop: output.txt from model run was not readable 1>&2 + echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2 return 99 fi if [ $debug -gt 0 ]; then - echo testoutput_for_prop: grep "$2" $1/results/output.$5 1>&2 + echo testoutput_var: grep "$2" $1/results/output.$5 1>&2 fi grep "$2" $1/results/output.$5 | sed 's/.*=//' | cat -n > tmp2.txt lncntB=`wc -l tmp2.txt | awk '{print $1}' ` @@ -129,20 +137,20 @@ fi has_nan=`cat tmp1.txt | grep -i nan | wc -l` if [ $has_nan -gt 0 ] ; then - echo testoutput_for_prop: output.txt contains $has_nan NaN values 1>&2 + echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values 1>&2 return 99 fi has_inf=`cat tmp1.txt | grep -i inf | wc -l` if [ $has_inf -gt 0 ] ; then - echo testoutput_for_prop: output.txt contains $has_inf Inf values 1>&2 + echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values 1>&2 return 99 fi if [ $debug -gt 0 ]; then - echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 + echo testoutput_var: join tmp1.txt tmp2.txt 1>&2 fi join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt if [ $debug -gt 0 ]; then - echo testoutput_for_prop: compare_lines 1>&2 + echo testoutput_var: compare_lines 1>&2 fi if [ $verbose -gt 1 ]; then cat tmp3.txt 1>&2 @@ -150,10 +158,10 @@ echo "-1" >> tmp3.txt # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number cat tmp3.txt | sed -e 's|:||g' > tmp4.txt - digits_of_similarity=`./tmp_cmpnum < tmp4.txt` + digits_of_similarity=`./tr_cmpnum < tmp4.txt` if [ $digits_of_similarity -eq 99 ]; then if [ $verbose -gt 0 ]; then - echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 + echo testoutput_var: No comparison was available for \"$2\" 1>&2 fi digits_of_similarity=99 else @@ -184,15 +192,15 @@ testoutput_ad() { grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt - grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt + grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt - grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt + grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt join t05.txt t15.txt > t5.txt join t06.txt t16.txt > t6.txt echo "-1" >> t5.txt echo "-1" >> t6.txt - digits_5=`./tmp_cmpnum < t5.txt` - digits_6=`./tmp_cmpnum < t6.txt` + digits_5=`./tr_cmpnum < t5.txt` + digits_6=`./tr_cmpnum < t6.txt` dashnum $digits_5 $digits_6 rm -f t[01][56].txt t[56].txt } @@ -222,66 +230,87 @@ done } -testoutput() +testoutput_run() { - # testoutput directory subdir extension + # testoutput_run directory subdir extension # - # test output in "directory" + # test output from 1 run in "directory" if test "x$ADM" = x ; then - if [ $debug -gt 0 ]; then - echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 - fi - testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$? - if [ $debug -gt 0 ]; then - echo testoutput: cg2dres=$cg2dres 1>&2 - fi - testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2 $3; tmin=$? - testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2 $3; tmax=$? - testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2 $3; tmean=$? - testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2 $3; tsd=$? - testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2 $3; smin=$? - testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2 $3; smax=$? - testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2 $3; smean=$? - testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2 $3; ssd=$? - testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2 $3; umin=$? - testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2 $3; umax=$? - testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2 $3; umean=$? - testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2 $3; usd=$? - testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2 $3; vmin=$? - testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$? - testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? - testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$? - - # This is for PTRACERS - for ii in $PTRACERS_NUM ; do - eval `echo "p0"$ii"_min=99"` - eval `echo "p0"$ii"_max=99"` - eval `echo "p0"$ii"_mean=99"` - eval `echo "p0"$ii"_sd=99"` - tst=`eval 'echo "$HAVE_PTR0'$ii'"'` - #echo 'tst = '$tst - if test "x$tst" = xt ; then - a="trcstat_ptracer0" - testoutput_for_prop $1 "$a"$ii"_min" "p0"$ii"_min" $2 $3 - RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL` - testoutput_for_prop $1 "$a"$ii"_max" "p0"$ii"_max" $2 $3 - RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL` - testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3 - RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL` - testoutput_for_prop $1 "$a"$ii"_sd" "p0"$ii"_sd" $2 $3 - RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL` - fi - done - - allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd" - allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd" - allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd" - allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd" - allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd" - allargs="$allargs $p04_min $p04_max $p04_mean $p04_sd" - allargs="$allargs $p05_min $p05_max $p05_mean $p05_sd" - - eval "dashnum $allargs" + # default list of output variables to be checked: + # 1rst : main variable used to decide if it pass or FAIL + # others : number of matching digits to be printed in summary.txt + listChk=$DEF_CHECK_LIST + nbDef=`echo $listChk | awk '{print NF-1+3*gsub("+","E")}'` + # load experiment-specific list from file "tr_checklist" (if it exist) + if test -r $1/$2/tr_checklist ; then listChk=`cat $1/$2/tr_checklist` ; fi + sVar=`echo $listChk | awk '{print $1}'` + # remove 1rst var and expand the list: + => min max mean s.d + listVar=`echo $listChk | awk '{ for(i=2;i<=NF;i++){if (sub("+","",$i)) \ + {printf " %s %s %s %s",$i"mn",$i"mx",$i"av",$i"sd"} else {printf " %s",$i} }}'` + if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(I)='$listVar'" 1>&2 ; fi + for ii in 1 2 3 4 5 6 7 8 9 ; do + tst=`eval 'echo "$HAVE_PTR0'$ii'"'` + #echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2 + if test "x$tst" != xt ; then listVar=`echo "$listVar" | sed "s/ pt$ii..//g"` ; fi + done + tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){t+=($i==$1)}; print t }'` + if test $tst != 1 ; then + if test $tst = 0 ; then echo "==> WARNING: selected var >$sVar< not found" 1>&2 + else echo "==> WARNING: found selected var >$sVar< $tst times" 1>&2 ; fi + echo "==> WARNING: in checked list:" $listVar 1>&2 + #- put it back once: + listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"` + fi + if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(M)='$listVar'" 1>&2 ; fi + echo "listVar='$listVar'" > $CDIR"/summary.txt" + allargs="" + for xx in $listVar + do + case $xx in + 'PS') if [ $debug -gt 0 ] + then echo testoutput_run: testoutput_var $1 cg2d_init_res 1>&2 ; fi + testoutput_var $1 "cg2d_init_res" "cg2d init. residual" $2 $3; yy=$? + if [ $debug -gt 0 ] ; then echo testoutput_run: cg2dres=$yy 1>&2 ; fi ;; + 'Tmn') testoutput_var $1 "dynstat_theta_min" "theta minimum" $2 $3; yy=$? ;; + 'Tmx') testoutput_var $1 "dynstat_theta_max" "theta maximum" $2 $3; yy=$? ;; + 'Tav') testoutput_var $1 "dynstat_theta_mean" "theta mean" $2 $3; yy=$? ;; + 'Tsd') testoutput_var $1 "dynstat_theta_sd" "theta s.d." $2 $3; yy=$? ;; + 'Smn') testoutput_var $1 "dynstat_salt_min" "salt minimum" $2 $3; yy=$? ;; + 'Smx') testoutput_var $1 "dynstat_salt_max" "salt maximum" $2 $3; yy=$? ;; + 'Sav') testoutput_var $1 "dynstat_salt_mean" "salt mean" $2 $3; yy=$? ;; + 'Ssd') testoutput_var $1 "dynstat_salt_sd" "salt s.d." $2 $3; yy=$? ;; + 'Umn') testoutput_var $1 "dynstat_uvel_min" "U minimum" $2 $3; yy=$? ;; + 'Umx') testoutput_var $1 "dynstat_uvel_max" "U maximum" $2 $3; yy=$? ;; + 'Uav') testoutput_var $1 "dynstat_uvel_mean" "U mean" $2 $3; yy=$? ;; + 'Usd') testoutput_var $1 "dynstat_uvel_sd" "U s.d." $2 $3; yy=$? ;; + 'Vmn') testoutput_var $1 "dynstat_vvel_min" "V minimum" $2 $3; yy=$? ;; + 'Vmx') testoutput_var $1 "dynstat_vvel_max" "V maximum" $2 $3; yy=$? ;; + 'Vav') testoutput_var $1 "dynstat_vvel_mean" "V mean" $2 $3; yy=$? ;; + 'Vsd') testoutput_var $1 "dynstat_vvel_sd" "V s.d." $2 $3; yy=$? ;; + 'pt1mn'|'pt2mn'|'pt3mn'|'pt4mn'|'pt5mn') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'` + testoutput_var $1 "trcstat_ptracer0"$ii"_min" "p0"$ii"_min" $2 $3; yy=$? ;; + 'pt1mx'|'pt2mx'|'pt3mx'|'pt4mx'|'pt5mx') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'` + testoutput_var $1 "trcstat_ptracer0"$ii"_max" "p0"$ii"_max" $2 $3; yy=$? ;; + 'pt1av'|'pt2av'|'pt3av'|'pt4av'|'pt5av') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'` + testoutput_var $1 "trcstat_ptracer0"$ii"_mean" "p0"$ii"_mean" $2 $3; yy=$? ;; + 'pt1sd'|'pt2sd'|'pt3sd'|'pt4sd'|'pt5sd') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'` + testoutput_var $1 "trcstat_ptracer0"$ii"_sd" "p0"$ii"_sd" $2 $3; yy=$? ;; + *) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;; + esac + if test $xx = $sVar + then allargs="$allargs > $yy <" + else allargs="$allargs $yy" + fi + done + + nbVar=`echo $listVar | awk '{print NF}'` + if [ $nbVar -lt $nbDef ] ; then + #-- fill line (up to standard length) with dot: + adNul=`expr $nbDef - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'` + echo $allargs $adNul + else + echo $allargs + fi else testoutput_ad $1 $2 "precision_grdchk_result" @@ -316,6 +345,16 @@ if test "x$MPI" = xt ; then command="$command -mpi" fi + if test "x$TS" = xt ; then + command="$command -ts" + fi + if test "x$PAPIS" = xt ; then + command="$command -papis" + else + if test "x$PCLS" = xt ; then + command="$command -pcls" + fi + fi printf 'genmake ... ' 1>&2 $command > make.log 2>&1 RETVAL=$? @@ -341,7 +380,7 @@ else ( cd $1; - #if test -e output.txt ; then rm -f output.txt ; fi + #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi if test -r Makefile ; then printf 'clean build-dir: make Clean ... ' 2>&1 $MAKE Clean >> make.log 2>&1 @@ -536,41 +575,48 @@ printf 'runmodel in %s ...' $1 1>&2 # make output.txt echo - rm -f run.log if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then - echo " link" $EXECUTABLE "from dir ../"$builddir > run.log + echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 ln -sf "../"$builddir"/"$EXECUTABLE . - else - touch run.log fi if test ! -x $EXECUTABLE ; then + rm -f run.log ; touch run.log + if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi echo " no executable:" $EXECUTABLE >> run.log RETVAL=8 + ENDVAL=-1 else if test $OUTPUTFILE -ot $EXECUTABLE ; then + rm -f run.log ; touch run.log + if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi ( eval $COMMAND ) >> run.log 2>&1 RETVAL=$? else - echo " $OUTPUTFILE is up to date " >> run.log 2>&1 RETVAL=0 + if test -f run.log ; then + if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi + echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 + else + touch run.log + if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi + echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 + echo " no previous run.log: assume NORMAL END" >> run.log 2>&1 + fi fi + ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'` fi - # echo "COMMAND='$COMMAND'" - # echo "pwd='"`pwd`"'" - if test "x$RETVAL" = x0 ; then + rm -f run.log_00 + #if test "x$RETVAL" = x0 ; then + if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then tail run.log echo successful 1>&2 # === Reduce the size of the testing emails! - # if test "x$ADM" = x ; then - # cp output.txt $CDIR"/output.txt" - # else - # cp output_adm.txt $CDIR"/output_adm.txt" - # fi + #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi return 0 else tail run.log - echo failed 1>&2 + echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2 cp run.log $CDIR"/run.log" if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi return 1 @@ -583,11 +629,11 @@ # create codelet for comparing model output printf "creating the comparison code... " - cat > tmp_cmpnum.c < tr_cmpnum.c < #include int main( int argc, char** argv ) { - int linnum,best,lncnt; + int linnum,cmplin,best,lncnt; double a,b,abave,relerr; best = -22; lncnt = 0; @@ -596,21 +642,28 @@ if (linnum == -1) break; scanf("%lf", &a); scanf("%lf", &b); abave = 0.5*(fabs(a)+fabs(b)); - if (abave > 0.0) { - relerr=fabs(a-b)/abave; - if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); } - else { linnum = -16 ; } - best = (best > linnum) ? best : linnum; - } + if ( abave == abave ) { + if (abave > 0.0) { + relerr=fabs(a-b)/abave; + if (relerr > 0.0) { cmplin = (int)rint(log10(relerr)); } + else { cmplin = -16 ; } + best = (best > cmplin) ? best : cmplin; } + else { cmplin = -22 ; } + /* printf("%d ; %lf ; %lf\n",cmplin,a,b); */ + } + else { + /* printf("%lf ; %lf ; %lf\n",abave,a,b); */ + break; } } if (lncnt == 999) best=-29; + if (linnum != -1) best=-99; printf("%d\n", -best); return 0; } EOF - $CC -o tmp_cmpnum tmp_cmpnum.c -lm + $CC -o tr_cmpnum tr_cmpnum.c -lm - if [ -x ./tmp_cmpnum ]; then + if [ -x ./tr_cmpnum ]; then echo "OK" return 0 else @@ -628,12 +681,20 @@ nm=$1 printf '%s %s %s %s' $2 $3 $4 $5 shift; shift; shift; shift; shift; - printf '%3s' $@ + listPrt=$@ + listRes=`echo $listPrt | sed 's/>//' | sed 's///' | sed 's/<.*//' | awk '{print $1}'` +# printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < / / /' | sed 's/ < / /' - if [ $1 = '--' ]; then + if [ $xx = '..' ]; then + printf ' N/O ' + elif [ $xx = '--' ]; then + printf ' N/O ' + elif [ $xx = 99 ]; then printf ' N/O ' else - if [ $1 -gt 12 ]; then + if [ $xx -ge $MATCH_CRIT ]; then printf ' pass' else printf ' FAIL' @@ -644,25 +705,6 @@ } -show_help() -{ - cat - << EOF -$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] - - -help|-h Show this help message - -quiet Reduce the amount of output - -verbose Produce copious amounts of output - -debug Produce even more output which will mean nothing to most - -force Do "make CLEAN" before compiling. This forces a complete rebuild. - -clean Do "make CLEAN" after compiling and testing. - -cleanup Aggresively removes all model output, executables and object files - and then exits. Use with care. - -Normal usage: - $0 * Configure, compile, run and analyze in all experiment directories -EOF -} - scandirs() { if [ $# -eq 1 ]; then @@ -702,6 +744,7 @@ OPTFILE=NONE ADDRESSES= TESTDIRS= +SKIPDIRS= MPACKDIR="../tools/mpack-1.6" HAVE_MPACK= MPACK="$MPACKDIR/mpack" @@ -723,6 +766,8 @@ # Additional monitor types PTRACERS_NUM="1 2 3 4 5" +MATCH_CRIT=13 + printf "parsing options... " ac_prev= @@ -757,6 +802,11 @@ -tdir=* | --tdir=*) TESTDIRS=$ac_optarg ;; + -skipdir | --skipdir | -skd | --skd) + ac_prev=SKIPDIRS ;; + -skipdir=* | --skipdir=*) + SKIPDIRS=$ac_optarg ;; + -bash | --bash | -b | --b) ac_prev=BASH ;; -bash=* | --bash=*) @@ -782,6 +832,9 @@ -ptracers=* | --ptracers=* | -ptr=* | --ptr=*) PTRACERS_NUM=$ac_optarg ;; + -match | --match ) ac_prev=MATCH_CRIT ;; + -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;; + -j) ac_prev=JOBS ;; -j=*) JOBS=$ac_optarg ;; @@ -815,6 +868,12 @@ -deldir | -dd) DELDIR=t ;; + -ts) TS=t;; + + -papis) PAPIS=t;; + + -pcls) PCL=t;; + -*) echo "Error: unrecognized option: "$ac_option usage @@ -837,9 +896,9 @@ if test "x$TESTDIRS" = x ; then if test "x$ADM" = xt ; then - TESTDIRS=`scandirs results_ad` + LIST=`scandirs results_ad` else - TESTDIRS=`scandirs results` + LIST=`scandirs results` fi else #- expand group of experiments: @@ -856,19 +915,28 @@ *) LIST=${LIST}" "$xx ;; esac done - #echo 'LIST='${LIST}'<' - #- remove duplicate and non-directory: - TESTDIRS=" " - for xx in $LIST - do +fi +#echo 'LIST='${LIST}'<' +#- skip dirs, remove duplicate and non-directory: +TESTDIRS=" " +count=0 +for xx in $LIST +do + yy=`echo $SKIPDIRS | grep -c $xx` + if test $yy = 0 ; then if test -d $xx ; then yy=`echo $TESTDIRS | grep -c $xx` if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi - else - echo " -- skip \"$xx\" : not a directory !" + else count=1 ; + echo ""; echo -n " -- skip \"$xx\" (not a directory !)" fi - done -fi + else + if test $count = 1 ; then echo -n ", \"$xx\"" + else count=1 ; echo "" ; echo -n " skip: \"$xx\"" + fi + fi +done +if test $count = 1 ; then echo "" ; echo -n " ... " ; fi #echo 'TESTDIRS='${TESTDIRS}'<' if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then @@ -883,17 +951,28 @@ OUTPUTFILE="output.txt" fi -if test "x$ADM" = xt -a "x$COMMAND" = x ; then - COMMAND="./$EXECUTABLE > $OUTPUTFILE" -fi - if test "x$COMMAND" = x ; then COMMAND="./$EXECUTABLE > $OUTPUTFILE" fi +if test "x$MPI" = xt ; then + OUTPUTFILE="STDOUT.0000" +fi #echo "OK" echo "OK (COMMAND= $COMMAND )" +# set the Default List of output variables to be checked: +# (use default or load experiment-specific list from file "tr_checklist") +# content : 1rst = main variable used to decide if it pass or FAIL +# others = number of matching digits to be printed in summary.txt +if test "x$ADM" != xt ; then + DEF_CHECK_LIST='PS PS T+ S+ U+ V+ pt1+ pt2+ pt3+ pt4+ pt5+' + EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..' + nbDef=`echo $DEF_CHECK_LIST | awk '{print NF-1+3*gsub("+","E")}'` + ii=`echo $EMPTY_RESULTS | awk '{print NF}'` + EMPTY_RESULTS=$EMPTY_RESULTS`expr $nbDef - $ii | awk 'BEGIN{FS=":"}{for(i=1;i<=$1;i++){printf " ."}}'` +fi + # create the FORTRAN comparison code createcodelet @@ -957,7 +1036,11 @@ echo echo >> $SUMMARY if test "x$ADM" = x ; then - line_0=" ----T----- ----S----- ----U----- ----V-----" + if [ $MATCH_CRIT -lt 10 ] ; + then line_0="default "$MATCH_CRIT ; + else line_0="default "$MATCH_CRIT ; fi + line_0="$line_0 ----T----- ----S----- ----U----- ----V-----" +# line_0=" ----T----- ----S----- ----U----- ----V-----" line_1="G D M c m s m s m s m s" line_2="E p a R g m m e . m m e . m m e . m m e ." line_3="N n k u 2 i a a d i a a d i a a d i a a d" @@ -1086,7 +1169,7 @@ fi echo unset genmake makedepend make run - results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' + results=$EMPTY_RESULTS # Create an output dir for each OPTFILE/tdir combination rel_CDIR=$DRESULTS"/"$dir @@ -1106,7 +1189,7 @@ && makemodel $dir/$builddir && make=Y \ && linkdata $dir/$rundir $input_dirs \ && runmodel $dir/$rundir && run=Y \ - && results=`testoutput $dir $rundir "txt"` + && results=`testoutput_run $dir $rundir "txt"` fi echo @@ -1114,7 +1197,8 @@ fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` echo echo "$fres" >> $SUMMARY - echo "fresults='$fres'" > $CDIR"/summary.txt" + touch $CDIR"/summary.txt" + echo "fresults='$fres'" >> $CDIR"/summary.txt" echo "MACH='$MACH'" >> $CDIR"/summary.txt" echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" echo "DATE='$DATE'" >> $CDIR"/summary.txt" @@ -1122,7 +1206,7 @@ for ex in $extra_runs ; do unset run - results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' + results=$EMPTY_RESULTS # Create an output dir for each OPTFILE/tdir.ex combination rel_CDIR=$DRESULTS"/"$dir"."$ex mkdir $rel_CDIR @@ -1131,13 +1215,14 @@ run_clean $dir/tr_run.$ex linkdata $dir/tr_run.$ex input.$ex input runmodel $dir/tr_run.$ex && run=Y \ - && results=`testoutput $dir tr_run.$ex ${ex}".txt"` + && results=`testoutput_run $dir tr_run.$ex ${ex}".txt"` fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` fres="$fres.$ex" echo echo "$fres" >> $SUMMARY - echo "fresults='$fres'" > $CDIR"/summary.txt" + touch $CDIR"/summary.txt" + echo "fresults='$fres'" >> $CDIR"/summary.txt" echo "MACH='$MACH'" >> $CDIR"/summary.txt" echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" echo "DATE='$DATE'" >> $CDIR"/summary.txt" @@ -1151,7 +1236,8 @@ fres=$fres"$results $dir" echo echo "$fres" >> $SUMMARY - echo "fresults='$fres'" > $CDIR"/summary.txt" + touch $CDIR"/summary.txt" + echo "fresults='$fres'" >> $CDIR"/summary.txt" echo "MACH='$MACH'" >> $CDIR"/summary.txt" echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" echo "DATE='$DATE'" >> $CDIR"/summary.txt" @@ -1202,15 +1288,14 @@ fi fi -# rm -f tmp_cmpnum.f a.out -rm -f tmp_cmpnum.c tmp_cmpnum +rm -f tr_cmpnum.c tr_cmpnum if test "x$CLEANUP" != xt ; then - cat $SUMMARY | sed 's/ -- -- -- --//g' + cat $SUMMARY | sed 's/ \. \. \. \. \. \. \. \. \. \. \. \.//' if test -e tr_out.txt ; then mv tr_out.txt tr_out.txt.old fi - cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt + cat $SUMMARY | sed '11,$ s/ \.//g' > tr_out.txt fi if test "x$DELDIR" = xt ; then