--- MITgcm/verification/testreport 2007/01/31 21:28:34 1.90 +++ MITgcm/verification/testreport 2007/09/05 01:46:37 1.92 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.90 2007/01/31 21:28:34 ce107 Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.92 2007/09/05 01:46:37 jmc Exp $ # $Name: $ # @@ -35,6 +35,8 @@ echo " (DEF=\"hostname\")" 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\"" @@ -155,7 +157,7 @@ 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 @@ -196,8 +198,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 } @@ -605,11 +607,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; @@ -618,21 +620,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 @@ -655,7 +664,7 @@ if [ $1 = '--' ]; then printf ' N/O ' else - if [ $1 -gt 12 ]; then + if [ $1 -ge $MATCH_CRIT ]; then printf ' pass' else printf ' FAIL' @@ -727,6 +736,8 @@ # Additional monitor types PTRACERS_NUM="1 2 3 4 5" +MATCH_CRIT=13 + printf "parsing options... " ac_prev= @@ -791,6 +802,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 ;; @@ -980,7 +994,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" @@ -1225,8 +1243,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'