--- MITgcm/verification/testreport 2012/08/15 23:19:21 1.175 +++ MITgcm/verification/testreport 2013/07/19 18:49:33 1.188 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.175 2012/08/15 23:19:21 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.188 2013/07/19 18:49:33 jmc Exp $ # $Name: $ # @@ -322,9 +322,12 @@ 'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $refoutp ; yy=$? ;; 'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South" $2 $refoutp ; yy=$? ;; 'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North" $2 $refoutp ; yy=$? ;; - 'HthSiG') testoutput_var $1 "thSI_IceH_ave_G" "thSIc H Global" $2 $refoutp ; yy=$? ;; - 'HthSiS') testoutput_var $1 "thSI_IceH_ave_S" "thSIc H South" $2 $refoutp ; yy=$? ;; - 'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North" $2 $refoutp ; yy=$? ;; + 'HthSiG') testoutput_var $1 "thSI_IceH_ave_G" "thSIc H Glob-ave" $2 $refoutp ; yy=$? ;; + 'HthSiS') testoutput_var $1 "thSI_IceH_ave_S" "thSIc H South-av" $2 $refoutp ; yy=$? ;; + 'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North-av" $2 $refoutp ; yy=$? ;; + 'HthMxS') testoutput_var $1 "thSI_IceH_max_S" "thSIc H South-max" $2 $refoutp ; yy=$? ;; + 'HthMxN') testoutput_var $1 "thSI_IceH_max_N" "thSIc H North-max" $2 $refoutp ; yy=$? ;; + 'StrmIc') testoutput_var $1 "STREAMICE_FP_ERR" "StreamIce Solver" $2 $refoutp ; yy=$? ;; *) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;; esac if test $xx = $sVar @@ -467,6 +470,7 @@ rm -f $RUNLOG *.txt STD* w2_tile_topology.????.log *diagnostics.log datetime rm -rf mnc_test_* rm -f *_MIT_CE_000.opt0000 costfunction*0000 + rm -f oad_cp.000.[0-9][0-9][0-9][0-9][0-9] echo successful exit 0 ) @@ -534,11 +538,18 @@ mk_fail=2 fi fi + if test $KIND = 1 -a -f taf_ftl.log ; then + head -1 taf_ftl.log >> $CDIR"/summary.txt" + fi if test $KIND = 2 -a -f taf_ad.log ; then - head -1 taf_ad.log >> $CDIR"/summary.txt" - nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log` - nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log` - echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \ + head -1 taf_ad.log >> $CDIR"/summary.txt" + nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log` + nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log` + if test -f taf_output ; then + n2er=`grep -c 'TAF *.* ERROR ' taf_output` + nerr=`expr $nerr + $n2er` + fi + echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \ >> $CDIR"/summary.txt" fi if test $mk_fail != 0 ; then return $mk_fail ; fi @@ -785,6 +796,23 @@ # output do not exist or is older than executable: rm -f $OUTPUTFILE $RUNLOG ; touch $RUNLOG if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi + #- Divided Adjoint Run: + # get the number of additional runs (add_DIVA_runs) from file "run_ADM_DIVA" + if test $KIND = 2 -a -f run_ADM_DIVA ; then + adm_diva_nb=`sed -n '/^ *add_DIVA_runs\>.*=/p' run_ADM_DIVA | sed 's/ //g'` + echo " Divided Adjoint Run: $adm_diva_nb" >> $RUNLOG + eval "let $adm_diva_nb" + if [ $add_DIVA_runs -ge 1 ] ; then + rm -f costf* divided.ctrl snapshot* + echo -n "(add_DIVA_runs=$add_DIVA_runs) ... " + for ii in `seq 1 $add_DIVA_runs` ; do + ( eval $COMMAND ) >> $RUNLOG 2>&1 + echo " additional DIVA run # $ii : done" >> $RUNLOG + mv -f $OUTPUTFILE ${OUTPUTFILE}.diva_${ii} + done + fi + fi + #- special DIVA processing ends here ( eval $COMMAND ) >> $RUNLOG 2>&1 RETVAL=$? ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'` @@ -802,13 +830,12 @@ fi fi rm -f run.log_tmp - #- in all cases where OutputFile exists, report SIZE (and AD time) + #- in all cases where OutputFile exists, report SIZE and time if test -f $OUTPUTFILE ; then grep '(PID\.TID 0000\.0001) n.. =' $OUTPUTFILE \ - | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" - if test $KIND = 2 ; then - grep -A3 'Seconds in section "ALL' $OUTPUTFILE >> $CDIR"/summary.txt" - fi + | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" + grep -A3 'Seconds in section "ALL' $OUTPUTFILE \ + | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" fi if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then @@ -910,6 +937,13 @@ fi fi printf ' %s' $nm + if test $KIND = 2 ; then + #-- apppend taf repport summary: + tafrep=`grep -c '^ TAF reports ' $CDIR/summary.txt` + if test $tafrep = 1 ; then + grep '^ TAF reports ' $CDIR/summary.txt | awk '{printf " (e=%i, w=%i)",$3,$6}' + fi + fi printf '\n' } @@ -1278,7 +1312,7 @@ fi # create the FORTRAN comparison code -if test -x tr_cmpnum ; then +if test "x$CLEANUP" = xt -o -x tr_cmpnum ; then echo "skipping comparison code build" else createcodelet @@ -1294,8 +1328,12 @@ # Create a uniquely named directory to store results CMDLINE=$0 for xx in "$@" ; do nw=`echo $xx | wc -w` - if test $nw = '1' ; then CMDLINE="$CMDLINE $xx" - else CMDLINE="$CMDLINE '$xx'" ; fi + if test $nw = '1' ; then CMDLINE="$CMDLINE $xx" ; else + nb=`echo $xx | grep -c '='` + if test $nb = 0 ; then CMDLINE="$CMDLINE '$xx'" + else yy=`echo "$xx'" | sed "s/=/='/"` ; + CMDLINE="$CMDLINE $yy" ; fi + fi done #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done MACH=`hostname` @@ -1342,8 +1380,8 @@ echo >> $SUMMARY echo " OPTFILE=$OPTFILE" >> $SUMMARY else - echo | tee $SUMMARY - echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY + echo | tee -a $SUMMARY + echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee -a $SUMMARY exit 1 fi else @@ -1370,11 +1408,20 @@ else line_0=`printf '%s %2i' 'default ' $MATCH_CRIT` if test $KIND = 1 ; then - echo "TANGLIN=true" >> $SUMMARY + #echo "TANGLIN=true" >> $SUMMARY + echo "TangLin generated by TAF" >> $SUMMARY + elif test $KIND = 3 ; then + echo "TangLin generated by OpenAD" >> $SUMMARY + elif test $KIND = 2 ; then + #echo "ADJOINT=true" >> $SUMMARY + echo "Adjoint generated by TAF" >> $SUMMARY + else + echo "Adjoint generated by OpenAD" >> $SUMMARY + fi + if test $KIND = 1 -o $KIND = 3 ; then line_1="G D M C T F" line_2="e p a R o L D" else - echo "ADJOINT=true" >> $SUMMARY line_1="G D M C A F" line_2="e p a R o d D" fi @@ -1382,12 +1429,14 @@ line_4="2 d e n t r r" echo >> $SUMMARY fi +if test "x$CLEANUP" != xt ; then echo "$line_0" | tee -a $SUMMARY echo "$line_1" | tee -a $SUMMARY echo "$line_2" | tee -a $SUMMARY echo "$line_3" | tee -a $SUMMARY echo "$line_4" | tee -a $SUMMARY echo "" | tee -a $SUMMARY +fi echo "-------------------------------------------------------------------------------" # ...and each test directory... @@ -1496,14 +1545,13 @@ # Check whether there are "extra runs" for this testdir extra_runs= if test "x$NORUN" = xf ; then - ex_run_dirs=`( cd $dir ; echo $inputdir.* )` + ex_run_dirs=`( cd $dir ; ls -d $inputdir.* 2> /dev/null )` fi #echo "ex_run_dirs='$ex_run_dirs'" for exd in $ex_run_dirs ; do name=`echo $exd | sed -e "s/$inputdir\.//"` refExOut=`echo $ref_outp | sed "s/\./.${name}./"` outf="$dir/results/$refExOut" - #if test -f $outf -a -r $outf ; then if test -r $outf -o -r ${outf}.gz ; then if test "x$MULTI_THREAD" = "xt" ; then if test -r $dir"/"$exd"/eedata.mth" ; then @@ -1587,8 +1635,7 @@ linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir runmodel $dir/$pfxdir.$ex && run=Y \ && results=`testoutput_run $dir $pfxdir.$ex $refExOut` - fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` - fres="$fres.$ex" + fres=`formatresults $dir.$ex ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` echo 1>&2 echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /> $SUMMARY echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt" @@ -1597,7 +1644,7 @@ fi done - if test -f $DRESULTS"/"genmake_state ; then : ; else + if test ! -f $DRESULTS"/"genmake_state ; then if test -f $dir/$builddir/Makefile ; then mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'` echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state @@ -1606,24 +1653,31 @@ if test "x$OPTFILE" = xNONE ; then eval $mkOpt sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ - $SUMMARY > tr_0.tmp_log + $SUMMARY > tmp.tr_log RETVAL=$? if test "x$RETVAL" = x0 ; then rm -f $SUMMARY - cp tr_0.tmp_log $SUMMARY - else rm -f tr_0.tmp_log + cp tmp.tr_log $SUMMARY + else rm -f tmp.tr_log fi fi gmkLog=$dir/$builddir/genmake.log - grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1 - RETVAL=$? - if test "x$RETVAL" = x0 ; then - echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state - sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \ - | grep -v '^... compiler version ' > tr_1.tmp_log - sed -n '1p' tr_1.tmp_log >> $DRESULTS/genmake_state - sed -n '2,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \ - >> $DRESULTS/genmake_state - rm -f tr_1.tmp_log + if test -r $gmkLog ; then + grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1 + RETVAL=$? + if test "x$RETVAL" = x0 ; then + echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state + echo "extract compiler version:" >> $DRESULTS/genmake_state + sed -n '/Get compiler version/,/<-- compiler version/p' \ + $gmkLog | grep -v '^... compiler version ' > tmp.tr_log + sed -n '1p' tmp.tr_log >> $DRESULTS/genmake_state + sed -n '2,/^$/p' tmp.tr_log | sed '/^$/d' | sed 's/^./ &/' \ + >> $DRESULTS/genmake_state + rm -f tmp.tr_log + fi + echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state + echo "get NETCDF & LAPACK settings:" >> $DRESULTS/genmake_state + sed -n '/set HAVE_NETCDF=/p' $gmkLog >> $DRESULTS/genmake_state + sed -n '/set HAVE_LAPACK=/p' $gmkLog >> $DRESULTS/genmake_state fi fi fi @@ -1685,3 +1739,4 @@ if test "x$DELDIR" = xt ; then rm -rf $DRESULTS fi +echo "======== End of testreport execution ========"