--- MITgcm/verification/testreport 2007/12/13 18:28:41 1.109 +++ MITgcm/verification/testreport 2008/08/19 18:29:12 1.117 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.109 2007/12/13 18:28:41 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.117 2008/08/19 18:29:12 jmc Exp $ # $Name: $ # @@ -19,6 +19,8 @@ echo " (-of=|-optfile=)STRING list of optfiles to use" echo " (-a|-addr) STRING list of email recipients" echo " (DEF=\"\" no email is sent)" + echo " (-mpd|-mpackdir) DIR location of the mpack utility" + echo " (DEF=\"../tools/mpack-1.6\")" echo " (-t|-tdir) STRING list of group and/or exp. dirs to test" echo " (recognized groups: basic, tutorials)" echo " (DEF=\"\" which test all)" @@ -65,7 +67,8 @@ build_mpack() { printf "building the mpack utility... " - if test ! -x "$MPACKDIR/mpack" ; then + MPACK="$MPACKDIR/mpack" + if test ! -x $MPACK ; then if test ! -d $MPACKDIR ; then echo echo "Error: can't find \"$MPACKDIR\"" @@ -74,10 +77,10 @@ echo HAVE_MPACK=f fi - printf "building mpack... " if test "x$CC" = x ; then export CC=cc fi + printf "building mpack (using CC=$CC)... " ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1 RETVAL=$? if test "x$RETVAL" != x0 ; then @@ -88,11 +91,12 @@ else rm -f tr_build_mpack.out HAVE_MPACK=t + echo "done" fi else HAVE_MPACK=t + echo "already exist" fi - echo "OK" } testoutput_var() @@ -175,31 +179,6 @@ return $digits_of_similarity } -check_for_add_mon_output() -{ - # Check for additional types of monitor output - if test "x$1" = x ; then - return - fi - - for ii in $PTRACERS_NUM ; do - eval "HAVE_PTR0"$ii"=f" - done - - ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max" - ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd" - for ii in $PTRACERS_NUM ; do - for jj in $ptr_add ; do - name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"` - tst=`grep $name $1 | wc -l | awk '{print $1}'` - if test ! "x$tst" = x0 ; then - eval "HAVE_PTR0"$ii"=t" - fi - done - # eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' - done -} - testoutput_run() { # testoutput_run directory subdir reference_output @@ -217,12 +196,30 @@ listVar=`echo $listChk | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' \ | sed 's/+//g' | sed "s/^$sVar//"` 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 }'` + # check for ptracer output in reference_output file : + outpref=$1/results/$3 + ptr_mon="trcstat_ptracerXX_min trcstat_ptracerXX_max" + ptr_mon="$ptr_mon trcstat_ptracerXX_mean trcstat_ptracerXX_sd" + for ii in $PTRACERS_NUM ; do + ptrfound=0 + for jj in $ptr_mon ; do + name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"` + tst=`grep $name $outpref | wc -l | awk '{print $1}'` + if test ! "x$tst" = x0 ; then ptrfound=1 ; fi + done + if test $ptrfound = '1' ; then + eval "HAVE_PTR0"$ii"=t" + else + eval "HAVE_PTR0"$ii"=f" + if test "x$ADM" = x ; then + # remove this ptr from the list of output variable to check + # echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2 + listVar=`echo "$listVar" | sed "s/ pt$ii..//g"` + fi + fi + # eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' 1>&2 + done + tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){if($i==$1)t+=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 @@ -474,7 +471,7 @@ CODE_DIR=$dir/$code_dir # These are files that should replace their counter-part when using -mpi - MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")` + MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)` # Is this an MPI run? if test "x$MPI" = xt ; then @@ -625,7 +622,7 @@ { # create codelet for comparing model output - printf "creating the comparison code... " + printf "creating the comparison code (using CC=$CC)... " cat > tr_cmpnum.c < #include @@ -743,7 +740,7 @@ SKIPDIRS= MPACKDIR="../tools/mpack-1.6" HAVE_MPACK= -MPACK="$MPACKDIR/mpack" +MPACK= COMMAND= if test "x$MAKE" = x ; then MAKE=make @@ -759,7 +756,7 @@ ADM= -# Additional monitor types +# list of pTracers to check for monitor output PTRACERS_NUM="1 2 3 4 5" MATCH_CRIT=13 @@ -792,6 +789,10 @@ ac_prev=ADDRESSES ;; -addr=* | --addr=*) ADDRESSES=$ac_optarg ;; + -mpackdir | --mpackdir | -mpd | --mpd) + ac_prev=MPACKDIR ;; + -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) + MPACKDIR=$ac_optarg ;; -tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;; @@ -978,14 +979,16 @@ # create the FORTRAN comparison code createcodelet -# build the mpack utility -if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then +# build the mpack utility (if ADDRESSES = NONE, do it to test the build) +if test "x$ADDRESSES" = x ; then echo "skipping mpack build" else build_mpack fi # Create a uniquely named directory to store results +CMDLINE=$0 +for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done MACH=`hostname` UNAMEA=`uname -a` DATE=`date +%Y%m%d` @@ -1006,9 +1009,10 @@ exit 1 fi SUMMARY="$DRESULTS/summary.txt" -printf "Start time: " >> $SUMMARY start_date=`date` echo $start_date > $SUMMARY +echo 'run:' $CMDLINE >> $SUMMARY +echo 'on :' $UNAMEA >> $SUMMARY of_path= if test "x$OPTFILE" != xNONE ; then @@ -1048,14 +1052,11 @@ line_3="N n k u 2 i a a d i a a d i a a d i a a d" line_4="2 d e n d n x n . n x n . n x n . n x n ." for ii in $PTRACERS_NUM ; do - # tst=`eval 'echo $HAVE_PTR0'$ii` - # if test "x$tst" = xt ; then line_0="$line_0 --PTR 0"$ii"--" line_1="$line_1 m s" line_2="$line_2 m m e ." line_3="$line_3 i a a d" line_4="$line_4 n x n ." - # fi done echo "$line_0" | tee -a $SUMMARY echo "$line_1" | tee -a $SUMMARY @@ -1095,7 +1096,7 @@ # Cleanup only! if test "x$CLEANUP" = xt ; then if test -r $BUILD_DIR/Makefile ; then - echo ' ------ clean dir:' $dir/build + echo ' ------ clean dir:' $dir/$builddir ( cd $BUILD_DIR ; make CLEAN ) fi if test -d $dir/$rundir/CVS ; then @@ -1116,11 +1117,8 @@ echo "can't read \"$fout\" -- skipping $dir" continue fi - if test "x$ADM" = x ; then - check_for_add_mon_output $fout - fi - # Check for additional types of monitor output + # Check for specific files for particular type of run if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" @@ -1244,7 +1242,7 @@ done printf "Start time: " >> $SUMMARY -echo $start_date >> $SUMMARY +echo "$start_date" >> $SUMMARY printf "End time: " >> $SUMMARY date >> $SUMMARY