--- MITgcm/verification/testreport 2006/08/29 00:18:35 1.88 +++ MITgcm/verification/testreport 2007/09/05 16:09:31 1.93 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.88 2006/08/29 00:18:35 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.93 2007/09/05 16:09:31 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,15 +94,16 @@ echo "OK" } -testoutput_for_prop() +testoutput_var() { - # testoutput_for_prop dir s1 label subdir extension + # testoutput_var dir s1 label subdir extension # - # compares files $dir/$subdir/$OUTPUTFILE 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/$OUTPUTFILE 1>&2 + echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 fi if [ -r $1/$4/$OUTPUTFILE ]; then grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt @@ -107,11 +115,11 @@ return 99 fi else - echo testoutput_for_prop: $OUTPUTFILE 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: $OUTPUTFILE 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: $OUTPUTFILE 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 @@ -191,8 +199,8 @@ 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,35 +230,35 @@ 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 + echo testoutput_run: testoutput_var $1 cg2d_init_res 1>&2 fi - testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$? + testoutput_var $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$? if [ $debug -gt 0 ]; then - echo testoutput: cg2dres=$cg2dres 1>&2 + echo testoutput_run: 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=$? + testoutput_var $1 "dynstat_theta_min" "theta minimum" $2 $3; tmin=$? + testoutput_var $1 "dynstat_theta_max" "theta maximum" $2 $3; tmax=$? + testoutput_var $1 "dynstat_theta_mean" "theta mean" $2 $3; tmean=$? + testoutput_var $1 "dynstat_theta_sd" "theta s.d." $2 $3; tsd=$? + testoutput_var $1 "dynstat_salt_min" "salt minimum" $2 $3; smin=$? + testoutput_var $1 "dynstat_salt_max" "salt maximum" $2 $3; smax=$? + testoutput_var $1 "dynstat_salt_mean" "salt mean" $2 $3; smean=$? + testoutput_var $1 "dynstat_salt_sd" "salt s.d." $2 $3; ssd=$? + testoutput_var $1 "dynstat_uvel_min" "U minimum" $2 $3; umin=$? + testoutput_var $1 "dynstat_uvel_max" "U maximum" $2 $3; umax=$? + testoutput_var $1 "dynstat_uvel_mean" "U mean" $2 $3; umean=$? + testoutput_var $1 "dynstat_uvel_sd" "U s.d." $2 $3; usd=$? + testoutput_var $1 "dynstat_vvel_min" "V minimum" $2 $3; vmin=$? + testoutput_var $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$? + testoutput_var $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? + testoutput_var $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$? # This is for PTRACERS for ii in $PTRACERS_NUM ; do @@ -262,13 +270,13 @@ #echo 'tst = '$tst if test "x$tst" = xt ; then a="trcstat_ptracer0" - testoutput_for_prop $1 "$a"$ii"_min" "p0"$ii"_min" $2 $3 + testoutput_var $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 + testoutput_var $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 + testoutput_var $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 + testoutput_var $1 "$a"$ii"_sd" "p0"$ii"_sd" $2 $3 RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL` fi done @@ -316,6 +324,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=$? @@ -590,11 +608,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; @@ -603,21 +621,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 @@ -640,7 +665,7 @@ if [ $1 = '--' ]; then printf ' N/O ' else - if [ $1 -gt 12 ]; then + if [ $1 -ge $MATCH_CRIT ]; then printf ' pass' else printf ' FAIL' @@ -651,25 +676,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 @@ -709,6 +715,7 @@ OPTFILE=NONE ADDRESSES= TESTDIRS= +SKIPDIRS= MPACKDIR="../tools/mpack-1.6" HAVE_MPACK= MPACK="$MPACKDIR/mpack" @@ -730,6 +737,8 @@ # Additional monitor types PTRACERS_NUM="1 2 3 4 5" +MATCH_CRIT=13 + printf "parsing options... " ac_prev= @@ -764,6 +773,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=*) @@ -789,6 +803,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 ;; @@ -822,6 +839,12 @@ -deldir | -dd) DELDIR=t ;; + -ts) TS=t;; + + -papis) PAPIS=t;; + + -pcls) PCL=t;; + -*) echo "Error: unrecognized option: "$ac_option usage @@ -844,9 +867,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: @@ -863,19 +886,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 @@ -963,7 +995,11 @@ echo echo >> $SUMMARY if test "x$ADM" = x ; then - line_0=" ----T----- ----S----- ----U----- ----V-----" + if [ $MATCH_CRIT -lt 10 ] ; + then line_0=" "$MATCH_CRIT ; + else line_0=" "$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" @@ -1112,7 +1148,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 @@ -1137,7 +1173,7 @@ 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" @@ -1208,8 +1244,7 @@ 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'