/[MITgcm]/MITgcm/verification/testreport
ViewVC logotype

Diff of /MITgcm/verification/testreport

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.86 by jmc, Sun Jul 16 04:02:49 2006 UTC revision 1.91 by jmc, Wed Sep 5 00:07:25 2007 UTC
# Line 15  usage() Line 15  usage()
15      echo "  (-mpi)                   compile and run using MPI"      echo "  (-mpi)                   compile and run using MPI"
16      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
17      echo "                             (DEF=\"-ieee\")"      echo "                             (DEF=\"-ieee\")"
18      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-of=|-optfile=)STRING   list of optfiles to use"
19      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-a|-addr) STRING        list of email recipients"
20      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"edhill@mitgcm.org\")"
21      echo "  (-t|-tdir) STRING        list of group and/or exp. dirs to test"      echo "  (-t|-tdir) STRING        list of group and/or exp. dirs to test"
22      echo "                             (recognized groups: basic, tutorials)"      echo "                             (recognized groups: basic, tutorials)"
23      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
24        echo "  (-skd|-skipdir) STRING   list of exp. dirs to skip"
25        echo "                             (DEF=\"\" which test all)"
26      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"
27      echo "                             Bourne-compatible \"sh\" shell"      echo "                             Bourne-compatible \"sh\" shell"
28      echo "                             (DEF=\"\" for \"bash\")"      echo "                             (DEF=\"\" for \"bash\")"
# Line 31  usage() Line 33  usage()
33      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
34      echo "  (-odir) STRING           used to build output directory name"      echo "  (-odir) STRING           used to build output directory name"
35      echo "                             (DEF=\"hostname\")"      echo "                             (DEF=\"hostname\")"
36      echo "  (-ptracers|-ptr) STRING  specify which ptracers to test"      echo "  (-ptr|-ptracers) STRING  specify which ptracers to test"
37      echo "                             (DEF=\"1 2 3 4 5\")"      echo "                             (DEF=\"1 2 3 4 5\")"
38      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"
39      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\""
# Line 40  usage() Line 42  usage()
42      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-noclean|-nc)           skip the \"make clean\" stage"
43      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
44      echo "  (-deldir|-dd)            on success, delete the output directory"      echo "  (-deldir|-dd)            on success, delete the output directory"
45        echo "  (-ts)                    provide timing information per timestep"
46        echo "  (-papis)                 provide MFlop/s per timestep using PAPI"
47        echo "  (-pcls)                  provide MFlop/s per timestep using PCL"
48      echo      echo
49      echo "and where STRING can be a whitespace-delimited list"      echo "and where STRING can be a whitespace-delimited list"
50      echo "such as:"      echo "such as:"
# Line 91  testoutput_for_prop() Line 96  testoutput_for_prop()
96  {  {
97      # testoutput_for_prop dir s1 label subdir extension      # testoutput_for_prop dir s1 label subdir extension
98      #      #
99      #  compares files in $dir/$subdir/output.txt and $dir/results/output.txt      #  compares files $dir/$subdir/$OUTPUTFILE and $dir/results/output.txt
100      #  using search strings s1 and text label      #  using search strings s1 and text label
101    
102      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
103          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/$4/$OUTPUTFILE 1>&2
104      fi      fi
105      if [ -r $1/$4/output.txt ]; then      if [ -r $1/$4/$OUTPUTFILE ]; then
106          grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt          grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt
107          lncntA=`wc -l tmp1.txt | awk '{print $1}' `          lncntA=`wc -l tmp1.txt | awk '{print $1}' `
108          if [ $lncntA -lt 3 ]; then          if [ $lncntA -lt 3 ]; then
109              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
# Line 107  testoutput_for_prop() Line 112  testoutput_for_prop()
112              return 99              return 99
113          fi          fi
114      else      else
115          echo testoutput_for_prop: output.txt from model run was not readable 1>&2          echo testoutput_for_prop: $OUTPUTFILE from model run was not readable 1>&2
116          return 99          return 99
117      fi      fi
118      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
# Line 129  testoutput_for_prop() Line 134  testoutput_for_prop()
134      fi      fi
135      has_nan=`cat tmp1.txt | grep -i nan | wc -l`      has_nan=`cat tmp1.txt | grep -i nan | wc -l`
136      if [ $has_nan -gt 0  ] ; then      if [ $has_nan -gt 0  ] ; then
137          echo testoutput_for_prop: output.txt contains $has_nan NaN values  1>&2          echo testoutput_for_prop: $OUTPUTFILE contains $has_nan NaN values  1>&2
138          return 99          return 99
139      fi      fi
140      has_inf=`cat tmp1.txt | grep -i inf | wc -l`      has_inf=`cat tmp1.txt | grep -i inf | wc -l`
141      if [ $has_inf -gt 0  ] ; then      if [ $has_inf -gt 0  ] ; then
142          echo testoutput_for_prop: output.txt contains $has_inf Inf values  1>&2          echo testoutput_for_prop: $OUTPUTFILE contains $has_inf Inf values  1>&2
143          return 99          return 99
144      fi      fi
145      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
# Line 150  testoutput_for_prop() Line 155  testoutput_for_prop()
155      echo "-1" >> tmp3.txt      echo "-1" >> tmp3.txt
156      # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number      # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
157      cat tmp3.txt | sed -e 's|:||g' > tmp4.txt      cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
158      digits_of_similarity=`./tmp_cmpnum < tmp4.txt`      digits_of_similarity=`./tr_cmpnum < tmp4.txt`
159      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
160          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
161              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2
# Line 184  dashnum() Line 189  dashnum()
189  testoutput_ad()  testoutput_ad()
190  {  {
191      grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt      grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt
192      grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt      grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt
193      grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt      grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt
194      grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt      grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt
195      join t05.txt t15.txt > t5.txt      join t05.txt t15.txt > t5.txt
196      join t06.txt t16.txt > t6.txt      join t06.txt t16.txt > t6.txt
197      echo "-1" >> t5.txt      echo "-1" >> t5.txt
198      echo "-1" >> t6.txt      echo "-1" >> t6.txt
199      digits_5=`./tmp_cmpnum < t5.txt`      digits_5=`./tr_cmpnum < t5.txt`
200      digits_6=`./tmp_cmpnum < t6.txt`      digits_6=`./tr_cmpnum < t6.txt`
201      dashnum $digits_5 $digits_6      dashnum $digits_5 $digits_6
202      rm -f t[01][56].txt t[56].txt      rm -f t[01][56].txt t[56].txt
203  }  }
# Line 316  genmakemodel() Line 321  genmakemodel()
321              if test "x$MPI" = xt ; then              if test "x$MPI" = xt ; then
322                  command="$command -mpi"                  command="$command -mpi"
323              fi              fi
324                if test "x$TS" = xt ; then
325                    command="$command -ts"
326                fi
327                if test "x$PAPIS" = xt ; then
328                    command="$command -papis"
329                else
330                if test "x$PCLS" = xt ; then
331                    command="$command -pcls"
332                fi
333                fi
334              printf 'genmake ... ' 1>&2              printf 'genmake ... ' 1>&2
335              $command > make.log 2>&1              $command > make.log 2>&1
336              RETVAL=$?              RETVAL=$?
# Line 341  makeclean() Line 356  makeclean()
356      else      else
357          (          (
358              cd $1;              cd $1;
359              #if test -e output.txt ; then rm -f output.txt ; fi              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi
360              if test -r Makefile ; then              if test -r Makefile ; then
361                  printf 'clean build-dir: make Clean ... ' 2>&1                  printf 'clean build-dir: make Clean ... ' 2>&1
362                  $MAKE Clean >> make.log 2>&1                  $MAKE Clean >> make.log 2>&1
# Line 536  runmodel() Line 551  runmodel()
551          printf 'runmodel in %s ...' $1 1>&2          printf 'runmodel in %s ...' $1 1>&2
552          # make output.txt          # make output.txt
553          echo          echo
         rm -f run.log  
554          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
555              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00
556              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
         else  
             touch run.log  
557          fi          fi
558          if test ! -x $EXECUTABLE ; then          if test ! -x $EXECUTABLE ; then
559                    rm -f run.log ; touch run.log
560                    if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
561                  echo " no executable:" $EXECUTABLE >> run.log                  echo " no executable:" $EXECUTABLE >> run.log
562                  RETVAL=8                  RETVAL=8
563                    ENDVAL=-1
564          else          else
565              if test $OUTPUTFILE -ot $EXECUTABLE ; then              if test $OUTPUTFILE -ot $EXECUTABLE ; then
566                    rm -f run.log ; touch run.log
567                    if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
568                  ( eval $COMMAND ) >> run.log 2>&1                  ( eval $COMMAND ) >> run.log 2>&1
569                  RETVAL=$?                  RETVAL=$?
570              else              else
                 echo " $OUTPUTFILE is up to date " >> run.log 2>&1  
571                  RETVAL=0                  RETVAL=0
572                    if test -f run.log ; then
573                        if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
574                        echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1
575                    else
576                        touch run.log
577                        if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
578                        echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1
579                        echo " no previous run.log: assume NORMAL END" >> run.log 2>&1
580                    fi
581              fi              fi
582                ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`
583          fi          fi
584          # echo "COMMAND='$COMMAND'"          rm -f run.log_00
585          # echo "pwd='"`pwd`"'"          #if test "x$RETVAL" = x0 ; then
586          if test "x$RETVAL" = x0 ; then          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
587              tail run.log              tail run.log
588              echo successful 1>&2              echo successful 1>&2
589              # === Reduce the size of the testing emails!              # === Reduce the size of the testing emails!
590              # if test "x$ADM" = x ; then              #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE
             #   cp output.txt $CDIR"/output.txt"  
             # else  
             #   cp output_adm.txt $CDIR"/output_adm.txt"  
             # fi  
591              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
592              return 0              return 0
593          else          else
594              tail run.log              tail run.log
595              echo failed 1>&2              echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2
596              cp run.log $CDIR"/run.log"              cp run.log $CDIR"/run.log"
597              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
598              return 1              return 1
# Line 583  createcodelet() Line 605  createcodelet()
605      # create codelet for comparing model output      # create codelet for comparing model output
606    
607      printf "creating the comparison code...  "      printf "creating the comparison code...  "
608      cat > tmp_cmpnum.c <<EOF      cat > tr_cmpnum.c <<EOF
609  #include <stdio.h>  #include <stdio.h>
610  #include <math.h>  #include <math.h>
611  int main( int argc, char** argv )  {  int main( int argc, char** argv )  {
612    int linnum,best,lncnt;    int linnum,cmplin,best,lncnt;
613    double a,b,abave,relerr;    double a,b,abave,relerr;
614    best = -22;    best = -22;
615    lncnt = 0;    lncnt = 0;
# Line 596  int main( int argc, char** argv )  { Line 618  int main( int argc, char** argv )  {
618      if (linnum == -1)  break;      if (linnum == -1)  break;
619      scanf("%lf", &a);  scanf("%lf", &b);      scanf("%lf", &a);  scanf("%lf", &b);
620      abave = 0.5*(fabs(a)+fabs(b));      abave = 0.5*(fabs(a)+fabs(b));
621      if (abave > 0.0) {      if ( abave == abave ) {
622        relerr=fabs(a-b)/abave;        if (abave > 0.0) {
623        if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); }          relerr=fabs(a-b)/abave;
624        else { linnum = -16 ; }          if (relerr > 0.0) { cmplin = (int)rint(log10(relerr)); }
625        best = (best > linnum) ? best : linnum;          else { cmplin = -16 ; }
626      }          best = (best > cmplin) ? best : cmplin; }
627          else { cmplin = -22 ; }
628       /* printf("%d ; %lf ; %lf\n",cmplin,a,b); */
629          }
630       else {
631       /* printf("%lf ; %lf ; %lf\n",abave,a,b); */
632          break; }
633    }    }
634    if (lncnt == 999) best=-29;    if (lncnt == 999) best=-29;
635      if (linnum != -1) best=-99;
636    printf("%d\n", -best);    printf("%d\n", -best);
637    return 0;    return 0;
638  }  }
639  EOF  EOF
640      $CC -o tmp_cmpnum tmp_cmpnum.c -lm      $CC -o tr_cmpnum tr_cmpnum.c -lm
641    
642      if [ -x ./tmp_cmpnum ]; then      if [ -x ./tr_cmpnum ]; then
643          echo "OK"          echo "OK"
644          return 0          return 0
645      else      else
# Line 644  formatresults() Line 673  formatresults()
673            
674  }  }
675    
 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  
 }  
   
676  scandirs()  scandirs()
677  {  {
678      if [ $# -eq 1 ]; then      if [ $# -eq 1 ]; then
# Line 702  BASH= Line 712  BASH=
712  OPTFILE=NONE  OPTFILE=NONE
713  ADDRESSES=  ADDRESSES=
714  TESTDIRS=  TESTDIRS=
715    SKIPDIRS=
716  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
717  HAVE_MPACK=  HAVE_MPACK=
718  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
# Line 757  for ac_option ; do Line 768  for ac_option ; do
768          -tdir=* | --tdir=*)          -tdir=* | --tdir=*)
769              TESTDIRS=$ac_optarg ;;              TESTDIRS=$ac_optarg ;;
770    
771            -skipdir | --skipdir | -skd | --skd)
772                ac_prev=SKIPDIRS ;;
773            -skipdir=* | --skipdir=*)
774                SKIPDIRS=$ac_optarg ;;
775    
776          -bash | --bash | -b | --b)          -bash | --bash | -b | --b)
777              ac_prev=BASH ;;              ac_prev=BASH ;;
778          -bash=* | --bash=*)          -bash=* | --bash=*)
# Line 815  for ac_option ; do Line 831  for ac_option ; do
831    
832          -deldir | -dd) DELDIR=t ;;          -deldir | -dd) DELDIR=t ;;
833    
834            -ts) TS=t;;
835    
836            -papis) PAPIS=t;;
837    
838            -pcls) PCL=t;;
839    
840          -*)          -*)
841              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
842              usage              usage
# Line 837  fi Line 859  fi
859    
860  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
861      if test "x$ADM" = xt ; then      if test "x$ADM" = xt ; then
862          TESTDIRS=`scandirs results_ad`          LIST=`scandirs results_ad`
863      else      else
864          TESTDIRS=`scandirs results`          LIST=`scandirs results`
865      fi      fi
866  else  else
867      #- expand group of experiments:      #- expand group of experiments:
# Line 856  else Line 878  else
878          *)       LIST=${LIST}" "$xx ;;          *)       LIST=${LIST}" "$xx ;;
879        esac        esac
880      done      done
881      #echo 'LIST='${LIST}'<'  fi
882      #- remove duplicate and non-directory:  #echo 'LIST='${LIST}'<'
883      TESTDIRS=" "  #- skip dirs, remove duplicate and non-directory:
884      for xx in $LIST  TESTDIRS=" "
885      do  count=0
886    for xx in $LIST
887    do
888        yy=`echo $SKIPDIRS | grep -c $xx`
889        if test $yy = 0 ; then
890          if test -d $xx ; then          if test -d $xx ; then
891              yy=`echo $TESTDIRS | grep -c $xx`              yy=`echo $TESTDIRS | grep -c $xx`
892              if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi              if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi
893          else          else count=1 ;
894              echo " -- skip \"$xx\" : not a directory !"              echo ""; echo -n " -- skip \"$xx\" (not a directory !)"
895          fi          fi
896      done      else
897  fi          if test $count = 1 ; then echo -n ", \"$xx\""
898            else count=1 ; echo "" ;  echo -n " skip: \"$xx\""
899            fi
900        fi
901    done
902    if test $count = 1 ; then echo "" ; echo -n " ... " ; fi
903  #echo 'TESTDIRS='${TESTDIRS}'<'  #echo 'TESTDIRS='${TESTDIRS}'<'
904    
905  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
# Line 883  else Line 914  else
914      OUTPUTFILE="output.txt"      OUTPUTFILE="output.txt"
915  fi  fi
916    
 if test "x$ADM" = xt -a "x$COMMAND" = x ; then  
     COMMAND="./$EXECUTABLE > $OUTPUTFILE"  
 fi  
   
917  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
918      COMMAND="./$EXECUTABLE > $OUTPUTFILE"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
919  fi  fi
920    if test "x$MPI" = xt ; then
921        OUTPUTFILE="STDOUT.0000"
922    fi
923    
924  #echo "OK"  #echo "OK"
925  echo "OK (COMMAND= $COMMAND )"  echo "OK (COMMAND= $COMMAND )"
# Line 1202  else Line 1232  else
1232      fi      fi
1233  fi  fi
1234    
1235  # rm -f tmp_cmpnum.f a.out  rm -f tr_cmpnum.c tr_cmpnum
 rm -f tmp_cmpnum.c tmp_cmpnum  
1236    
1237  if test "x$CLEANUP" != xt ; then  if test "x$CLEANUP" != xt ; then
1238      cat $SUMMARY | sed 's/ -- -- -- --//g'      cat $SUMMARY | sed 's/ -- -- -- --//g'

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.91

  ViewVC Help
Powered by ViewVC 1.1.22