/[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.2.1 by edhill, Fri Oct 3 02:18:21 2003 UTC revision 1.23 by edhill, Sat Nov 29 01:45:25 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\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
31      echo "  (-nogenmake|-ng)         skip the genmake stage"      echo "  (-nogenmake|-ng)         skip the genmake stage"
32      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-noclean|-nc)           skip the \"make clean\" stage"
# Line 41  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 52  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  }  }
72    
 compare_lines()  
 {  
     # use codelet to compare lines  
     if [ $verbose -gt 1 ]; then  
         cat tmp3.txt 1>&2  
     fi  
     return `./a.out < tmp3.txt`  
 }  
   
73  testoutput_for_prop()  testoutput_for_prop()
74  {  {
75      # testoutput_for_prop dir s1 label subdir      # testoutput_for_prop dir s1 label subdir
# Line 78  testoutput_for_prop() Line 81  testoutput_for_prop()
81          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2
82      fi      fi
83      if [ -r $1/$4/output.txt ]; then      if [ -r $1/$4/output.txt ]; then
84          grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt          grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt
85          lncnt=`wc -l tmp1.txt | awk '{print $1}' `          lncnt=`wc -l tmp1.txt | awk '{print $1}' `
86          if [ $lncnt -lt 3 ]; then          if [ $lncnt -lt 3 ]; then
87              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
# Line 93  testoutput_for_prop() Line 96  testoutput_for_prop()
96      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
97          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2
98      fi      fi
99      grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt      grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt
100      lncnt=`wc -l tmp2.txt | awk '{print $1}' `      lncnt=`wc -l tmp2.txt | awk '{print $1}' `
101      if [ $lncnt -lt 3 ]; then      if [ $lncnt -lt 3 ]; then
102          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
# Line 108  testoutput_for_prop() Line 111  testoutput_for_prop()
111      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
112          echo testoutput_for_prop: compare_lines 1>&2          echo testoutput_for_prop: compare_lines 1>&2
113      fi      fi
114      compare_lines      if [ $verbose -gt 1 ]; then
115      digits_of_similarity=$?          cat tmp3.txt 1>&2
116        fi
117        echo "-1" >> tmp3.txt
118        # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
119        cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
120        digits_of_similarity=`./tmp_cmpnum < tmp4.txt`
121      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
122          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
123              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2
# Line 120  testoutput_for_prop() Line 128  testoutput_for_prop()
128              echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2              echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2
129          fi          fi
130      fi      fi
131      rm tmp1.txt tmp2.txt tmp3.txt      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
132            
133      return $digits_of_similarity      return $digits_of_similarity
134  }  }
# Line 153  testoutput() Line 161  testoutput()
161      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
162          echo testoutput: cg2dres=$cg2dres 1>&2          echo testoutput: cg2dres=$cg2dres 1>&2
163      fi      fi
       
164      testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?      testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?
165      testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?      testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?
166      testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?      testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?
# Line 184  genmakemodel() Line 191  genmakemodel()
191          GENMAKE2="$BASH ../../../tools/genmake2"          GENMAKE2="$BASH ../../../tools/genmake2"
192          (          (
193              cd $1;              cd $1;
194                command="$GENMAKE2  -ds -m $MAKE --mods=../code"
195                if test "x$OPTFILE" != xNONE ; then
196                    command="$command --optfile=$OPTFILE"
197                fi
198                if test "x$IEEE" != x ; then
199                    command="$command -ieee"
200                fi
201              printf 'genmake ... ' 1>&2              printf 'genmake ... ' 1>&2
202              # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1              $command > make.log 2>&1
             $GENMAKE2  -ds -m $MAKE --mods=../code "--optfile="$OPTFILE > make.log 2>&1  
203              RETVAL=$?              RETVAL=$?
204              for i in gm_state gm_optfile gm_local Makefile ; do              cp Makefile $CDIR
                 if test -r $i ; then  
                     cp $i $CDIR  
                 fi  
             done  
205              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
206                  tail make.log                  tail make.log
207                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed" 1>&2
208                  cp make.log $CDIR                  cp genmake_* make.log $CDIR
209                  return 1                  return 1
210              else              else
211                  echo "succesful" 1>&2                  echo "successful" 1>&2
212              fi              fi
213          )          )
214      fi      fi
# Line 227  makeclean() Line 236  makeclean()
236                      return 1                      return 1
237                  fi                  fi
238              fi              fi
239              echo succesful 1>&2              echo successful 1>&2
240              exit 0              exit 0
241          )          )
242      fi      fi
# Line 250  makedependmodel() Line 259  makedependmodel()
259                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
260                  return 1                  return 1
261              else              else
262                  echo succesful 1>&2                  echo successful 1>&2
263              fi              fi
264          )          )
265      fi      fi
# Line 271  makemodel() Line 280  makemodel()
280                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
281                  return 1                  return 1
282              else              else
283                  echo succesful 1>&2                  echo successful 1>&2
284              fi              fi
285          fi          fi
286      )      )
# Line 282  linkdata() Line 291  linkdata()
291      # linkdata flag      # linkdata flag
292      #      #
293      # symbolically link data files to run directory      # symbolically link data files to run directory
294      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
295          ( cd $2 ;  ln -sf ../input/* . )          (
296                cd $2
297                files=`( cd ../input ; ls -1 | grep -v CVS )`
298                for i in $files ; do
299                    if test ! -d "../input/"$i ; then
300                        ln -sf "../input/"$i $i
301                    fi
302                done
303            )
304      fi      fi
305  }  }
306    
# Line 295  runmodel() Line 312  runmodel()
312      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
313      (      (
314          cd $1          cd $1
315          printf 'runmodel: ' 1>&2          printf 'runmodel ... ' 1>&2
316          # make output.txt          # make output.txt
317          $COMMAND          $COMMAND >> run.log 2>&1
318          RETVAL=$?          RETVAL=$?
319          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
320                echo successful 1>&2
321              cp output.txt $CDIR"/output.txt"              cp output.txt $CDIR"/output.txt"
322              return 0              return 0
323          else          else
324                tail run.log
325                echo failed 1>&2
326                cp run.log $CDIR"/run.log"
327              return 1              return 1
328          fi          fi
329      )      )
# Line 313  createcodelet() Line 334  createcodelet()
334      # create codelet for comparing model output      # create codelet for comparing model output
335    
336      echo -n "creating the comparison code...  "      echo -n "creating the comparison code...  "
337      cat > tmp_cmpnum.f <<EOFA      cat > tmp_cmpnum.c <<EOF
338        program cmpnum  #include <stdio.h>
339        implicit none  #include <math.h>
340        real*8 a,b,diff  int main( int argc, char** argv )  {
341        integer linnum,best    int linnum,best;
342        best=-16    double a,b,diff;
343    99  read(*,*,end=70,err=60) linnum,a,b    best = -16;
344        diff=0.5*(abs(a)+abs(b))    while( 1 )  {
345  c     print *,a,b,diff,abs(a-b)/diff      scanf("%d", &linnum);
346        if (diff.gt.1.e-12) then      if (linnum == -1)  break;
347          diff=abs(a-b)/diff      scanf("%lf", &a);  scanf("%lf", &b);
348          if (diff.gt.0.) then      diff = 0.5*(fabs(a)+fabs(b));
349  c         print *,int(log10(diff)),diff      if (diff > 1.e-12) {
350            linnum=int(log10(diff))        diff=fabs(a-b)/diff;
351            best=max(best,linnum)        if (diff > 0.0) {
352          endif          linnum = (int)log10(diff);
353        else          best = (best > linnum) ? best : linnum;
354          if (best.eq.-16.and.diff.ne.0.) best=-22        }
355        endif        else {
356        goto 99          if (best == -16 && diff != 0)  best = -22;
357    60  stop 'cmpnum: An error occured reading a,b'        }
358    70  print *,-best      }
359        end    }
360  EOFA    printf("%d\n", -best);
361      return 0;
362    }
363    EOF
364        cc -o tmp_cmpnum tmp_cmpnum.c -lm
365    
366      f77 tmp_cmpnum.f      if [ -x ./tmp_cmpnum ]; then
     if [ -x ./a.out ]; then  
367          echo "OK"          echo "OK"
368          return 0          return 0
369      else      else
370          echo          echo
371          echo "createcodelet: failed to compile codelet"          echo "ERROR: failed to compile comparison code"
372          exit 1          exit 1
373      fi      fi
374  }  }
# Line 383  $0 [-help] [-quick] [-verbose] dir1 [dir Line 407  $0 [-help] [-quick] [-verbose] dir1 [dir
407   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
408   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.
409   -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.  
410   -cleanup   Aggresively removes all model output, executables and object files   -cleanup   Aggresively removes all model output, executables and object files
411              and then exits. Use with care.              and then exits. Use with care.
412    
# Line 405  scandirs() Line 428  scandirs()
428    
429    
430  ###############################################################################  ###############################################################################
 ###############################################################################  
 ###############################################################################  
431    
432    
433  #  Default properties  #  Default properties
# Line 416  clean=0 Line 437  clean=0
437  expts=''  expts=''
438  # ieee=1  # ieee=1
439    
440  QUICK=f  IEEE=
441    if test "x$MITGCM_IEEE" != x ; then
442        IEEE=$MITGCM_IEEE
443    fi
444    
445    
446  CLEANUP=f  CLEANUP=f
447    QUICK=f
448  NOGENMAKE=f  NOGENMAKE=f
449  NOCLEAN=f  NOCLEAN=f
450  NODEPEND=f  NODEPEND=f
451    
452  BASH=  BASH=
453  OPTFILES=  OPTFILE=NONE
454  ADDRESSES=  ADDRESSES=
455  TESTDIRS=  TESTDIRS=
456  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
457    HAVE_MPACK=
458  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
459  COMMAND="rm -f output.txt; make output.txt"  COMMAND="make output.txt"
460  MAKE=make  MAKE=make
461  MPI=f  MPI=f
462    
# Line 452  for ac_option ; do Line 480  for ac_option ; do
480              usage ;;              usage ;;
481                    
482          -optfile | --optfile | -of | --of)          -optfile | --optfile | -of | --of)
483              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
484          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
485              OPTFILES=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
486                    
487          -addr | --addr | -a | --a)          -addr | --addr | -a | --a)
488              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
# Line 481  for ac_option ; do Line 509  for ac_option ; do
509          -make=* | --make=*)          -make=* | --make=*)
510              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
511    
512            -clean | --clean)
513                CLEANUP=t ;;
514    
515          -quick | --quick | -q | --q)          -quick | --quick | -q | --q)
516              QUICK=t ;;              QUICK=t ;;
517          -nogenmake | --nogenmake | -ng | --ng)          -nogenmake | --nogenmake | -ng | --ng)
# Line 491  for ac_option ; do Line 522  for ac_option ; do
522              NODEPEND=t ;;              NODEPEND=t ;;
523    
524          -mpi) MPI=t ;;          -mpi) MPI=t ;;
525    
526            -ieee) IEEE=true ;;
527            -noieee) IEEE= ;;
528    
529          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
530          -debug) debug=1 ;;          -debug) debug=1 ;;
         -clean) clean=1 ;;  
531          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
532    
533          -*)          -*)
# Line 520  if test "x$TESTDIRS" = x ; then Line 554  if test "x$TESTDIRS" = x ; then
554      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
555  fi  fi
556    
557  if test "x$OPTFILES" = x ; then  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
558      OPTFILES=$MITGCM_OF      OPTFILE=$MITGCM_OF
 fi  
 if test "x$OPTFILES" = x ; then  
     echo "Error: please specify an optfile using either the command-line or"  
     echo "  the MITGCM_OF environment variable.  Also, examples are located "  
     echo "  in \$ROOTDIR/tools/build_options"  
     exit 1  
559  fi  fi
560    
561  echo "OK"  echo "OK"
# Line 552  done Line 580  done
580  mkdir $DRESULTS  mkdir $DRESULTS
581  RETVAL=$?  RETVAL=$?
582  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
583      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
584      exit 1      exit 1
585  fi  fi
586  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
587  date > $SUMMARY  echo -n "Start time:  " >> $SUMMARY
588  cat << EOF >> $SUMMARY  start_date=`date`
589    echo $start_date > $SUMMARY
590    
591    of_path=
592    if test "x$OPTFILE" != xNONE ; then
593        if test -r $OPTFILE ; then
594            # get the path
595            path=${OPTFILE%/*}
596            if test "x$path" = x ; then
597                of_path=`pwd`
598            else
599                of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
600            fi
601            file=${OPTFILE##*/}
602            OPTFILE=$of_path/$file
603            cp $OPTFILE $DRESULTS
604            echo >> $SUMMARY
605            echo "  OPTFILE=$OPTFILE" >> $SUMMARY
606        else
607            echo | tee $SUMMARY
608            echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
609            exit 1
610        fi
611    else
612        echo >> $SUMMARY
613        echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
614        echo "   so the genmake default will be used." >> $SUMMARY
615    fi
616    echo
617    echo >> $SUMMARY
618    cat << EOF | tee -a $SUMMARY
619                  T           S           U           V                  T           S           U           V
620  G D M    c        m  s        m  s        m  s        m  s  G D M    c        m  s        m  s        m  s        m  s
621  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 566  N n k u  2  i  a  a  d  i  a  a  d  i  a Line 624  N n k u  2  i  a  a  d  i  a  a  d  i  a
624    
625  EOF  EOF
626    
627  NDIR=0  #  ...and each test directory...
628    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  
629            
630      #  ...and each test directory...      #  Cleanup only!
631      for dir in $TESTDIRS ; do      if test "x$CLEANUP" = xt ; then
632            if test -r $dir/build/Makefile ; then
633          #  Verify that the testdir exists and contains previous              ( cd $dir/build ; make CLEAN )
         #  results in the correct location--or skip this directory!  
         if test ! -r $dir"/results/output.txt" ; then  
             echo | tee -a $SUMMARY  
             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  
634          fi          fi
635            if test -r $dir/input/Makefile ; then
636          #  Create an output dir for each OPTFILE/tdir combination              ( cd $dir/input ; make CLEAN )
         CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR  
         mkdir $CDIR  
         CDIR=`pwd`"/$CDIR"  
   
         #  ...configue, make, run, and compare the output.  
         echo "-------------------------------------------------------------------------------"  
         echo  
         echo "Experiment:  $dir"  
         echo  
         unset genmake makedepend make run  
         results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'  
   
         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  
   
         if test "x$CLEANUP" = xt ; then  
             makeclean $dir/$builddir  
         else  
             genmakemodel $dir/$builddir && genmake=Y \  
                 && makeclean $dir/$builddir \  
                 && makedependmodel $dir/$builddir && makedepend=Y \  
                 && makemodel $dir/$builddir && make=Y \  
                 && linkdata $seperatebuilddir $dir/$rundir \  
                 && runmodel $dir/$builddir && run=Y \  
                 && results=`testoutput $dir $rundir`  
637          fi          fi
638            continue
639        fi
640    
641          echo      #  Verify that the testdir exists and contains previous
642          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      #  results in the correct location--or skip this directory!
643              ${run:-N} $results      if test ! -r $dir"/results/output.txt" ; then
644          echo          echo "can't read \"$dir/results/output.txt\" -- skipping $dir"
645          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          continue
646              ${run:-N} $results >> $SUMMARY      fi
         echo "fresults='" > $CDIR"/summary.txt"  
         formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \  
             ${run:-N} $results >> $CDIR"/summary.txt"  
         echo "'" >> $CDIR"/summary.txt"  
         echo "MACH='$MACH'" >> $CDIR"/summary.txt"  
         echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
         echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
         echo "tdir='$dir'" >> $CDIR"/summary.txt"  
647    
648          (      echo "-------------------------------------------------------------------------------"
649              cd $DRESULTS      echo
650              tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1      echo "Experiment:  $dir"
651              gzip $NDIR".tar"      echo
652          )      unset genmake makedepend make run
653        results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
654    
655          if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then      builddir="input"
656              echo "No mail sent"      rundir="input"
657          else      use_seperate_build=0
658              $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES      if test -d $dir/build -a -r $dir/build ; then
659            builddir="build"
660            rundir="build"
661            use_seperate_build=1
662            linkdata $use_seperate_build $dir/$rundir
663        fi
664        
665        CODE_DIR=$dir/code
666        BUILD_DIR=$dir/$builddir
667        MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
668        NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
669    
670        #  Is this an MPI run?
671        if test "x$MPI" = xt ; then
672            FILES=$MPI_FILES
673            endings="_mpi"
674        else
675            FILES=$NOMPI_FILES
676            endings="_nompi"
677        fi
678        
679        #  Check to see that we have the files
680        have_files=t
681        for i in $FILES ; do
682            if test ! -r $CODE_DIR/$i ; then
683                echo "Warning: can't read file $CODE_DIR/$i"
684                have_files=f
685            fi
686        done
687        if test "x$have_files" != xt -a "x$MPI" = xt ; then
688            echo "Skipping $dir due to lack of input files (see above warning)"
689            continue
690        fi
691        
692        #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR
693        if test "x$have_files" = xt ; then
694            for i in $FILES ; do
695                sstr="s|$endings||"
696                name=`echo $i | sed -e $sstr `
697                cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
698              RETVAL=$?              RETVAL=$?
699              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
700                  echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"                  cp $CODE_DIR/$i $BUILD_DIR/$name
             else  
                 rm -f $DRESULTS"/"$NDIR".tar*"  
701              fi              fi
702          fi          done
703        fi
704          NDIR=$(( $NDIR + 1 ))      
705                #  Create an output dir for each OPTFILE/tdir combination
706      done      rel_CDIR=$DRESULTS"/"$dir
707        mkdir $rel_CDIR
708        CDIR=`pwd`"/$rel_CDIR"
709        
710        if test "x$CLEANUP" = xt ; then
711            makeclean $dir/$builddir
712        else
713            genmakemodel $dir/$builddir && genmake=Y \
714                && makeclean $dir/$builddir \
715                && makedependmodel $dir/$builddir && makedepend=Y \
716                && makemodel $dir/$builddir && make=Y \
717                && linkdata $use_seperate_build $dir/$rundir \
718                && runmodel $dir/$rundir && run=Y \
719                && results=`testoutput $dir $rundir`
720        fi
721        
722        echo
723        fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
724        echo
725        echo "$fres" >> $SUMMARY
726        echo "fresults='$fres'" > $CDIR"/summary.txt"
727        echo "MACH='$MACH'" >> $CDIR"/summary.txt"
728        echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
729        echo "DATE='$DATE'" >> $CDIR"/summary.txt"
730        echo "tdir='$dir'" >> $CDIR"/summary.txt"
731        
732        echo "-------------------------------------------------------------------------------"
733        
734  done  done
735    
736  rm tmp_cmpnum.f a.out  echo -n "Start time:  " >> $SUMMARY
737    echo $start_date >> $SUMMARY
738    echo -n "End time:    " >> $SUMMARY
739    date >> $SUMMARY
740    
741    #  If addresses were supplied and mpack built successfully, then try
742    #  to send email using mpack.
743    if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
744        echo "No results email was sent."
745    else
746        if test "x$HAVE_MPACK" = xt ; then
747            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
748                && gzip $DRESULTS".tar" \
749                && $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES
750            RETVAL=$?
751            if test "x$RETVAL" != x0 ; then
752                echo
753                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
754                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
755                echo "  summary of results from the directory \"$DRESULTS\"."
756                echo
757            else
758                echo
759                echo "An email containing results was sent to the following addresses:"
760                echo "  \"$ADDRESSES\""
761                echo
762            fi
763            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
764            test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
765        fi
766    fi
767    
768  cat $SUMMARY  # rm -f tmp_cmpnum.f a.out
769    rm -f tmp_cmpnum.c tmp_cmpnum
770    
771    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.9.2.1  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.22