/[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.9 by edhill, Tue Sep 16 18:16:03 2003 UTC revision 1.9.2.10 by edhill, Sat Oct 4 14:33:58 2003 UTC
# Line 11  usage() Line 11  usage()
11      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
12      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
13      echo "  (-mpi)                   use MPI input files"      echo "  (-mpi)                   use MPI input files"
14        echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
15      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-optfile=|-of=)STRING   list of optfiles to use"
16      echo "  (-a|-addr)STRING         list of email recipients"      echo "  (-a|-addr)STRING         list of email recipients"
17      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"edhill@mitgcm.org\")"
# Line 18  usage() Line 19  usage()
19      echo "                             (DEF=\"\" which builds all)"      echo "                             (DEF=\"\" which builds all)"
20      echo "  (-b|-bash)STRING         location of \"bash\" executable"      echo "  (-b|-bash)STRING         location of \"bash\" executable"
21      echo "                             (DEF=\"\" for \"/bin/bash\")"      echo "                             (DEF=\"\" for \"/bin/bash\")"
22      echo "  (-c|-command)STRING      command to run"      echo "  (-command)STRING         command to run"
23      echo "                             (DEF=\"make output.txt\")"      echo "                             (DEF=\"make output.txt\")"
24      echo "  (-m|-make)STRING         command to use for \"make\""      echo "  (-m|-make)STRING         command to use for \"make\""
25      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
26        echo "  (-clean)                 *ONLY* run \"make CLEAN\""
27        echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
28        echo "  (-nogenmake|-ng)         skip the genmake stage"
29        echo "  (-noclean|-nc)           skip the \"make clean\" stage"
30        echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
31      echo      echo
32      echo "and where STRING follows a whitespace-delimited format"      echo "and where STRING follows a whitespace-delimited format"
33      echo "such as:"      echo "such as:"
# Line 174  testoutput() Line 180  testoutput()
180  genmakemodel()  genmakemodel()
181  {  {
182      # genmakemodel directory      # genmakemodel directory
183      GENMAKE2="$BASH ../../../tools/genmake2"      if test "x$NOGENMAKE" = xt ; then
184      (          echo "genmake skipped!"
185          cd $1;      else
186          printf 'genmake ... ' 1>&2          GENMAKE2="$BASH ../../../tools/genmake2"
187          # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1          (
188          $GENMAKE2  -ds -m $MAKE --mods=../code "--optfile="$OPTFILE > make.log 2>&1              cd $1;
189          RETVAL=$?              printf 'genmake ... ' 1>&2
190          for i in gm_state gm_optfile gm_local Makefile ; do              command="$GENMAKE2  -ds -m $MAKE --mods=../code"
191              if test -r $i ; then              if test "x$OPTFILE" != xNONE ; then
192                  cp $i $CDIR                  command="$command --optfile=$OPTFILE"
193                    # echo "  command=\"$command\""
194              fi              fi
195          done              if test "x$IEEE" != x ; then
196          if test "x$RETVAL" != x0 ; then                  command="$command -ieee"
197              tail make.log              fi
198              echo "genmakemodel: genmake failed" 1>&2              $command > make.log 2>&1
199              cp make.log $CDIR              RETVAL=$?
200              return 1              for i in genmake_state genmake_optfile genmake_local Makefile ; do
201          else                  if test -r $i ; then
202              echo "succesful" 1>&2                      cp $i $CDIR
203          fi                  fi
204      )              done
205                if test "x$RETVAL" != x0 ; then
206                    tail make.log
207                    echo "genmakemodel: genmake failed" 1>&2
208                    cp make.log $CDIR
209                    return 1
210                else
211                    echo "succesful" 1>&2
212                fi
213            )
214        fi
215  }  }
216    
217  makeclean()  makeclean()
218  {  {
219      # makeclean directory      # makeclean directory
220      (      if test "x$NOCLEAN" = xt ; then
221          cd $1;          echo "make CLEAN skipped!"
222          if test -e output.txt ; then      else
223              rm -f output.txt          (
224          fi              cd $1;
225          printf 'make CLEAN ... ' 2>&1              if test -e output.txt ; then
226          if test -r Makefile ; then                  rm -f output.txt
             $MAKE CLEAN >> make.log 2>&1  
             RETVAL=$?  
             if test "x$RETVAL" != x0 ; then  
                 tail make.log  
                 echo "makeclean: \"make CLEAN\" failed" 1>&2  
                 cp make.log $CDIR"/make.log"  
                 return 1  
227              fi              fi
228          fi              printf 'make CLEAN ... ' 2>&1
229          echo succesful 1>&2              if test -r Makefile ; then
230          exit 0                  $MAKE CLEAN >> make.log 2>&1
231      )                  RETVAL=$?
232                    if test "x$RETVAL" != x0 ; then
233                        tail make.log
234                        echo "makeclean: \"make CLEAN\" failed" 1>&2
235                        cp make.log $CDIR"/make.log"
236                        return 1
237                    fi
238                fi
239                echo succesful 1>&2
240                exit 0
241            )
242        fi
243  }  }
244    
245  makedependmodel()  makedependmodel()
246  {  {
247      # makedependmodel directory      # makedependmodel directory
248      (      if test "x$NODEPEND" = xt ; then
249          cd $1;          echo "make depend skipped!"
250          printf 'make depend ... ' 1>&2      else
251          $MAKE depend >> make.log 2>&1          (
252          RETVAL=$?              cd $1;
253          if test "x$RETVAL" != x0 ; then              printf 'make depend ... ' 1>&2
254              tail make.log              $MAKE depend >> make.log 2>&1
255              echo "makedependmodel: make depend failed" 1>&2              RETVAL=$?
256              cp make.log $CDIR"/make.log"              if test "x$RETVAL" != x0 ; then
257              return 1                  tail make.log
258          else                  echo "makedependmodel: make depend failed" 1>&2
259              echo succesful 1>&2                  cp make.log $CDIR"/make.log"
260          fi                  return 1
261      )              else
262                    echo succesful 1>&2
263                fi
264            )
265        fi
266  }  }
267    
268  makemodel()  makemodel()
# Line 360  show_help() Line 385  show_help()
385  {  {
386      cat - << EOF      cat - << EOF
387  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
388   -help      Show this help message  
389   -quick     Skip "genmake" and "make depend" if the Makefile exists   -help|-h      Show this help message
390   -quiet     Reduce the amount of output   -quiet     Reduce the amount of output
391   -verbose   Produce copious amounts of output   -verbose   Produce copious amounts of output
392   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
393   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.
394   -clean     Do "make CLEAN" after compiling and testing.   -clean     Do "make CLEAN" after compiling and testing.
  -noieee    By default, $0 uses the -ieee option for genmake. This turns it off.  
395   -cleanup   Aggresively removes all model output, executables and object files   -cleanup   Aggresively removes all model output, executables and object files
396              and then exits. Use with care.              and then exits. Use with care.
397    
# Line 399  verbose=1 Line 423  verbose=1
423  clean=0  clean=0
424  expts=''  expts=''
425  # ieee=1  # ieee=1
426  # quick=0  
427    IEEE=
428    if test "x$MITGCM_IEEE" != x ; then
429        IEEE=$MITGCM_IEEE
430    fi
431    
432    
433    CLEANUP=f
434    QUICK=f
435    NOGENMAKE=f
436    NOCLEAN=f
437    NODEPEND=f
438    
439  BASH=  BASH=
440  OPTFILES=  OPTFILE=NONE
441  ADDRESSES=edhill@mitgcm.org  ADDRESSES=
442  TESTDIRS=  TESTDIRS=
443  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
444  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
# Line 431  for ac_option ; do Line 466  for ac_option ; do
466              usage ;;              usage ;;
467                    
468          -optfile | --optfile | -of | --of)          -optfile | --optfile | -of | --of)
469              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
470          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
471              OPTFILES=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
472                    
473          -addr | --addr | -a | --a)          -addr | --addr | -a | --a)
474              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
# Line 460  for ac_option ; do Line 495  for ac_option ; do
495          -make=* | --make=*)          -make=* | --make=*)
496              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
497    
498          -mpi) MPI=t ;;          -clean | --clean)
499                CLEANUP=t ;;
500    
501            -quick | --quick | -q | --q)
502                QUICK=t ;;
503            -nogenmake | --nogenmake | -ng | --ng)
504                NOGENMAKE=t ;;
505            -noclean | --noclean | -nc | --nc)
506                NOCLEAN=t ;;
507            -nodepend | --nodepend | -nd | --nd)
508                NODEPEND=t ;;
509    
510            -mpi) MPI=true ;;
511    
512            -ieee) IEEE=true ;;
513            -noieee) IEEE= ;;
514    
515          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
516          -debug) debug=1 ;;          -debug) debug=1 ;;
         -clean) clean=1 ;;  
517          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
518    
519          -*)          -*)
# Line 480  for ac_option ; do Line 530  for ac_option ; do
530            
531  done  done
532    
533    if test "x$QUICK" = xt ; then
534        NOGENMAKE=t
535        NOCLEAN=t
536        NODEPEND=t
537    fi
538    
539  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
540      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
541  fi  fi
542    
543    if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
544        OPTFILE=$MITGCM_OF
545    fi
546    
547  echo "OK"  echo "OK"
548    
549  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
# Line 522  EOF Line 582  EOF
582    
583  NDIR=0  NDIR=0
584    
585  #  For each optfile...  if test "x$OPTFILE" != xNONE ; then
586  for OPTFILE in $OPTFILES ; do      if test -r $OPTFILE ; then
587            OPTFILE=`pwd`"/$OPTFILE"
     OPTFILE=`pwd`"/$OPTFILE"  
     if test ! -r $OPTFILE ; then  
         echo "Error: can't read optfile \"$OPTFILE\""  
         exit 1  
588      fi      fi
589      echo  fi
590      echo "OPTFILE=$OPTFILE" >> $SUMMARY  echo
591      echo >> $SUMMARY  echo "OPTFILE=$OPTFILE" >> $SUMMARY
592        echo >> $SUMMARY
     #  ...and each test directory...  
     for dir in $TESTDIRS ; do  
593    
594          #  Verify that the testdir exists and contains previous  #  ...and each test directory...
595          #  results in the correct location--or skip this directory!  for dir in $TESTDIRS ; do
596          if test ! -r $dir"/results/output.txt" ; then      
597              echo | tee -a $SUMMARY      #  Cleanup only!
598              echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \      if test "x$CLEANUP" = xt ; then
599                  | tee -a $SUMMARY          if test -r $dir/build/Makefile ; then
600              continue              ( cd $dir/build ; make CLEAN )
601          fi          fi
602            if test -r $dir/input/Makefile ; then
603          #  Is this an MPI run?              ( cd $dir/input ; make CLEAN )
         if test "x$MPI" = xt ; then  
             if test ! -r $dir"/code/CPP_EEOPTIONS.h_mpi" -o ! -r $dir"/code/SIZE.h_mpi" ; then  
                 echo | tee -a $SUMMARY  
                 echo "can't read \"$dir/code/CPP_EEOPTIONS.h_mpi\" or \"$dir/code/SIZE.h_mpi\"" \  
                     | tee -a $SUMMARY  
                 continue  
             else  
                 cp $dir"/code/CPP_EEOPTIONS.h_mpi" $dir"/code/CPP_EEOPTIONS.h"  
                 cp $dir"/code/SIZE.h_mpi" $dir"/code/SIZE.h"  
             fi  
         else  
             if test -r $dir"/code/CPP_EEOPTIONS.h_nompi" ; then  
                 cp $dir"/code/CPP_EEOPTIONS.h_nompi" $dir"/code/CPP_EEOPTIONS.h"  
             fi  
             if test -r $dir"/code/SIZE.h_nompi" ; then  
                 cp $dir"/code/SIZE.h_nompi" $dir"/code/SIZE.h"  
             fi  
604          fi          fi
605            continue
606        fi
607    
608          #  Create an output dir for each OPTFILE/tdir combination      #  Verify that the testdir exists and contains previous
609          CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      #  results in the correct location--or skip this directory!
610          mkdir $CDIR      if test ! -r $dir"/results/output.txt" ; then
611          CDIR=`pwd`"/$CDIR"          echo "can't read \"$dir/results/output.txt\" -- skipping $dir"
612            continue
613        fi
614    
615          #  ...configue, make, run, and compare the output.      echo "-------------------------------------------------------------------------------"
616          echo "-------------------------------------------------------------------------------"      echo
617          echo      echo "Experiment:  $dir"
618          echo "Experiment:  $dir"      echo
619          echo      unset genmake makedepend make run
620          unset genmake makedepend make run      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
         results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'  
         ( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; )  
         if [ -r $dir/build ]; then  
             seperatebuilddir=1  
             builddir=build  
             rundir=build  
             ( cd $dir/build; ln -sf ../input/* . )  
         else  
             seperatebuilddir=0  
             builddir=input  
             rundir=input  
         fi  
621    
622        if [ -r $dir/build ]; then
623            seperatebuilddir=1
624            builddir=build
625            rundir=build
626            ( cd $dir/build; ln -sf ../input/* . )
627        else
628            seperatebuilddir=0
629            builddir=input
630            rundir=input
631        fi
632        
633        CODE_DIR=$dir/code
634        BUILD_DIR=$dir/$builddir
635        MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
636        NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
637    
638        #  Is this an MPI run?
639        if test "x$MPI" = xt ; then
640            FILES=$MPI_FILES
641        else
642            FILES=$NOMPI_FILES
643        fi
644        
645        #  Check to see that we have the files
646        have_files=t
647        for i in $FILES ; do
648            if test ! -r $CODE_DIR/$i ; then
649                echo "Warning: can't read file $CODE_DIR/$i"
650                have_files=f
651            fi
652        done
653        if test "x$have_files" != xt -a "x$MPI" = xt ; then
654            echo "Skipping $dir due to lack of input files (see above warning)"
655            continue
656        fi
657        
658        #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR
659        if test "x$have_files" = xt ; then
660            for i in $FILES ; do
661                cmp $CODE_DIR/$i $BUILD_DIR/$i > /dev/null 2>&1
662                RETVAL=$?
663                if test "x$RETVAL" != x0 ; then
664                    cp $CODE_DIR/$i $BUILD_DIR/$i
665                fi
666            done
667        fi
668        
669        #  Create an output dir for each OPTFILE/tdir combination
670        CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR
671        mkdir $CDIR
672        CDIR=`pwd`"/$CDIR"
673        
674        if test "x$CLEANUP" = xt ; then
675            makeclean $dir/$builddir
676        else
677          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
678              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
679              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
# Line 597  for OPTFILE in $OPTFILES ; do Line 681  for OPTFILE in $OPTFILES ; do
681              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $seperatebuilddir $dir/$rundir \
682              && runmodel $dir/$builddir && run=Y \              && runmodel $dir/$builddir && run=Y \
683              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
684          echo      fi
685          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      
686              ${run:-N} $results      echo
687          echo      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
688          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          ${run:-N} $results
689              ${run:-N} $results >> $SUMMARY      echo
690          echo "fresults='" > $CDIR"/summary.txt"      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
691          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          ${run:-N} $results >> $SUMMARY
692              ${run:-N} $results >> $CDIR"/summary.txt"      echo "fresults='" > $CDIR"/summary.txt"
693          echo "'" >> $CDIR"/summary.txt"      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
694          echo "MACH='$MACH'" >> $CDIR"/summary.txt"          ${run:-N} $results >> $CDIR"/summary.txt"
695          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"      echo "'" >> $CDIR"/summary.txt"
696          echo "DATE='$DATE'" >> $CDIR"/summary.txt"      echo "MACH='$MACH'" >> $CDIR"/summary.txt"
697          echo "tdir='$dir'" >> $CDIR"/summary.txt"      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
698        echo "DATE='$DATE'" >> $CDIR"/summary.txt"
699          (      echo "tdir='$dir'" >> $CDIR"/summary.txt"
700              cd $DRESULTS      
701              tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1      (
702              gzip $NDIR".tar"          cd $DRESULTS
703          )          tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1
704            gzip $NDIR".tar"
705        )
706        
707        if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
708            echo "No mail sent"
709        else
710          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES
711          RETVAL=$?          RETVAL=$?
712          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
# Line 625  for OPTFILE in $OPTFILES ; do Line 714  for OPTFILE in $OPTFILES ; do
714          else          else
715              rm -f $DRESULTS"/"$NDIR".tar*"              rm -f $DRESULTS"/"$NDIR".tar*"
716          fi          fi
717        fi
718    
719          NDIR=$(( $NDIR + 1 ))      echo "-------------------------------------------------------------------------------"
720                
721      done      NDIR=$(( $NDIR + 1 ))
722        
723  done  done
724    
725  rm tmp_cmpnum.f a.out  rm tmp_cmpnum.f a.out

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.2.10

  ViewVC Help
Powered by ViewVC 1.1.22