/[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.8 by edhill, Tue Sep 16 17:46:52 2003 UTC revision 1.21 by edhill, Thu Nov 27 16:15:39 2003 UTC
# Line 1  Line 1 
1  #!/bin/bash  #! /usr/bin/env bash
2  #  #
3  #  $Header$  #  $Header$
4    #  $Name$
5  #  #
6    
7  usage()  usage()
# Line 11  usage() Line 12  usage()
12      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
13      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
14      echo "  (-mpi)                   use MPI input files"      echo "  (-mpi)                   use MPI input files"
15        echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
16        echo "                             (DEF=\"noieee\")"
17      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-optfile=|-of=)STRING   list of optfiles to use"
18      echo "  (-a|-addr)STRING         list of email recipients"      echo "  (-a|-addr) STRING        list of email recipients"
19      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"edhill@mitgcm.org\")"
20      echo "  (-t|-tdir)STRING         list of test dirs to use"      echo "  (-t|-tdir) STRING        list of test dirs to use"
21      echo "                             (DEF=\"\" which builds all)"      echo "                             (DEF=\"\" which builds all)"
22      echo "  (-b|-bash)STRING         location of \"bash\" executable"      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"
23      echo "                             (DEF=\"\" for \"/bin/bash\")"      echo "                             Bourne-compatible \"sh\" shell"
24      echo "  (-c|-command)STRING      command to run"      echo "                             (DEF=\"\" for \"bash\")"
25        echo "  (-command) STRING        command to run"
26      echo "                             (DEF=\"make output.txt\")"      echo "                             (DEF=\"make output.txt\")"
27      echo "  (-m|-make)STRING         command to use for \"make\""      echo "  (-m|-make) STRING        command to use for \"make\""
28      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
29        echo "  (-clean)                 *ONLY* run \"make CLEAN\""
30        echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
31        echo "  (-nogenmake|-ng)         skip the genmake stage"
32        echo "  (-noclean|-nc)           skip the \"make clean\" stage"
33        echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
34      echo      echo
35      echo "and where STRING follows a whitespace-delimited format"      echo "and where STRING follows a whitespace-delimited format"
36      echo "such as:"      echo "such as:"
# Line 37  build_mpack() Line 46  build_mpack()
46      echo -n "building the mpack utility...  "      echo -n "building the mpack utility...  "
47      if test ! -x "$MPACKDIR/mpack" ; then      if test ! -x "$MPACKDIR/mpack" ; then
48          if test ! -d $MPACKDIR ; then          if test ! -d $MPACKDIR ; then
49                echo
50              echo "Error: can't find \"$MPACKDIR\""              echo "Error: can't find \"$MPACKDIR\""
51              echo "  are you sure this program is being run in the correct "              echo "  are you sure this program is being run in the correct "
52              echo "  (that is, \"MITGCM_ROOT\verification\") directory?"              echo "  (that is, \"MITGCM_ROOT\verification\") directory?"
53              exit 1              echo
54                HAVE_MPACK=f
55          fi          fi
56          echo -n "building mpack...  "          echo -n "building mpack...  "
57          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1
# Line 48  build_mpack() Line 59  build_mpack()
59          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
60              echo              echo
61              echo "Error building the mpack tools at: $MPACK_DIR"              echo "Error building the mpack tools at: $MPACK_DIR"
62              exit 1              echo
63                HAVE_MPACK=f
64            else
65                HAVE_MPACK=t
66          fi          fi
67        else
68            HAVE_MPACK=t
69      fi      fi
70      echo "OK"      echo "OK"
71  }  }
# Line 74  testoutput_for_prop() Line 90  testoutput_for_prop()
90          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2
91      fi      fi
92      if [ -r $1/$4/output.txt ]; then      if [ -r $1/$4/output.txt ]; then
93          grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt          grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt
94          lncnt=`wc -l tmp1.txt | awk '{print $1}' `          lncnt=`wc -l tmp1.txt | awk '{print $1}' `
95          if [ $lncnt -lt 3 ]; then          if [ $lncnt -lt 3 ]; then
96              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
# Line 89  testoutput_for_prop() Line 105  testoutput_for_prop()
105      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
106          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2
107      fi      fi
108      grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt      grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt
109      lncnt=`wc -l tmp2.txt | awk '{print $1}' `      lncnt=`wc -l tmp2.txt | awk '{print $1}' `
110      if [ $lncnt -lt 3 ]; then      if [ $lncnt -lt 3 ]; then
111          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
# Line 149  testoutput() Line 165  testoutput()
165      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
166          echo testoutput: cg2dres=$cg2dres 1>&2          echo testoutput: cg2dres=$cg2dres 1>&2
167      fi      fi
       
168      testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?      testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?
169      testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?      testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?
170      testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?      testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?
# Line 174  testoutput() Line 189  testoutput()
189  genmakemodel()  genmakemodel()
190  {  {
191      # genmakemodel directory      # genmakemodel directory
192      GENMAKE2="$BASH ../../../tools/genmake2"      if test "x$NOGENMAKE" = xt ; then
193      (          echo "genmake skipped!"
194          cd $1;      else
195          printf 'genmake ... ' 1>&2          GENMAKE2="$BASH ../../../tools/genmake2"
196          # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1          (
197          $GENMAKE2  -ds --mods=../code "--optfile="$OPTFILE > make.log 2>&1              cd $1;
198          RETVAL=$?              command="$GENMAKE2  -ds -m $MAKE --mods=../code"
199          for i in gm_state gm_optfile gm_local Makefile ; do              if test "x$OPTFILE" != xNONE ; then
200              if test -r $i ; then                  command="$command --optfile=$OPTFILE"
                 cp $i $CDIR  
201              fi              fi
202          done              if test "x$IEEE" != x ; then
203          if test "x$RETVAL" != x0 ; then                  command="$command -ieee"
204              tail make.log              fi
205              echo "genmakemodel: genmake failed" 1>&2              printf 'genmake ... ' 1>&2
206              cp make.log $CDIR              $command > make.log 2>&1
207              return 1              RETVAL=$?
208          else              cp Makefile $CDIR
209              echo "succesful" 1>&2              if test "x$RETVAL" != x0 ; then
210          fi                  tail make.log
211      )                  echo "genmakemodel: genmake failed" 1>&2
212                    cp genmake_* make.log $CDIR
213                    return 1
214                else
215                    echo "successful" 1>&2
216                fi
217            )
218        fi
219  }  }
220    
221  makeclean()  makeclean()
222  {  {
223      # makeclean directory      # makeclean directory
224      (      if test "x$NOCLEAN" = xt ; then
225          cd $1;          echo "make CLEAN skipped!"
226          if test -e output.txt ; then      else
227              rm -f output.txt          (
228          fi              cd $1;
229          printf 'make CLEAN ... ' 2>&1              if test -e output.txt ; then
230          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  
231              fi              fi
232          fi              printf 'make CLEAN ... ' 2>&1
233          echo succesful 1>&2              if test -r Makefile ; then
234          exit 0                  $MAKE CLEAN >> make.log 2>&1
235      )                  RETVAL=$?
236                    if test "x$RETVAL" != x0 ; then
237                        tail make.log
238                        echo "makeclean: \"make CLEAN\" failed" 1>&2
239                        cp make.log $CDIR"/make.log"
240                        return 1
241                    fi
242                fi
243                echo successful 1>&2
244                exit 0
245            )
246        fi
247  }  }
248    
249  makedependmodel()  makedependmodel()
250  {  {
251      # makedependmodel directory      # makedependmodel directory
252      (      if test "x$NODEPEND" = xt ; then
253          cd $1;          echo "make depend skipped!"
254          printf 'make depend ... ' 1>&2      else
255          $MAKE depend >> make.log 2>&1          (
256          RETVAL=$?              cd $1;
257          if test "x$RETVAL" != x0 ; then              printf 'make depend ... ' 1>&2
258              tail make.log              $MAKE depend >> make.log 2>&1
259              echo "makedependmodel: make depend failed" 1>&2              RETVAL=$?
260              cp make.log $CDIR"/make.log"              if test "x$RETVAL" != x0 ; then
261              return 1                  tail make.log
262          else                  echo "makedependmodel: make depend failed" 1>&2
263              echo succesful 1>&2                  cp make.log $CDIR"/make.log"
264          fi                  return 1
265      )              else
266                    echo successful 1>&2
267                fi
268            )
269        fi
270  }  }
271    
272  makemodel()  makemodel()
# Line 255  makemodel() Line 284  makemodel()
284                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
285                  return 1                  return 1
286              else              else
287                  echo succesful 1>&2                  echo successful 1>&2
288              fi              fi
289          fi          fi
290      )      )
# Line 266  linkdata() Line 295  linkdata()
295      # linkdata flag      # linkdata flag
296      #      #
297      # symbolically link data files to run directory      # symbolically link data files to run directory
298      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
299          ( cd $2 ;  ln -sf ../input/* . )          (
300                cd $2
301                files=`( cd ../input ; ls -1 | grep -v CVS )`
302                for i in $files ; do
303                    if test ! -d "../input/"$i ; then
304                        ln -sf "../input/"$i $i
305                    fi
306                done
307            )
308      fi      fi
309  }  }
310    
# Line 279  runmodel() Line 316  runmodel()
316      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
317      (      (
318          cd $1          cd $1
319          printf 'runmodel: ' 1>&2          printf 'runmodel ... ' 1>&2
320          # make output.txt          # make output.txt
321          $COMMAND          $COMMAND >> run.log 2>&1
322          RETVAL=$?          RETVAL=$?
323          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
324                echo successful 1>&2
325              cp output.txt $CDIR"/output.txt"              cp output.txt $CDIR"/output.txt"
326              return 0              return 0
327          else          else
328                tail run.log
329                echo failed 1>&2
330                cp run.log $CDIR"/run.log"
331              return 1              return 1
332          fi          fi
333      )      )
# Line 322  c         print *,int(log10(diff)),diff Line 363  c         print *,int(log10(diff)),diff
363        end        end
364  EOFA  EOFA
365    
366      f77 tmp_cmpnum.f      f77 -o a.out tmp_cmpnum.f
367      if [ -x ./a.out ]; then      if [ -x ./a.out ]; then
368          echo "OK"          echo "OK"
369          return 0          return 0
370      else      else
371          echo          echo
372          echo "createcodelet: failed to compile codelet"          echo "ERROR: failed to compile comparison code"
373          exit 1          exit 1
374      fi      fi
375  }  }
# Line 360  show_help() Line 401  show_help()
401  {  {
402      cat - << EOF      cat - << EOF
403  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
404   -help      Show this help message  
405   -quick     Skip "genmake" and "make depend" if the Makefile exists   -help|-h      Show this help message
406   -quiet     Reduce the amount of output   -quiet     Reduce the amount of output
407   -verbose   Produce copious amounts of output   -verbose   Produce copious amounts of output
408   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
409   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.
410   -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.  
411   -cleanup   Aggresively removes all model output, executables and object files   -cleanup   Aggresively removes all model output, executables and object files
412              and then exits. Use with care.              and then exits. Use with care.
413    
# Line 389  scandirs() Line 429  scandirs()
429    
430    
431  ###############################################################################  ###############################################################################
 ###############################################################################  
 ###############################################################################  
432    
433    
434  #  Default properties  #  Default properties
# Line 399  verbose=1 Line 437  verbose=1
437  clean=0  clean=0
438  expts=''  expts=''
439  # ieee=1  # ieee=1
440  # quick=0  
441    IEEE=
442    if test "x$MITGCM_IEEE" != x ; then
443        IEEE=$MITGCM_IEEE
444    fi
445    
446    
447    CLEANUP=f
448    QUICK=f
449    NOGENMAKE=f
450    NOCLEAN=f
451    NODEPEND=f
452    
453  BASH=  BASH=
454  OPTFILES=  OPTFILE=NONE
455  ADDRESSES=edhill@mitgcm.org  ADDRESSES=
456  TESTDIRS=  TESTDIRS=
457  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
458    HAVE_MPACK=
459  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
460  COMMAND="make output.txt"  COMMAND="make output.txt"
461  MAKE=make  MAKE=make
# Line 431  for ac_option ; do Line 481  for ac_option ; do
481              usage ;;              usage ;;
482                    
483          -optfile | --optfile | -of | --of)          -optfile | --optfile | -of | --of)
484              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
485          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
486              OPTFILES=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
487                    
488          -addr | --addr | -a | --a)          -addr | --addr | -a | --a)
489              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
# Line 460  for ac_option ; do Line 510  for ac_option ; do
510          -make=* | --make=*)          -make=* | --make=*)
511              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
512    
513            -clean | --clean)
514                CLEANUP=t ;;
515    
516            -quick | --quick | -q | --q)
517                QUICK=t ;;
518            -nogenmake | --nogenmake | -ng | --ng)
519                NOGENMAKE=t ;;
520            -noclean | --noclean | -nc | --nc)
521                NOCLEAN=t ;;
522            -nodepend | --nodepend | -nd | --nd)
523                NODEPEND=t ;;
524    
525          -mpi) MPI=t ;;          -mpi) MPI=t ;;
526    
527            -ieee) IEEE=true ;;
528            -noieee) IEEE= ;;
529    
530          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
531          -debug) debug=1 ;;          -debug) debug=1 ;;
         -clean) clean=1 ;;  
532          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
533    
534          -*)          -*)
# Line 480  for ac_option ; do Line 545  for ac_option ; do
545            
546  done  done
547    
548    if test "x$QUICK" = xt ; then
549        NOGENMAKE=t
550        NOCLEAN=t
551        NODEPEND=t
552    fi
553    
554  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
555      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
556  fi  fi
557    
558    if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
559        OPTFILE=$MITGCM_OF
560    fi
561    
562  echo "OK"  echo "OK"
563    
564  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
# Line 506  done Line 581  done
581  mkdir $DRESULTS  mkdir $DRESULTS
582  RETVAL=$?  RETVAL=$?
583  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
584      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
585      exit 1      exit 1
586  fi  fi
587  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
588  date > $SUMMARY  echo -n "Start time:  " >> $SUMMARY
589  cat << EOF >> $SUMMARY  start_date=`date`
590    echo $start_date > $SUMMARY
591    
592    of_path=
593    if test "x$OPTFILE" != xNONE ; then
594        if test -r $OPTFILE ; then
595            # get the path
596            path=${OPTFILE%/*}
597            if test "x$path" = x ; then
598                of_path=`pwd`
599            else
600                of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
601            fi
602            file=${OPTFILE##*/}
603            OPTFILE=$of_path/$file
604            cp $OPTFILE $DRESULTS
605            echo >> $SUMMARY
606            echo "  OPTFILE=$OPTFILE" >> $SUMMARY
607        else
608            echo | tee $SUMMARY
609            echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
610            exit 1
611        fi
612    else
613        echo >> $SUMMARY
614        echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
615        echo "   so the genmake default will be used." >> $SUMMARY
616    fi
617    echo
618    echo >> $SUMMARY
619    cat << EOF | tee -a $SUMMARY
620                  T           S           U           V                  T           S           U           V
621  G D M    c        m  s        m  s        m  s        m  s  G D M    c        m  s        m  s        m  s        m  s
622  E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .  E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .
# Line 520  N n k u  2  i  a  a  d  i  a  a  d  i  a Line 625  N n k u  2  i  a  a  d  i  a  a  d  i  a
625    
626  EOF  EOF
627    
628  NDIR=0  #  ...and each test directory...
629    for dir in $TESTDIRS ; do
 #  For each optfile...  
 for OPTFILE in $OPTFILES ; do  
   
     OPTFILE=`pwd`"/$OPTFILE"  
     if test ! -r $OPTFILE ; then  
         echo "Error: can't read optfile \"$OPTFILE\""  
         exit 1  
     fi  
     echo  
     echo "OPTFILE=$OPTFILE" >> $SUMMARY  
     echo >> $SUMMARY  
630            
631      #  ...and each test directory...      #  Cleanup only!
632      for dir in $TESTDIRS ; do      if test "x$CLEANUP" = xt ; then
633            if test -r $dir/build/Makefile ; then
634          #  Verify that the testdir exists and contains previous              ( cd $dir/build ; make CLEAN )
635          #  results in the correct location--or skip this directory!          fi
636          if test ! -r $dir"/results/output.txt" ; then          if test -r $dir/input/Makefile ; then
637              echo | tee -a $SUMMARY              ( cd $dir/input ; make CLEAN )
             echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \  
                 | tee -a $SUMMARY  
             continue  
         fi  
   
         #  Is this an MPI run?  
         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  
638          fi          fi
639            continue
640        fi
641    
642          #  Create an output dir for each OPTFILE/tdir combination      #  Verify that the testdir exists and contains previous
643          CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      #  results in the correct location--or skip this directory!
644          mkdir $CDIR      if test ! -r $dir"/results/output.txt" ; then
645          CDIR=`pwd`"/$CDIR"          echo "can't read \"$dir/results/output.txt\" -- skipping $dir"
646            continue
647        fi
648    
649          #  ...configue, make, run, and compare the output.      echo "-------------------------------------------------------------------------------"
650          echo "-------------------------------------------------------------------------------"      echo
651          echo      echo "Experiment:  $dir"
652          echo "Experiment:  $dir"      echo
653          echo      unset genmake makedepend make run
654          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  
655    
656        builddir="input"
657        rundir="input"
658        use_seperate_build=0
659        if test -d $dir/build -a -r $dir/build ; then
660            builddir="build"
661            rundir="build"
662            use_seperate_build=1
663            linkdata $use_seperate_build $dir/$rundir
664        fi
665        
666        CODE_DIR=$dir/code
667        BUILD_DIR=$dir/$builddir
668        MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
669        NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
670    
671        #  Is this an MPI run?
672        if test "x$MPI" = xt ; then
673            FILES=$MPI_FILES
674            endings="_mpi"
675        else
676            FILES=$NOMPI_FILES
677            endings="_nompi"
678        fi
679        
680        #  Check to see that we have the files
681        have_files=t
682        for i in $FILES ; do
683            if test ! -r $CODE_DIR/$i ; then
684                echo "Warning: can't read file $CODE_DIR/$i"
685                have_files=f
686            fi
687        done
688        if test "x$have_files" != xt -a "x$MPI" = xt ; then
689            echo "Skipping $dir due to lack of input files (see above warning)"
690            continue
691        fi
692        
693        #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR
694        if test "x$have_files" = xt ; then
695            for i in $FILES ; do
696                sstr="s|$endings||"
697                name=`echo $i | sed -e $sstr `
698                cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
699                RETVAL=$?
700                if test "x$RETVAL" != x0 ; then
701                    cp $CODE_DIR/$i $BUILD_DIR/$name
702                fi
703            done
704        fi
705        
706        #  Create an output dir for each OPTFILE/tdir combination
707        rel_CDIR=$DRESULTS"/"$dir
708        mkdir $rel_CDIR
709        CDIR=`pwd`"/$rel_CDIR"
710        
711        if test "x$CLEANUP" = xt ; then
712            makeclean $dir/$builddir
713        else
714          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
715              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
716              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
717              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
718              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $use_seperate_build $dir/$rundir \
719              && runmodel $dir/$builddir && run=Y \              && runmodel $dir/$rundir && run=Y \
720              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
721          echo      fi
722          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      
723              ${run:-N} $results      echo
724          echo      fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
725          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      echo
726              ${run:-N} $results >> $SUMMARY      echo "$fres" >> $SUMMARY
727          echo "fresults='" > $CDIR"/summary.txt"      echo "fresults='$fres'" > $CDIR"/summary.txt"
728          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      echo "MACH='$MACH'" >> $CDIR"/summary.txt"
729              ${run:-N} $results >> $CDIR"/summary.txt"      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
730          echo "'" >> $CDIR"/summary.txt"      echo "DATE='$DATE'" >> $CDIR"/summary.txt"
731          echo "MACH='$MACH'" >> $CDIR"/summary.txt"      echo "tdir='$dir'" >> $CDIR"/summary.txt"
732          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"      
733          echo "DATE='$DATE'" >> $CDIR"/summary.txt"      echo "-------------------------------------------------------------------------------"
734          echo "tdir='$dir'" >> $CDIR"/summary.txt"      
735    done
         (  
             cd $DRESULTS  
             tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1  
             gzip $NDIR".tar"  
         )  
736    
737          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES  echo -n "Start time:  " >> $SUMMARY
738    echo $start_date >> $SUMMARY
739    echo -n "End time:    " >> $SUMMARY
740    date >> $SUMMARY
741    
742    #  If addresses were supplied and mpack built successfully, then try
743    #  to send email using mpack.
744    if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
745        echo "No results email was sent."
746    else
747        if test "x$HAVE_MPACK" = xt ; then
748            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
749                && gzip $DRESULTS".tar" \
750                && $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES
751          RETVAL=$?          RETVAL=$?
752          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
753              echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"              echo
754                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
755                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
756                echo "  summary of results from the directory \"$DRESULTS\"."
757                echo
758          else          else
759              rm -f $DRESULTS"/"$NDIR".tar*"              echo
760                echo "An email containing results was sent to the following addresses:"
761                echo "  \"$ADDRESSES\""
762                echo
763          fi          fi
764            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
765          NDIR=$(( $NDIR + 1 ))          test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
766                fi
767      done  fi
 done  
768    
769  rm tmp_cmpnum.f a.out  rm tmp_cmpnum.f a.out
770    
771  cat $SUMMARY  if test "x$CLEANUP" != xt ; then
772        cat $SUMMARY
773        if test -e tr.out ; then
774            mv tr.out tr.out.old
775        fi
776        cat $SUMMARY > tr.out
777    fi
778    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.22