/[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.104 by jmc, Tue Oct 2 14:24:42 2007 UTC revision 1.113 by jmc, Wed Mar 12 02:20:04 2008 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 "  (-gsl)                   compile with \"-gsl\" flag"
19      echo "  (-of=|-optfile=)STRING   list of optfiles to use"      echo "  (-of=|-optfile=)STRING   list of optfiles to use"
20      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-a|-addr) STRING        list of email recipients"
21      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"\" no email is sent)"
22        echo "  (-mpd|-mpackdir) DIR     location of the mpack utility"
23        echo "                             (DEF=\"../tools/mpack-1.6\")"
24      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"
25      echo "                             (recognized groups: basic, tutorials)"      echo "                             (recognized groups: basic, tutorials)"
26      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
# Line 64  usage() Line 67  usage()
67  build_mpack()  build_mpack()
68  {  {
69      printf "building the mpack utility...  "      printf "building the mpack utility...  "
70      if test ! -x "$MPACKDIR/mpack" ; then      MPACK="$MPACKDIR/mpack"
71        if test ! -x $MPACK ; then
72          if test ! -d $MPACKDIR ; then          if test ! -d $MPACKDIR ; then
73              echo              echo
74              echo "Error: can't find \"$MPACKDIR\""              echo "Error: can't find \"$MPACKDIR\""
# Line 73  build_mpack() Line 77  build_mpack()
77              echo              echo
78              HAVE_MPACK=f              HAVE_MPACK=f
79          fi          fi
         printf "building mpack...  "  
80          if test "x$CC" = x ; then          if test "x$CC" = x ; then
81              export CC=cc              export CC=cc
82          fi          fi
83            printf "building mpack (using CC=$CC)...  "
84          ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1          ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1
85          RETVAL=$?          RETVAL=$?
86          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
# Line 87  build_mpack() Line 91  build_mpack()
91          else          else
92              rm -f tr_build_mpack.out              rm -f tr_build_mpack.out
93              HAVE_MPACK=t              HAVE_MPACK=t
94                echo "done"
95          fi          fi
96      else      else
97          HAVE_MPACK=t          HAVE_MPACK=t
98            echo "already exist"
99      fi      fi
     echo "OK"  
100  }  }
101    
102  testoutput_var()  testoutput_var()
# Line 174  testoutput_var() Line 179  testoutput_var()
179      return $digits_of_similarity      return $digits_of_similarity
180  }  }
181    
 dashnum()  
 {  
     # dashnum n1 n2 n3 ...  
     #  
     #  print numbers using %3i format or "--" if number = 99  
   
     for num in $@ ; do  
         if [ $num = 99 ]; then  
             printf ' --'  
         else  
             printf '%3i' $num  
         fi  
     done  
 }  
   
182  check_for_add_mon_output()  check_for_add_mon_output()
183  {  {
184      # Check for additional types of monitor output      # Check for additional types of monitor output
# Line 342  genmakemodel() Line 332  genmakemodel()
332              if test "x$IEEE" != x ; then              if test "x$IEEE" != x ; then
333                  command="$command -ieee"                  command="$command -ieee"
334              fi              fi
335                if test "x$GSL" = xt ; then
336                    command="$command -gsl"
337                fi
338              if test "x$MPI" = xt ; then              if test "x$MPI" = xt ; then
339                  command="$command -mpi"                  command="$command -mpi"
340              fi              fi
# Line 414  run_clean() Line 407  run_clean()
407              find . -type l -exec rm {} \;              find . -type l -exec rm {} \;
408              rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime              rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime
409              rm -rf mnc_test_*              rm -rf mnc_test_*
410                rm -f *_MIT_CE_000.opt0000 costfunction*0000
411              echo successful 1>&2              echo successful 1>&2
412              exit 0              exit 0
413          )          )
# Line 484  symlink_mpifiles() Line 478  symlink_mpifiles()
478      CODE_DIR=$dir/$code_dir      CODE_DIR=$dir/$code_dir
479            
480      # These are files that should replace their counter-part when using -mpi      # These are files that should replace their counter-part when using -mpi
481      MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")`      MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)`
482    
483      #  Is this an MPI run?      #  Is this an MPI run?
484      if test "x$MPI" = xt ; then      if test "x$MPI" = xt ; then
# Line 542  linkdata() Line 536  linkdata()
536                      if test -h eedata ; then rm -f eedata ; fi                      if test -h eedata ; then rm -f eedata ; fi
537                  fi                  fi
538              fi              fi
539                prevDir='NONE'
540              for ldir in $* ; do              for ldir in $* ; do
541                  if test -d "../"$ldir ; then                  if test -d "../"$ldir -a $ldir != $prevDir ; then
542                      printf 'ldir='${ldir} 1>&2                      printf 'ldir='${ldir} 1>&2
543                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`
544                      for i in $files ; do                      for i in $files ; do
# Line 559  linkdata() Line 554  linkdata()
554                      fi                      fi
555                      printf ' ; ' 1>&2                      printf ' ; ' 1>&2
556                  fi                  fi
557                    prevDir=$ldir
558              done              done
559          )          )
560      fi      fi
# Line 575  runmodel() Line 571  runmodel()
571          printf 'runmodel in %s ...' $1 1>&2          printf 'runmodel in %s ...' $1 1>&2
572          # make output.txt          # make output.txt
573          echo          echo
574            if test -L $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
575                diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1
576                outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; rm -f run.log ; fi
577            fi
578          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
579              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00
580              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
# Line 629  createcodelet() Line 629  createcodelet()
629  {  {
630      # create codelet for comparing model output      # create codelet for comparing model output
631    
632      printf "creating the comparison code...  "      printf "creating the comparison code (using CC=$CC)...  "
633      cat > tr_cmpnum.c <<EOF      cat > tr_cmpnum.c <<EOF
634  #include <stdio.h>  #include <stdio.h>
635  #include <math.h>  #include <math.h>
# Line 726  scandirs() Line 726  scandirs()
726  debug=0  debug=0
727  verbose=1  verbose=1
728  clean=0  clean=0
 expts=''  
 # ieee=1  
729    
730  IEEE=true  IEEE=true
731  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
732      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
733  fi  fi
734    GSL=f
735    
736  CLEANUP=f  CLEANUP=f
737  QUICK=f  QUICK=f
# Line 749  TESTDIRS= Line 747  TESTDIRS=
747  SKIPDIRS=  SKIPDIRS=
748  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
749  HAVE_MPACK=  HAVE_MPACK=
750  MPACK="$MPACKDIR/mpack"  MPACK=
751  COMMAND=  COMMAND=
752  if test "x$MAKE" = x ; then  if test "x$MAKE" = x ; then
753      MAKE=make      MAKE=make
# Line 798  for ac_option ; do Line 796  for ac_option ; do
796              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
797          -addr=* | --addr=*)          -addr=* | --addr=*)
798              ADDRESSES=$ac_optarg ;;              ADDRESSES=$ac_optarg ;;
799            -mpackdir | --mpackdir | -mpd | --mpd)
800                ac_prev=MPACKDIR ;;
801            -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*)
802                MPACKDIR=$ac_optarg ;;
803    
804          -tdir | --tdir | -t | --t)          -tdir | --tdir | -t | --t)
805              ac_prev=TESTDIRS ;;              ac_prev=TESTDIRS ;;
# Line 863  for ac_option ; do Line 865  for ac_option ; do
865    
866          -ieee) IEEE=true ;;          -ieee) IEEE=true ;;
867          -noieee) IEEE= ;;          -noieee) IEEE= ;;
868            -gsl) GSL=t ;;
869    
870          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
871          -debug) debug=1 ;;          -debug) debug=1 ;;
# Line 899  fi Line 902  fi
902  #- setting for forward or ADM testing  #- setting for forward or ADM testing
903  if test "x$ADM" = xt ; then  if test "x$ADM" = xt ; then
904      code_dir=code_ad      code_dir=code_ad
905      input_dirs='input_ad input'      inputdir=input_ad
906      ref_outp="output_adm.txt"      ref_outp="output_adm.txt"
907      EXECUTABLE="mitgcmuv_ad"      EXECUTABLE="mitgcmuv_ad"
908  else  else
909      code_dir=code      code_dir=code
910      input_dirs='input'      inputdir=input
911      ref_outp="output.txt"      ref_outp="output.txt"
912      EXECUTABLE="mitgcmuv"      EXECUTABLE="mitgcmuv"
913  fi  fi
# Line 983  fi Line 986  fi
986  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
987  createcodelet  createcodelet
988    
989  #  build the mpack utility  #  build the mpack utility (if ADDRESSES = NONE, do it to test the build)
990  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then  if test "x$ADDRESSES" = x ; then
991      echo "skipping mpack build"      echo "skipping mpack build"
992  else  else
993      build_mpack      build_mpack
994  fi  fi
995    
996  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
997    CMDLINE=$0
998    for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done
999  MACH=`hostname`  MACH=`hostname`
1000  UNAMEA=`uname -a`  UNAMEA=`uname -a`
1001  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
# Line 1011  if test "x$RETVAL" != x0 ; then Line 1016  if test "x$RETVAL" != x0 ; then
1016      exit 1      exit 1
1017  fi  fi
1018  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
 printf "Start time:  " >> $SUMMARY  
1019  start_date=`date`  start_date=`date`
1020  echo $start_date > $SUMMARY  echo $start_date > $SUMMARY
1021    echo 'run:' $CMDLINE >> $SUMMARY
1022    echo 'on :' $UNAMEA  >> $SUMMARY
1023    
1024  of_path=  of_path=
1025  if test "x$OPTFILE" != xNONE ; then  if test "x$OPTFILE" != xNONE ; then
# Line 1087  fi Line 1093  fi
1093  #  ...and each test directory...  #  ...and each test directory...
1094  for dir in $TESTDIRS ; do  for dir in $TESTDIRS ; do
1095            
1096        # set builddir & rundir:
1097        builddir="build"
1098        if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1099        rundir="run"
1100        if test ! -d $dir/$rundir ; then
1101            rundir=$builddir
1102        fi
1103        CODE_DIR=$dir/$code_dir
1104        BUILD_DIR=$dir/$builddir
1105    
1106      #  Cleanup only!      #  Cleanup only!
1107      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
1108          if test -r $dir/build/Makefile ; then          if test -r $BUILD_DIR/Makefile ; then
1109              echo '  ------  clean dir:' $dir/build              echo '  ------  clean dir:' $dir/build
1110              ( cd $dir/build ; make CLEAN )              ( cd $BUILD_DIR ; make CLEAN )
1111          fi          fi
1112          if test -d $dir/run/CVS ; then          if test -d $dir/$rundir/CVS ; then
1113              echo '  ------  clean dir:' $dir/run              echo '  ------  clean dir:' $dir/$rundir
1114              run_clean $dir/run              run_clean $dir/$rundir
1115          fi          fi
1116          (          (
1117              cd $dir              cd $dir
# Line 1117  for dir in $TESTDIRS ; do Line 1133  for dir in $TESTDIRS ; do
1133    
1134      # Check for additional types of monitor output      # Check for additional types of monitor output
1135    
     builddir="build"  
     if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi  
     rundir="run"  
     if test ! -d $dir/$rundir ; then  
         rundir=$builddir  
     fi  
     CODE_DIR=$dir/$code_dir  
     BUILD_DIR=$dir/$builddir  
   
1136      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then
1137          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1138          continue          continue
# Line 1137  for dir in $TESTDIRS ; do Line 1144  for dir in $TESTDIRS ; do
1144    
1145      #  Check whether there are "extra runs" for this testdir      #  Check whether there are "extra runs" for this testdir
1146      extra_runs=      extra_runs=
1147      if test "x$ADM" = x ; then      ex_run_dirs=`( cd $dir ; echo $inputdir.* )`
1148          ex_run_dirs=`( cd $dir ; echo input.* )`      #echo "ex_run_dirs='$ex_run_dirs'"
1149          #echo "ex_run_dirs='$ex_run_dirs'"      for exd in $ex_run_dirs ; do
1150          for exd in $ex_run_dirs ; do          name=`echo $exd | sed -e "s/$inputdir\.//"`
1151              name=`echo $exd | sed -e 's/input.//g'`          refExOut=`echo $ref_outp | sed "s/\./.${name}./"`
1152              outf="$dir/results/output.$name.txt"          outf="$dir/results/$refExOut"
1153              if test -f $outf -a -r $outf ; then          if test -f $outf -a -r $outf ; then
1154                  if test "x$MULTI_THREAD" = "xt" ; then              if test "x$MULTI_THREAD" = "xt" ; then
1155                      if test -r $dir"/"$exd"/eedata.mth" ; then                  if test -r $dir"/"$exd"/eedata.mth" ; then
                         extra_runs="$extra_runs $name"  
                     #else echo $dir"/"$exd"/eedata.mth: not found"  
                     fi  
                 else  
1156                      extra_runs="$extra_runs $name"                      extra_runs="$extra_runs $name"
1157                    #else echo $dir"/"$exd"/eedata.mth: not found"
1158                  fi                  fi
1159                else
1160                    extra_runs="$extra_runs $name"
1161              fi              fi
1162          done          fi
1163      fi      done
1164    
1165      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
1166      echo      echo
# Line 1183  for dir in $TESTDIRS ; do Line 1189  for dir in $TESTDIRS ; do
1189              && symlink_mpifiles $dir $code_dir $builddir \              && symlink_mpifiles $dir $code_dir $builddir \
1190              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
1191              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
1192              && linkdata $dir/$rundir $input_dirs \              && linkdata $dir/$rundir $inputdir input \
1193              && runmodel $dir/$rundir && run=Y \              && runmodel $dir/$rundir && run=Y \
1194              && results=`testoutput_run $dir $rundir $ref_outp`              && results=`testoutput_run $dir $rundir $ref_outp`
1195      fi      fi
1196            
1197      echo      echo
 # --> same processing for adjoint & forward test  
1198          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1199          echo          echo
1200          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
# Line 1199  for dir in $TESTDIRS ; do Line 1204  for dir in $TESTDIRS ; do
1204          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1205          echo "DATE='$DATE'" >> $CDIR"/summary.txt"          echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1206          echo "tdir='$dir'" >> $CDIR"/summary.txt"          echo "tdir='$dir'" >> $CDIR"/summary.txt"
1207            if test "x$ADM" = xt ; then
1208                head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt"
1209                grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \
1210                                    >> $CDIR"/summary.txt"
1211            fi
1212    
1213          for ex in $extra_runs ; do          for ex in $extra_runs ; do
1214              unset run              unset run
1215              results=$EMPTY_RESULTS              results=$EMPTY_RESULTS
1216                #  reference output file
1217                refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`
1218              #  Create an output dir for each OPTFILE/tdir.ex combination              #  Create an output dir for each OPTFILE/tdir.ex combination
1219              rel_CDIR=$DRESULTS"/"$dir"."$ex              rel_CDIR=$DRESULTS"/"$dir"."$ex
1220              mkdir $rel_CDIR              mkdir $rel_CDIR
1221              CDIR=`pwd`"/$rel_CDIR"              CDIR=`pwd`"/$rel_CDIR"
1222              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"
1223              run_clean $dir/tr_run.$ex              run_clean $dir/tr_run.$ex
1224              linkdata $dir/tr_run.$ex input.$ex input              linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir input
1225              runmodel $dir/tr_run.$ex && run=Y \              runmodel $dir/tr_run.$ex && run=Y \
1226                  && results=`testoutput_run $dir tr_run.$ex "output.${ex}.txt"`              && results=`testoutput_run $dir tr_run.$ex $refExOut`
1227              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1228              fres="$fres.$ex"              fres="$fres.$ex"
1229              echo              echo
# Line 1222  for dir in $TESTDIRS ; do Line 1234  for dir in $TESTDIRS ; do
1234              echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"              echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1235              echo "DATE='$DATE'" >> $CDIR"/summary.txt"              echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1236              echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt"              echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt"
1237                if test "x$ADM" = xt ; then
1238                    head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt"
1239                    grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \
1240                                       >> $CDIR"/summary.txt"
1241                fi
1242              if test "x$POSTCLEAN" = xt ; then              if test "x$POSTCLEAN" = xt ; then
1243                  run_clean $dir/tr_run.$ex                  run_clean $dir/tr_run.$ex
1244              fi              fi
1245          done          done
 # <-- same processing for adjoint & forward test  
     if test "x$ADM" = xt ; then  
         grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \  
                            >> $CDIR"/summary.txt"  
     fi  
1246    
1247      #postclean $dir/$builddir      #postclean $dir/$builddir
1248      if test "x$POSTCLEAN" = xt ; then      if test "x$POSTCLEAN" = xt ; then

Legend:
Removed from v.1.104  
changed lines
  Added in v.1.113

  ViewVC Help
Powered by ViewVC 1.1.22