/[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.22 by edhill, Sat Nov 29 00:58:43 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 104  testoutput_for_prop() Line 120  testoutput_for_prop()
120      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
121          echo testoutput_for_prop: compare_lines 1>&2          echo testoutput_for_prop: compare_lines 1>&2
122      fi      fi
123      compare_lines      if [ $verbose -gt 1 ]; then
124      digits_of_similarity=$?          cat tmp3.txt 1>&2
125        fi
126        echo "-1" >> tmp3.txt
127        digits_of_similarity=`./tmp_cmpnum < tmp3.txt`
128      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
129          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
130              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 149  testoutput() Line 168  testoutput()
168      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
169          echo testoutput: cg2dres=$cg2dres 1>&2          echo testoutput: cg2dres=$cg2dres 1>&2
170      fi      fi
       
171      testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?      testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?
172      testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?      testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?
173      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 192  testoutput()
192  genmakemodel()  genmakemodel()
193  {  {
194      # genmakemodel directory      # genmakemodel directory
195      GENMAKE2="$BASH ../../../tools/genmake2"      if test "x$NOGENMAKE" = xt ; then
196      (          echo "genmake skipped!"
197          cd $1;      else
198          printf 'genmake ... ' 1>&2          GENMAKE2="$BASH ../../../tools/genmake2"
199          # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1          (
200          $GENMAKE2  -ds -m $MAKE --mods=../code "--optfile="$OPTFILE > make.log 2>&1              cd $1;
201          RETVAL=$?              command="$GENMAKE2  -ds -m $MAKE --mods=../code"
202          for i in gm_state gm_optfile gm_local Makefile ; do              if test "x$OPTFILE" != xNONE ; then
203              if test -r $i ; then                  command="$command --optfile=$OPTFILE"
                 cp $i $CDIR  
204              fi              fi
205          done              if test "x$IEEE" != x ; then
206          if test "x$RETVAL" != x0 ; then                  command="$command -ieee"
207              tail make.log              fi
208              echo "genmakemodel: genmake failed" 1>&2              printf 'genmake ... ' 1>&2
209              cp make.log $CDIR              $command > make.log 2>&1
210              return 1              RETVAL=$?
211          else              cp Makefile $CDIR
212              echo "succesful" 1>&2              if test "x$RETVAL" != x0 ; then
213          fi                  tail make.log
214      )                  echo "genmakemodel: genmake failed" 1>&2
215                    cp genmake_* make.log $CDIR
216                    return 1
217                else
218                    echo "successful" 1>&2
219                fi
220            )
221        fi
222  }  }
223    
224  makeclean()  makeclean()
225  {  {
226      # makeclean directory      # makeclean directory
227      (      if test "x$NOCLEAN" = xt ; then
228          cd $1;          echo "make CLEAN skipped!"
229          if test -e output.txt ; then      else
230              rm -f output.txt          (
231          fi              cd $1;
232          printf 'make CLEAN ... ' 2>&1              if test -e output.txt ; then
233          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  
234              fi              fi
235          fi              printf 'make CLEAN ... ' 2>&1
236          echo succesful 1>&2              if test -r Makefile ; then
237          exit 0                  $MAKE CLEAN >> make.log 2>&1
238      )                  RETVAL=$?
239                    if test "x$RETVAL" != x0 ; then
240                        tail make.log
241                        echo "makeclean: \"make CLEAN\" failed" 1>&2
242                        cp make.log $CDIR"/make.log"
243                        return 1
244                    fi
245                fi
246                echo successful 1>&2
247                exit 0
248            )
249        fi
250  }  }
251    
252  makedependmodel()  makedependmodel()
253  {  {
254      # makedependmodel directory      # makedependmodel directory
255      (      if test "x$NODEPEND" = xt ; then
256          cd $1;          echo "make depend skipped!"
257          printf 'make depend ... ' 1>&2      else
258          $MAKE depend >> make.log 2>&1          (
259          RETVAL=$?              cd $1;
260          if test "x$RETVAL" != x0 ; then              printf 'make depend ... ' 1>&2
261              tail make.log              $MAKE depend >> make.log 2>&1
262              echo "makedependmodel: make depend failed" 1>&2              RETVAL=$?
263              cp make.log $CDIR"/make.log"              if test "x$RETVAL" != x0 ; then
264              return 1                  tail make.log
265          else                  echo "makedependmodel: make depend failed" 1>&2
266              echo succesful 1>&2                  cp make.log $CDIR"/make.log"
267          fi                  return 1
268      )              else
269                    echo successful 1>&2
270                fi
271            )
272        fi
273  }  }
274    
275  makemodel()  makemodel()
# Line 255  makemodel() Line 287  makemodel()
287                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
288                  return 1                  return 1
289              else              else
290                  echo succesful 1>&2                  echo successful 1>&2
291              fi              fi
292          fi          fi
293      )      )
# Line 266  linkdata() Line 298  linkdata()
298      # linkdata flag      # linkdata flag
299      #      #
300      # symbolically link data files to run directory      # symbolically link data files to run directory
301      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
302          ( cd $2 ;  ln -sf ../input/* . )          (
303                cd $2
304                files=`( cd ../input ; ls -1 | grep -v CVS )`
305                for i in $files ; do
306                    if test ! -d "../input/"$i ; then
307                        ln -sf "../input/"$i $i
308                    fi
309                done
310            )
311      fi      fi
312  }  }
313    
# Line 279  runmodel() Line 319  runmodel()
319      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
320      (      (
321          cd $1          cd $1
322          printf 'runmodel: ' 1>&2          printf 'runmodel ... ' 1>&2
323          # make output.txt          # make output.txt
324          $COMMAND          $COMMAND >> run.log 2>&1
325          RETVAL=$?          RETVAL=$?
326          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
327                echo successful 1>&2
328              cp output.txt $CDIR"/output.txt"              cp output.txt $CDIR"/output.txt"
329              return 0              return 0
330          else          else
331                tail run.log
332                echo failed 1>&2
333                cp run.log $CDIR"/run.log"
334              return 1              return 1
335          fi          fi
336      )      )
# Line 297  createcodelet() Line 341  createcodelet()
341      # create codelet for comparing model output      # create codelet for comparing model output
342    
343      echo -n "creating the comparison code...  "      echo -n "creating the comparison code...  "
344      cat > tmp_cmpnum.f <<EOFA      cat > tmp_cmpnum.c <<EOF
345        program cmpnum  #include <stdio.h>
346        implicit none  #include <math.h>
347        real*8 a,b,diff  int main( int argc, char** argv )  {
348        integer linnum,best    int linnum,best;
349        best=-16    double a,b,diff;
350    99  read(*,*,end=70,err=60) linnum,a,b    best = -16;
351        diff=0.5*(abs(a)+abs(b))    while( 1 )  {
352  c     print *,a,b,diff,abs(a-b)/diff      scanf("%d", &linnum);
353        if (diff.gt.1.e-12) then      if (linnum == -1)  break;
354          diff=abs(a-b)/diff      scanf("%lf", &a);  scanf("%lf", &b);
355          if (diff.gt.0.) then      diff = 0.5*(fabs(a)+fabs(b));
356  c         print *,int(log10(diff)),diff      if (diff > 1.e-12) {
357            linnum=int(log10(diff))        diff=fabs(a-b)/diff;
358            best=max(best,linnum)        if (diff > 0.0) {
359          endif          linnum = (int)log10(diff);
360        else          best = (best > linnum) ? best : linnum;
361          if (best.eq.-16.and.diff.ne.0.) best=-22        }
362        endif        else {
363        goto 99          if (best == -16 && diff != 0)  best = -22;
364    60  stop 'cmpnum: An error occured reading a,b'        }
365    70  print *,-best      }
366        end    }
367  EOFA    printf("%d\n", -best);
368      return 0;
369    }
370    EOF
371        cc -o tmp_cmpnum tmp_cmpnum.c -lm
372    
373      f77 tmp_cmpnum.f      if [ -x ./tmp_cmpnum ]; then
     if [ -x ./a.out ]; then  
374          echo "OK"          echo "OK"
375          return 0          return 0
376      else      else
377          echo          echo
378          echo "createcodelet: failed to compile codelet"          echo "ERROR: failed to compile comparison code"
379          exit 1          exit 1
380      fi      fi
381  }  }
# Line 360  show_help() Line 407  show_help()
407  {  {
408      cat - << EOF      cat - << EOF
409  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
410   -help      Show this help message  
411   -quick     Skip "genmake" and "make depend" if the Makefile exists   -help|-h      Show this help message
412   -quiet     Reduce the amount of output   -quiet     Reduce the amount of output
413   -verbose   Produce copious amounts of output   -verbose   Produce copious amounts of output
414   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
415   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.
416   -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.  
417   -cleanup   Aggresively removes all model output, executables and object files   -cleanup   Aggresively removes all model output, executables and object files
418              and then exits. Use with care.              and then exits. Use with care.
419    
# Line 389  scandirs() Line 435  scandirs()
435    
436    
437  ###############################################################################  ###############################################################################
 ###############################################################################  
 ###############################################################################  
438    
439    
440  #  Default properties  #  Default properties
# Line 399  verbose=1 Line 443  verbose=1
443  clean=0  clean=0
444  expts=''  expts=''
445  # ieee=1  # ieee=1
446  # quick=0  
447    IEEE=
448    if test "x$MITGCM_IEEE" != x ; then
449        IEEE=$MITGCM_IEEE
450    fi
451    
452    
453    CLEANUP=f
454    QUICK=f
455    NOGENMAKE=f
456    NOCLEAN=f
457    NODEPEND=f
458    
459  BASH=  BASH=
460  OPTFILES=  OPTFILE=NONE
461  ADDRESSES=edhill@mitgcm.org  ADDRESSES=
462  TESTDIRS=  TESTDIRS=
463  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
464    HAVE_MPACK=
465  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
466  COMMAND="make output.txt"  COMMAND="make output.txt"
467  MAKE=make  MAKE=make
# Line 431  for ac_option ; do Line 487  for ac_option ; do
487              usage ;;              usage ;;
488                    
489          -optfile | --optfile | -of | --of)          -optfile | --optfile | -of | --of)
490              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
491          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
492              OPTFILES=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
493                    
494          -addr | --addr | -a | --a)          -addr | --addr | -a | --a)
495              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
# Line 460  for ac_option ; do Line 516  for ac_option ; do
516          -make=* | --make=*)          -make=* | --make=*)
517              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
518    
519            -clean | --clean)
520                CLEANUP=t ;;
521    
522            -quick | --quick | -q | --q)
523                QUICK=t ;;
524            -nogenmake | --nogenmake | -ng | --ng)
525                NOGENMAKE=t ;;
526            -noclean | --noclean | -nc | --nc)
527                NOCLEAN=t ;;
528            -nodepend | --nodepend | -nd | --nd)
529                NODEPEND=t ;;
530    
531          -mpi) MPI=t ;;          -mpi) MPI=t ;;
532    
533            -ieee) IEEE=true ;;
534            -noieee) IEEE= ;;
535    
536          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
537          -debug) debug=1 ;;          -debug) debug=1 ;;
         -clean) clean=1 ;;  
538          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
539    
540          -*)          -*)
# Line 480  for ac_option ; do Line 551  for ac_option ; do
551            
552  done  done
553    
554    if test "x$QUICK" = xt ; then
555        NOGENMAKE=t
556        NOCLEAN=t
557        NODEPEND=t
558    fi
559    
560  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
561      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
562  fi  fi
563    
564    if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
565        OPTFILE=$MITGCM_OF
566    fi
567    
568  echo "OK"  echo "OK"
569    
570  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
# Line 506  done Line 587  done
587  mkdir $DRESULTS  mkdir $DRESULTS
588  RETVAL=$?  RETVAL=$?
589  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
590      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
591      exit 1      exit 1
592  fi  fi
593  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
594  date > $SUMMARY  echo -n "Start time:  " >> $SUMMARY
595  cat << EOF >> $SUMMARY  start_date=`date`
596    echo $start_date > $SUMMARY
597    
598    of_path=
599    if test "x$OPTFILE" != xNONE ; then
600        if test -r $OPTFILE ; then
601            # get the path
602            path=${OPTFILE%/*}
603            if test "x$path" = x ; then
604                of_path=`pwd`
605            else
606                of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
607            fi
608            file=${OPTFILE##*/}
609            OPTFILE=$of_path/$file
610            cp $OPTFILE $DRESULTS
611            echo >> $SUMMARY
612            echo "  OPTFILE=$OPTFILE" >> $SUMMARY
613        else
614            echo | tee $SUMMARY
615            echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
616            exit 1
617        fi
618    else
619        echo >> $SUMMARY
620        echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
621        echo "   so the genmake default will be used." >> $SUMMARY
622    fi
623    echo
624    echo >> $SUMMARY
625    cat << EOF | tee -a $SUMMARY
626                  T           S           U           V                  T           S           U           V
627  G D M    c        m  s        m  s        m  s        m  s  G D M    c        m  s        m  s        m  s        m  s
628  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 631  N n k u  2  i  a  a  d  i  a  a  d  i  a
631    
632  EOF  EOF
633    
634  NDIR=0  #  ...and each test directory...
635    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  
636            
637      #  ...and each test directory...      #  Cleanup only!
638      for dir in $TESTDIRS ; do      if test "x$CLEANUP" = xt ; then
639            if test -r $dir/build/Makefile ; then
640          #  Verify that the testdir exists and contains previous              ( cd $dir/build ; make CLEAN )
641          #  results in the correct location--or skip this directory!          fi
642          if test ! -r $dir"/results/output.txt" ; then          if test -r $dir/input/Makefile ; then
643              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  
644          fi          fi
645            continue
646        fi
647    
648          #  Create an output dir for each OPTFILE/tdir combination      #  Verify that the testdir exists and contains previous
649          CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      #  results in the correct location--or skip this directory!
650          mkdir $CDIR      if test ! -r $dir"/results/output.txt" ; then
651          CDIR=`pwd`"/$CDIR"          echo "can't read \"$dir/results/output.txt\" -- skipping $dir"
652            continue
653        fi
654    
655          #  ...configue, make, run, and compare the output.      echo "-------------------------------------------------------------------------------"
656          echo "-------------------------------------------------------------------------------"      echo
657          echo      echo "Experiment:  $dir"
658          echo "Experiment:  $dir"      echo
659          echo      unset genmake makedepend make run
660          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  
661    
662        builddir="input"
663        rundir="input"
664        use_seperate_build=0
665        if test -d $dir/build -a -r $dir/build ; then
666            builddir="build"
667            rundir="build"
668            use_seperate_build=1
669            linkdata $use_seperate_build $dir/$rundir
670        fi
671        
672        CODE_DIR=$dir/code
673        BUILD_DIR=$dir/$builddir
674        MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
675        NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
676    
677        #  Is this an MPI run?
678        if test "x$MPI" = xt ; then
679            FILES=$MPI_FILES
680            endings="_mpi"
681        else
682            FILES=$NOMPI_FILES
683            endings="_nompi"
684        fi
685        
686        #  Check to see that we have the files
687        have_files=t
688        for i in $FILES ; do
689            if test ! -r $CODE_DIR/$i ; then
690                echo "Warning: can't read file $CODE_DIR/$i"
691                have_files=f
692            fi
693        done
694        if test "x$have_files" != xt -a "x$MPI" = xt ; then
695            echo "Skipping $dir due to lack of input files (see above warning)"
696            continue
697        fi
698        
699        #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR
700        if test "x$have_files" = xt ; then
701            for i in $FILES ; do
702                sstr="s|$endings||"
703                name=`echo $i | sed -e $sstr `
704                cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
705                RETVAL=$?
706                if test "x$RETVAL" != x0 ; then
707                    cp $CODE_DIR/$i $BUILD_DIR/$name
708                fi
709            done
710        fi
711        
712        #  Create an output dir for each OPTFILE/tdir combination
713        rel_CDIR=$DRESULTS"/"$dir
714        mkdir $rel_CDIR
715        CDIR=`pwd`"/$rel_CDIR"
716        
717        if test "x$CLEANUP" = xt ; then
718            makeclean $dir/$builddir
719        else
720          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
721              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
722              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
723              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
724              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $use_seperate_build $dir/$rundir \
725              && runmodel $dir/$builddir && run=Y \              && runmodel $dir/$rundir && run=Y \
726              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
727          echo      fi
728          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      
729              ${run:-N} $results      echo
730          echo      fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
731          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      echo
732              ${run:-N} $results >> $SUMMARY      echo "$fres" >> $SUMMARY
733          echo "fresults='" > $CDIR"/summary.txt"      echo "fresults='$fres'" > $CDIR"/summary.txt"
734          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      echo "MACH='$MACH'" >> $CDIR"/summary.txt"
735              ${run:-N} $results >> $CDIR"/summary.txt"      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
736          echo "'" >> $CDIR"/summary.txt"      echo "DATE='$DATE'" >> $CDIR"/summary.txt"
737          echo "MACH='$MACH'" >> $CDIR"/summary.txt"      echo "tdir='$dir'" >> $CDIR"/summary.txt"
738          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"      
739          echo "DATE='$DATE'" >> $CDIR"/summary.txt"      echo "-------------------------------------------------------------------------------"
740          echo "tdir='$dir'" >> $CDIR"/summary.txt"      
741    done
         (  
             cd $DRESULTS  
             tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1  
             gzip $NDIR".tar"  
         )  
742    
743          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES  echo -n "Start time:  " >> $SUMMARY
744    echo $start_date >> $SUMMARY
745    echo -n "End time:    " >> $SUMMARY
746    date >> $SUMMARY
747    
748    #  If addresses were supplied and mpack built successfully, then try
749    #  to send email using mpack.
750    if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
751        echo "No results email was sent."
752    else
753        if test "x$HAVE_MPACK" = xt ; then
754            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
755                && gzip $DRESULTS".tar" \
756                && $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES
757          RETVAL=$?          RETVAL=$?
758          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
759              echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"              echo
760                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
761                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
762                echo "  summary of results from the directory \"$DRESULTS\"."
763                echo
764          else          else
765              rm -f $DRESULTS"/"$NDIR".tar*"              echo
766                echo "An email containing results was sent to the following addresses:"
767                echo "  \"$ADDRESSES\""
768                echo
769          fi          fi
770            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
771            test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
772        fi
773    fi
774    
775          NDIR=$(( $NDIR + 1 ))  # rm -f tmp_cmpnum.f a.out
776            rm -f tmp_cmpnum.c tmp_cmpnum
     done  
 done  
   
 rm tmp_cmpnum.f a.out  
777    
778  cat $SUMMARY  if test "x$CLEANUP" != xt ; then
779        cat $SUMMARY
780        if test -e tr.out ; then
781            mv tr.out tr.out.old
782        fi
783        cat $SUMMARY > tr.out
784    fi
785    

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

  ViewVC Help
Powered by ViewVC 1.1.22