/[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.1 by edhill, Wed Aug 27 22:12:31 2003 UTC revision 1.9.2.8 by edhill, Sat Oct 4 02:10:52 2003 UTC
# Line 10  usage() Line 10  usage()
10      echo      echo
11      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
12      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
13      echo "  (-optfile=|-of=)STRING   list of genmake2 \"optfiles\""      echo "  (-mpi)                   use MPI input files"
14        echo "  (-optfile=|-of=)STRING   list of optfiles to use"
15      echo "  (-a|-addr)STRING         list of email recipients"      echo "  (-a|-addr)STRING         list of email recipients"
16      echo "  (-t|-tdir)STRING         list of \"test\" dirs"      echo "                             (DEF=\"edhill@mitgcm.org\")"
17        echo "  (-t|-tdir)STRING         list of test dirs to use"
18        echo "                             (DEF=\"\" which builds all)"
19        echo "  (-b|-bash)STRING         location of \"bash\" executable"
20        echo "                             (DEF=\"\" for \"/bin/bash\")"
21        echo "  (-command)STRING         command to run"
22        echo "                             (DEF=\"make output.txt\")"
23        echo "  (-m|-make)STRING         command to use for \"make\""
24        echo "                             (DEF=\"make\")"
25        echo "  (-clean)                 *ONLY* run \"make CLEAN\""
26        echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
27        echo "  (-nogenmake|-ng)         skip the genmake stage"
28        echo "  (-noclean|-nc)           skip the \"make clean\" stage"
29        echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
30        echo
31        echo "and where STRING follows a whitespace-delimited format"
32        echo "such as:"
33        echo "  -t 'exp0 exp2 exp3' "
34        echo "  -addr='abc@123.com testing@home.org'"
35      echo      echo
36      exit 1      exit 1
37  }  }
# Line 29  build_mpack() Line 48  build_mpack()
48              exit 1              exit 1
49          fi          fi
50          echo -n "building mpack...  "          echo -n "building mpack...  "
51          ( cd $MPACKDIR && ./configure && make ) > build_mpack.out 2>&1          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1
52          RETVAL=$?          RETVAL=$?
53          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
54              echo              echo
# Line 160  testoutput() Line 179  testoutput()
179  genmakemodel()  genmakemodel()
180  {  {
181      # genmakemodel directory      # genmakemodel directory
182      GENMAKE2="../../../tools/genmake2"      if test "x$NOGENMAKE" = xt ; then
183      (          echo "genmake skipped!"
184          cd $1;      else
185          printf 'genmake ... ' 1>&2          GENMAKE2="$BASH ../../../tools/genmake2"
186          # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1          (
187          $GENMAKE2  -ds --mods=../code "--optfile="$OPTFILE > make.log 2>&1              cd $1;
188          RETVAL=$?              printf 'genmake ... ' 1>&2
189          for i in gm_state gm_optfile gm_local Makefile ; do              command="$GENMAKE2  -ds -m $MAKE --mods=../code"
190              if test -r $i ; then              if test "x$OPTFILE" != xNONE ; then
191                  cp $i $CDIR                  command="$command --optfile=$OPTFILE"
192                    # echo "  command=\"$command\""
193              fi              fi
194          done              $command > make.log 2>&1
195          if test "x$RETVAL" != x0 ; then              RETVAL=$?
196              tail make.log              for i in genmake_state genmake_optfile genmake_local Makefile ; do
197              echo "genmakemodel: genmake failed" 1>&2                  if test -r $i ; then
198              cp make.log $CDIR                      cp $i $CDIR
199              return 1                  fi
200          else              done
201              echo "succesful" 1>&2              if test "x$RETVAL" != x0 ; then
202          fi                  tail make.log
203      )                  echo "genmakemodel: genmake failed" 1>&2
204                    cp make.log $CDIR
205                    return 1
206                else
207                    echo "succesful" 1>&2
208                fi
209            )
210        fi
211  }  }
212    
213  makeclean()  makeclean()
214  {  {
215      # makeclean directory      # makeclean directory
216      (      if test "x$NOCLEAN" = xt ; then
217          cd $1;          echo "make CLEAN skipped!"
218          rm -f output.txt      else
219          printf 'make CLEAN ... ' 2>&1          (
220          if test -r Makefile ; then              cd $1;
221              make CLEAN >> make.log 2>&1              if test -e output.txt ; then
222              RETVAL=$?                  rm -f output.txt
             if test "x$RETVAL" != x0 ; then  
                 tail make.log  
                 echo "makeclean: \"make CLEAN\" failed" 1>&2  
                 cp make.log $CDIR"/make.log"  
                 return 1  
223              fi              fi
224          fi              printf 'make CLEAN ... ' 2>&1
225          echo succesful 1>&2              if test -r Makefile ; then
226          exit 0                  $MAKE CLEAN >> make.log 2>&1
227      )                  RETVAL=$?
228                    if test "x$RETVAL" != x0 ; then
229                        tail make.log
230                        echo "makeclean: \"make CLEAN\" failed" 1>&2
231                        cp make.log $CDIR"/make.log"
232                        return 1
233                    fi
234                fi
235                echo succesful 1>&2
236                exit 0
237            )
238        fi
239  }  }
240    
241  makedependmodel()  makedependmodel()
242  {  {
243      # makedependmodel directory      # makedependmodel directory
244      (      if test "x$NODEPEND" = xt ; then
245          cd $1;          echo "make depend skipped!"
246          printf 'make depend ... ' 1>&2      else
247          make depend >> make.log 2>&1          (
248          RETVAL=$?              cd $1;
249          if test "x$RETVAL" != x0 ; then              printf 'make depend ... ' 1>&2
250              tail make.log              $MAKE depend >> make.log 2>&1
251              echo "makedependmodel: make depend failed" 1>&2              RETVAL=$?
252              cp make.log $CDIR"/make.log"              if test "x$RETVAL" != x0 ; then
253              return 1                  tail make.log
254          else                  echo "makedependmodel: make depend failed" 1>&2
255              echo succesful 1>&2                  cp make.log $CDIR"/make.log"
256          fi                  return 1
257      )              else
258                    echo succesful 1>&2
259                fi
260            )
261        fi
262  }  }
263    
264  makemodel()  makemodel()
# Line 231  makemodel() Line 268  makemodel()
268          cd $1;          cd $1;
269          if test -r Makefile ; then          if test -r Makefile ; then
270              printf 'make ... ' 1>&2              printf 'make ... ' 1>&2
271              make >> make.log 2>&1              $MAKE >> make.log 2>&1
272              RETVAL=$?              RETVAL=$?
273              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
274                  tail make.log                  tail make.log
# Line 257  linkdata() Line 294  linkdata()
294    
295  runmodel()  runmodel()
296  {  {
297      # runmodel directory exe      # runmodel directory
298      #      #
299      #  runs the model "exe" in "directory" (exe is relative to directory)      #  runs "$COMMAND" in "directory"
300        #  (where "$COMMAND" is relative to "directory")
301      (      (
302          cd $1          cd $1
303          if [ -x $2 ]; then          printf 'runmodel: ' 1>&2
304              if [ $quick -eq 0 ]; then          # make output.txt
305                  rm -f output.txt          $COMMAND
306              fi          RETVAL=$?
307              printf 'runmodel: ' 1>&2          if test "x$RETVAL" = x0 ; then
308              make output.txt              cp output.txt $CDIR"/output.txt"
309              RETVAL=$?              return 0
310              if test "x$RETVAL" = x0 ; then          else
311                  cp output.txt $CDIR"/output.txt"              return 1
                 return 0  
             else  
                 return 1  
             fi  
312          fi          fi
313      )      )
314  }  }
# Line 315  EOFA Line 349  EOFA
349          return 0          return 0
350      else      else
351          echo          echo
352          echo "createcodelet: failed to compile codelet" | tee          echo "createcodelet: failed to compile codelet"
353          exit 1          exit 1
354      fi      fi
355  }  }
# Line 347  show_help() Line 381  show_help()
381  {  {
382      cat - << EOF      cat - << EOF
383  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
384   -help      Show this help message  
385   -quick     Skip "genmake" and "make depend" if the Makefile exists   -help|-h      Show this help message
386   -quiet     Reduce the amount of output   -quiet     Reduce the amount of output
387   -verbose   Produce copious amounts of output   -verbose   Produce copious amounts of output
388   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
# Line 383  scandirs() Line 417  scandirs()
417  #  Default properties  #  Default properties
418  debug=0  debug=0
419  verbose=1  verbose=1
 quick=0  
420  clean=0  clean=0
 ieee=1  
421  expts=''  expts=''
422    # ieee=1
423    
424  OPTFILES=  CLEANUP=f
425  ADDRESSES=edhill@mitgcm.org  QUICK=f
426    NOGENMAKE=f
427    NOCLEAN=f
428    NODEPEND=f
429    
430    BASH=
431    OPTFILE=NONE
432    ADDRESSES=
433  TESTDIRS=  TESTDIRS=
434  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
435  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
436    COMMAND="make output.txt"
437    MAKE=make
438    MPI=f
439    
440  echo -n "parsing options...  "  echo -n "parsing options...  "
441    
# Line 413  for ac_option ; do Line 456  for ac_option ; do
456          -help | --help | -h | --h)          -help | --help | -h | --h)
457              usage ;;              usage ;;
458                    
459          -optfile | --optfile | -f | --f)          -optfile | --optfile | -of | --of)
460              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
461          -optfile=* | --optfile=*)          -optfile=* | --optfile=* | -of=* | --of=*)
462              OPTFILES=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
463                    
464          -addr | --addr | -a | --a)          -addr | --addr | -a | --a)
465              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
# Line 428  for ac_option ; do Line 471  for ac_option ; do
471          -tdir=* | --tdir=*)          -tdir=* | --tdir=*)
472              TESTDIRS=$ac_optarg ;;              TESTDIRS=$ac_optarg ;;
473    
474          -quick) quick=1 ;;          -bash | --bash | -b | --b)
475                ac_prev=BASH ;;
476            -bash=* | --bash=*)
477                BASH=$ac_optarg ;;
478    
479            -command | --command | -c | --c)
480                ac_prev=COMMAND ;;
481            -command=* | --command=*)
482                COMMAND=$ac_optarg ;;
483    
484            -make | --make | -m | --m)
485                ac_prev=MAKE ;;
486            -make=* | --make=*)
487                MAKE=$ac_optarg ;;
488    
489            -clean | --clean)
490                CLEANUP=t ;;
491    
492            -quick | --quick | -q | --q)
493                QUICK=t ;;
494            -nogenmake | --nogenmake | -ng | --ng)
495                NOGENMAKE=t ;;
496            -noclean | --noclean | -nc | --nc)
497                NOCLEAN=t ;;
498            -nodepend | --nodepend | -nd | --nd)
499                NODEPEND=t ;;
500    
501            -mpi) MPI=t ;;
502          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
503          -debug) debug=1 ;;          -debug) debug=1 ;;
         -clean) clean=1 ;;  
         -noieee) ieee=0 ;;  
504          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
505    
506          -*)          -*)
# Line 449  for ac_option ; do Line 517  for ac_option ; do
517            
518  done  done
519    
520    if test "x$QUICK" = xt ; then
521        NOGENMAKE=t
522        NOCLEAN=t
523        NODEPEND=t
524    fi
525    
526  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
527      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
528  fi  fi
529    
530    if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
531        OPTFILE=$MITGCM_OF
532    fi
533    
534  echo "OK"  echo "OK"
535    
536  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
# Line 463  build_mpack Line 541  build_mpack
541    
542  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
543  MACH=`hostname`  MACH=`hostname`
544    UNAMEA=`uname -a`
545  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
546  BASE=$MACH"_"$DATE"_"  BASE=$MACH"_"$DATE"_"
547  DNUM=0  DNUM=0
# Line 490  EOF Line 569  EOF
569    
570  NDIR=0  NDIR=0
571    
572  #  For each optfile...  if test "x$OPTFILE" != xNONE ; then
573  for OPTFILE in $OPTFILES ; do      if test -r $OPTFILE ; then
574            OPTFILE=`pwd`"/$OPTFILE"
575        fi
576    fi
577    echo
578    echo "OPTFILE=$OPTFILE" >> $SUMMARY
579    echo >> $SUMMARY
580    
581    #  ...and each test directory...
582    for dir in $TESTDIRS ; do
583        
584        #  Cleanup only!
585        if test "x$CLEANUP" = xt ; then
586            if test -r $dir/build/Makefile ; then
587                ( cd $dir/build ; make CLEAN )
588            fi
589            if test -r $dir/input/Makefile ; then
590                ( cd $dir/input ; make CLEAN )
591            fi
592            continue
593        fi
594    
595      OPTFILE=`pwd`"/$OPTFILE"      #  Verify that the testdir exists and contains previous
596      if test ! -r $OPTFILE ; then      #  results in the correct location--or skip this directory!
597          echo "Error: can't read optfile \"$OPTFILE\""      if test ! -r $dir"/results/output.txt" ; then
598          exit 1          echo "can't read \"$dir/results/output.txt\" -- skipping $dir"
599            continue
600      fi      fi
601    
602        echo "-------------------------------------------------------------------------------"
603      echo      echo
604      echo "OPTFILE=$OPTFILE" >> $SUMMARY      echo "Experiment:  $dir"
605      echo >> $SUMMARY      echo
606            unset genmake makedepend make run
607      #  ...and each test directory...      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
     for dir in $TESTDIRS ; do  
           
         #  Create an output dir for each OPTFILE/tdir combination  
         CDIR=$DRESULTS"/"$NDIR  
         mkdir $CDIR  
         CDIR=`pwd`"/$CDIR"  
608    
609          #  ...configue, make, run, and compare the output.      if [ -r $dir/build ]; then
610          echo "-------------------------------------------------------------------------------"          seperatebuilddir=1
611          echo          builddir=build
612          echo "Experiment:  $dir"          rundir=build
613          echo          ( cd $dir/build; ln -sf ../input/* . )
614          unset genmake makedepend make run      else
615          results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'          seperatebuilddir=0
616          ( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; )          builddir=input
617          if [ -r $dir/build ]; then          rundir=input
618              seperatebuilddir=1      fi
619              builddir=build      
620              rundir=build      CODE_DIR=$dir/code
621              ( cd $dir/build; ln -sf ../input/* . )      BUILD_DIR=$dir/$builddir
622          else      MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
623              seperatebuilddir=0      NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
624              builddir=input  
625              rundir=input      #  Is this an MPI run?
626        if test "x$MPI" = xt ; then
627            FILES=$MPI_FILES
628        else
629            FILES=$NOMPI_FILES
630        fi
631        
632        #  Check to see that we have the files
633        have_files=t
634        for i in $FILES ; do
635            if test ! -r $CODE_DIR/$i ; then
636                echo "Warning: can't read file $CODE_DIR/$i"
637                have_files=f
638          fi          fi
639        done
640        if test "x$have_files" != xt -a "x$MPI" = xt ; then
641            echo "Skipping $dir due to lack of input files (see above warning)"
642            continue
643        fi
644        
645        #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR
646        if test "x$have_files" = xt ; then
647            for i in $FILES ; do
648                cmp $CODE_DIR/$i $BUILD_DIR/$i > /dev/null 2>&1
649                RETVAL=$?
650                if test "x$RETVAL" != x0 ; then
651                    cp $CODE_DIR/$i $BUILD_DIR/$i
652                fi
653            done
654        fi
655        
656        #  Create an output dir for each OPTFILE/tdir combination
657        CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR
658        mkdir $CDIR
659        CDIR=`pwd`"/$CDIR"
660        
661        if test "x$CLEANUP" = xt ; then
662            makeclean $dir/$builddir
663        else
664          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
665              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
666              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
667              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
668              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $seperatebuilddir $dir/$rundir \
669              && runmodel $dir/$builddir mitgcmuv && run=Y \              && runmodel $dir/$builddir && run=Y \
670              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
671          echo      fi
672          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results      
673          echo      echo
674          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results >> $SUMMARY      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
675            ${run:-N} $results
676          ( cd $DRESULTS"/"$NDIR ; gzip * )      echo
677        formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
678          tar -cf $DRESULTS"/"$NDIR".tar" $DRESULTS"/"$NDIR          ${run:-N} $results >> $SUMMARY
679          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar" $ADDRESSES      echo "fresults='" > $CDIR"/summary.txt"
680        formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
681            ${run:-N} $results >> $CDIR"/summary.txt"
682        echo "'" >> $CDIR"/summary.txt"
683        echo "MACH='$MACH'" >> $CDIR"/summary.txt"
684        echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
685        echo "DATE='$DATE'" >> $CDIR"/summary.txt"
686        echo "tdir='$dir'" >> $CDIR"/summary.txt"
687        
688        (
689            cd $DRESULTS
690            tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1
691            gzip $NDIR".tar"
692        )
693        
694        if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
695            echo "No mail sent"
696        else
697            $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES
698            RETVAL=$?
699            if test "x$RETVAL" != x0 ; then
700                echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"
701            else
702                rm -f $DRESULTS"/"$NDIR".tar*"
703            fi
704        fi
705    
706          NDIR=$(( $NDIR + 1 ))      echo "-------------------------------------------------------------------------------"
707                
708      done      NDIR=$(( $NDIR + 1 ))
709        
710  done  done
711    
712  # rm tmp_cmpnum.f a.out  rm tmp_cmpnum.f a.out
713    
 echo -------------------------------------------------------------------------------  
 echo  
 echo >> $SUMMARY  
 date >> $SUMMARY  
714  cat $SUMMARY  cat $SUMMARY
715    
 # tar -cf $DRESULTS".tar" $DRESULTS  
 #  
 # $MPACK -s MITgcm-test -m 1000000 $DRESULTS".tar" $ADDRESSES  
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.9.2.8

  ViewVC Help
Powered by ViewVC 1.1.22