/[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.10 by edhill, Thu Oct 9 04:19:20 2003 UTC revision 1.70 by jmc, Thu Jul 28 21:12:15 2005 UTC
# Line 1  Line 1 
1  #!/bin/bash  #! /usr/bin/env bash
2  #  #
3  #  $Header$  #  $Header$
4    #  $Name$
5  #  #
6    
7  usage()  usage()
# Line 12  usage() Line 13  usage()
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"      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
16        echo "                             (DEF=\"-ieee\")"
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 "  (-command)STRING         command to run"      echo "                             (DEF=\"\" for \"bash\")"
25        echo "  (-adm|-ad)               perform an adjoint run"
26        echo "  (-command) STRING        command to run"
27      echo "                             (DEF=\"make output.txt\")"      echo "                             (DEF=\"make output.txt\")"
28      echo "  (-m|-make)STRING         command to use for \"make\""      echo "  (-m|-make) STRING        command to use for \"make\""
29      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
30        echo "  (-odir) STRING           used to build output directory name"
31        echo "                             (DEF=\"hostname\")"
32        echo "  (-ptracers|-ptr) STRING  specify which ptracers to test"
33        echo "                             (DEF=\"1 2 3 4 5\")"
34        echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"
35      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\""
36      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
37      echo "  (-nogenmake|-ng)         skip the genmake stage"      echo "  (-nogenmake|-ng)         skip the genmake stage"
38      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-noclean|-nc)           skip the \"make clean\" stage"
39      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
40        echo "  (-deldir|-dd)            on success, delete the output directory"
41      echo      echo
42      echo "and where STRING follows a whitespace-delimited format"      echo "and where STRING can be a whitespace-delimited list"
43      echo "such as:"      echo "such as:"
44        echo
45      echo "  -t 'exp0 exp2 exp3' "      echo "  -t 'exp0 exp2 exp3' "
46      echo "  -addr='abc@123.com testing@home.org'"      echo "  -addr='abc@123.com testing@home.org'"
47      echo      echo
48        echo "provided that the expression is properly quoted within the current"
49        echo "shell (note the use of single quotes to protect white space)."
50        echo
51      exit 1      exit 1
52  }  }
53    
54  #  build the mpack utility  #  build the mpack utility
55  build_mpack()  build_mpack()
56  {  {
57      echo -n "building the mpack utility...  "      printf "building the mpack utility...  "
58      if test ! -x "$MPACKDIR/mpack" ; then      if test ! -x "$MPACKDIR/mpack" ; then
59          if test ! -d $MPACKDIR ; then          if test ! -d $MPACKDIR ; then
60                echo
61              echo "Error: can't find \"$MPACKDIR\""              echo "Error: can't find \"$MPACKDIR\""
62              echo "  are you sure this program is being run in the correct "              echo "  are you sure this program is being run in the correct "
63              echo "  (that is, \"MITGCM_ROOT\verification\") directory?"              echo "  (that is, \"MITGCM_ROOT\verification\") directory?"
64              exit 1              echo
65                HAVE_MPACK=f
66            fi
67            printf "building mpack...  "
68            if test "x$CC" = x ; then
69                export CC=cc
70          fi          fi
71          echo -n "building mpack...  "          ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1
         ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1  
72          RETVAL=$?          RETVAL=$?
73          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
74              echo              echo
75              echo "Error building the mpack tools at: $MPACK_DIR"              echo "Error building the mpack tools at: $MPACK_DIR"
76              exit 1              echo
77                HAVE_MPACK=f
78            else
79                rm -f tr_build_mpack.out
80                HAVE_MPACK=t
81          fi          fi
82        else
83            HAVE_MPACK=t
84      fi      fi
85      echo "OK"      echo "OK"
86  }  }
87    
 compare_lines()  
 {  
     # use codelet to compare lines  
     if [ $verbose -gt 1 ]; then  
         cat tmp3.txt 1>&2  
     fi  
     return `./a.out < tmp3.txt`  
 }  
   
88  testoutput_for_prop()  testoutput_for_prop()
89  {  {
90      # testoutput_for_prop dir s1 label subdir      # testoutput_for_prop dir s1 label subdir extension
91      #      #
92      #  compares files in $dir/$subdir/output.txt and $dir/results/output.txt      #  compares files in $dir/$subdir/output.txt and $dir/results/output.txt
93      #  using search strings s1 and text label      #  using search strings s1 and text label
# Line 80  testoutput_for_prop() Line 96  testoutput_for_prop()
96          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2
97      fi      fi
98      if [ -r $1/$4/output.txt ]; then      if [ -r $1/$4/output.txt ]; then
99          grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt          grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt
100          lncnt=`wc -l tmp1.txt | awk '{print $1}' `          lncntA=`wc -l tmp1.txt | awk '{print $1}' `
101          if [ $lncnt -lt 3 ]; then          if [ $lncntA -lt 3 ]; then
102              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
103                  echo Not enough lines of output when searching for "$2" 1>&2                  echo Not enough lines of output when searching for "$2" 1>&2
104              fi              fi
# Line 93  testoutput_for_prop() Line 109  testoutput_for_prop()
109          return 99          return 99
110      fi      fi
111      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
112          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2
113      fi      fi
114      grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt      grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt
115      lncnt=`wc -l tmp2.txt | awk '{print $1}' `      lncntB=`wc -l tmp2.txt | awk '{print $1}' `
116      if [ $lncnt -lt 3 ]; then      if [ $lncntB -lt 3 ]; then
117          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
118              echo Not enough lines of output when searching for "$2" 1>&2              echo Not enough lines of output when searching for "$2" 1>&2
119          fi          fi
120          return 99          return 99
121      fi      fi
122        if [ $lncntA -ne $lncntB ]; then
123            if [ $verbose -gt 0 ]; then
124                echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2
125            fi
126            return 99
127        fi
128      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
129          echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2          echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2
130      fi      fi
# Line 110  testoutput_for_prop() Line 132  testoutput_for_prop()
132      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
133          echo testoutput_for_prop: compare_lines 1>&2          echo testoutput_for_prop: compare_lines 1>&2
134      fi      fi
135      compare_lines      if [ $verbose -gt 1 ]; then
136      digits_of_similarity=$?          cat tmp3.txt 1>&2
137        fi
138        echo "-1" >> tmp3.txt
139        # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
140        cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
141        digits_of_similarity=`./tmp_cmpnum < tmp4.txt`
142      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
143          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
144              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 122  testoutput_for_prop() Line 149  testoutput_for_prop()
149              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
150          fi          fi
151      fi      fi
152      rm tmp1.txt tmp2.txt tmp3.txt      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
153            
154      return $digits_of_similarity      return $digits_of_similarity
155  }  }
# Line 142  dashnum() Line 169  dashnum()
169      done      done
170  }  }
171    
172    testoutput_ad()
173    {
174        grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt
175        grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt
176        grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt
177        grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt
178        join t05.txt t15.txt > t5.txt
179        join t06.txt t16.txt > t6.txt
180        echo "-1" >> t5.txt
181        echo "-1" >> t6.txt
182        digits_5=`./tmp_cmpnum < t5.txt`
183        digits_6=`./tmp_cmpnum < t6.txt`
184        dashnum $digits_5 $digits_6
185        rm -f t[01][56].txt t[56].txt
186    }
187    
188    check_for_add_mon_output()
189    {
190        # Check for additional types of monitor output
191        if test "x$1" = x ; then
192            return
193        fi
194    
195        for ii in $PTRACERS_NUM ; do
196            eval "HAVE_PTR0"$ii"=f"
197        done
198    
199        ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max"
200        ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd"
201        for ii in $PTRACERS_NUM ; do
202            for jj in $ptr_add ; do
203                name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`
204                tst=`grep $name $1 | wc -l | awk '{print $1}'`
205                if test ! "x$tst" = x0 ; then
206                    eval "HAVE_PTR0"$ii"=t"
207                fi
208            done
209            #  eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"'
210        done
211    }
212    
213  testoutput()  testoutput()
214  {  {
215      # testoutput diretory subdir      # testoutput directory subdir extension
216      #      #
217      #  test output in "directory"      #  test output in "directory"
218        if test "x$ADM" = x ; then
219            if [ $debug -gt 0 ]; then
220                echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2
221            fi
222            testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$?
223            if [ $debug -gt 0 ]; then
224                echo testoutput: cg2dres=$cg2dres 1>&2
225            fi
226            testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2 $3; tmin=$?
227            testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2 $3; tmax=$?
228            testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2 $3; tmean=$?
229            testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2 $3; tsd=$?
230            testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2 $3; smin=$?
231            testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2 $3; smax=$?
232            testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2 $3; smean=$?
233            testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2 $3; ssd=$?
234            testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2 $3; umin=$?
235            testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2 $3; umax=$?
236            testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2 $3; umean=$?
237            testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2 $3; usd=$?
238            testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2 $3; vmin=$?
239            testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$?
240            testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$?
241            testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$?
242    
243            #  This is for PTRACERS
244            for ii in $PTRACERS_NUM ; do
245                eval `echo "p0"$ii"_min=99"`
246                eval `echo "p0"$ii"_max=99"`
247                eval `echo "p0"$ii"_mean=99"`
248                eval `echo "p0"$ii"_sd=99"`
249                tst=`eval 'echo "$HAVE_PTR0'$ii'"'`
250                #echo 'tst = '$tst
251                if test "x$tst" = xt ; then
252                    a="trcstat_ptracer0"
253                    testoutput_for_prop $1 "$a"$ii"_min"  "p0"$ii"_min"  $2 $3
254                    RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL`
255                    testoutput_for_prop $1 "$a"$ii"_max"  "p0"$ii"_max"  $2 $3
256                    RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL`
257                    testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3
258                    RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL`
259                    testoutput_for_prop $1 "$a"$ii"_sd"   "p0"$ii"_sd"   $2 $3
260                    RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL`
261                fi
262            done
263    
264      if [ $debug -gt 0 ]; then          allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd"
265          echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2          allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd"
266      fi          allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd"
267      testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$?          allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd"
268      if [ $debug -gt 0 ]; then          allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd"
269          echo testoutput: cg2dres=$cg2dres 1>&2          allargs="$allargs $p04_min $p04_max $p04_mean $p04_sd"
270            allargs="$allargs $p05_min $p05_max $p05_mean $p05_sd"
271    
272            eval "dashnum $allargs"
273    
274        else
275            testoutput_ad $1 $2 "precision_grdchk_result"
276      fi      fi
       
     testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?  
     testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?  
     testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?  
     testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$?  
     testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$?  
     testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$?  
     testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$?  
     testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$?  
     testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$?  
     testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$?  
     testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$?  
     testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$?  
     testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$?  
     testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$?  
     testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$?  
     testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$?  
       
     dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \  
         $umin $umax $umean $usd $vmin $vmax $vmean $vsd  
277  }  }
278    
279  genmakemodel()  genmakemodel()
# Line 183  genmakemodel() Line 282  genmakemodel()
282      if test "x$NOGENMAKE" = xt ; then      if test "x$NOGENMAKE" = xt ; then
283          echo "genmake skipped!"          echo "genmake skipped!"
284      else      else
285          GENMAKE2="$BASH ../../../tools/genmake2"          if test "x$BASH" = x ; then
286                GENMAKE2="../../../tools/genmake2"
287            else
288                GENMAKE2="$BASH ../../../tools/genmake2 -bash $BASH"
289            fi
290          (          (
291              cd $1;              cd $1;
292              command="$GENMAKE2  -ds -m $MAKE --mods=../code"              command="$GENMAKE2  -ds -m $MAKE"
293                if test "x$ADM" = x ; then
294                    command="$command --mods=../code"
295                else
296                    command="$command --mods=../code_ad"
297                    command="$command -adof=../../../tools/adjoint_options/adjoint_staf"
298                fi
299              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
300                  command="$command --optfile=$OPTFILE"                  command="$command --optfile=$OPTFILE"
                 # echo "  command=\"$command\""  
301              fi              fi
302              if test "x$IEEE" != x ; then              if test "x$IEEE" != x ; then
303                  command="$command -ieee"                  command="$command -ieee"
304              fi              fi
305              # echo "command: \"$command\""              if test "x$MPI" = xt ; then
306                    command="$command -mpi"
307                fi
308              printf 'genmake ... ' 1>&2              printf 'genmake ... ' 1>&2
309              $command > make.log 2>&1              $command > make.log 2>&1
310              RETVAL=$?              RETVAL=$?
311              for i in genmake_state genmake_optfile genmake_local Makefile ; do              #  Reduce the size of the testing emails!
312                  if test -r $i ; then              head -100 Makefile > $CDIR/Makefile_head
                     cp $i $CDIR  
                 fi  
             done  
313              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
314                  tail make.log                  tail make.log
315                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed" 1>&2
316                  cp make.log $CDIR                  cp genmake_* make.log $CDIR
317                  return 1                  return 1
318              else              else
319                  echo "succesful" 1>&2                  echo "successful" 1>&2
320              fi              fi
321          )          )
322      fi      fi
# Line 237  makeclean() Line 344  makeclean()
344                      return 1                      return 1
345                  fi                  fi
346              fi              fi
347              echo succesful 1>&2              echo successful 1>&2
348                exit 0
349            )
350        fi
351    }
352    
353    postclean()
354    {
355        # postclean directory
356        if test "x$POSTCLEAN" = xt ; then
357            (
358                cd $1;
359                if test -r Makefile ; then
360                    $MAKE CLEAN >> /dev/null 2>&1
361                fi
362              exit 0              exit 0
363          )          )
364      fi      fi
# Line 260  makedependmodel() Line 381  makedependmodel()
381                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
382                  return 1                  return 1
383              else              else
384                  echo succesful 1>&2                  echo successful 1>&2
385              fi              fi
386          )          )
387      fi      fi
# Line 273  makemodel() Line 394  makemodel()
394          cd $1;          cd $1;
395          if test -r Makefile ; then          if test -r Makefile ; then
396              printf 'make ... ' 1>&2              printf 'make ... ' 1>&2
397              $MAKE >> make.log 2>&1              if test "x$ADM" = x ; then
398                    if test "x$JOBS" = x ; then
399                        $MAKE >> make.log 2>&1
400                    else
401                        $MAKE -j $JOBS >> make.log 2>&1
402                    fi
403                else
404                    $MAKE adall >> make.log 2>&1
405                fi
406              RETVAL=$?              RETVAL=$?
407              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
408                  tail make.log                  tail make.log
# Line 281  makemodel() Line 410  makemodel()
410                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
411                  return 1                  return 1
412              else              else
413                  echo succesful 1>&2                  echo successful 1>&2
414              fi              fi
415          fi          fi
416      )      )
417  }  }
418    
419    symlink_mpifiles()
420    {
421        # Put special links so that MPI specific files are used
422        # This MUST be invoked between makeclean and makelinks because
423        # the Makefile will link to non-mpi files by default
424    
425        dir=$1
426        code_dir=$2
427        BUILD_DIR=$dir/$3
428        CODE_DIR=$dir/$code_dir
429        
430        # These are files that should replace their counter-part when using -mpi
431        MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")`
432    
433        #  Is this an MPI run?
434        if test "x$MPI" = xt ; then
435            # YES: We symbolically link these files to the build
436            # dir so long as there is no real file in place
437            for ii in $MPI_FILES ; do
438                i=`echo $ii | sed 's:^\./::'`
439                name=`echo $i | sed 's:_mpi::' `
440                cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
441                RETVAL=$?
442                if test "x$RETVAL" != x0 ; then
443                    if ! test -f $BUILD_DIR/$i ; then
444                        #echo Linking $name to $i
445                        (cd $BUILD_DIR; ln -sf ../$code_dir/$i $name)
446                    fi
447                fi
448            done
449        else
450            # NO: We undo any _mpi symbolically linked files
451            for ii in $MPI_FILES ; do
452                i=`echo $ii | sed 's:^\./::'`
453                name=`echo $i | sed 's:_mpi::' `
454                if test -L $BUILD_DIR/$name ; then
455                    cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1
456                    RETVAL=$?
457                    if test "x$RETVAL" = x0 ; then
458                        #echo Un-linking $name from $linktarg
459                        rm -f $BUILD_DIR/$name
460                    fi
461                fi
462            done
463        fi
464        
465    }
466    
467  linkdata()  linkdata()
468  {  {
469      # linkdata flag      # linkdata flag
470      #      #
471      # symbolically link data files to run directory      # symbolically link data files to run directory
472      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
473          ( cd $2 ;  ln -sf ../input/* . )          (
474                cd $2
475                if test "x$ADM" = x ; then
476                    files=`( cd ../input ; ls -1 | grep -v CVS )`
477                    for i in $files ; do
478                        if test ! -d "../input/"$i -a ! -f $i ; then
479                            ln -sf "../input/"$i $i
480                        fi
481                    done
482                else
483                    files=`( cd ../input ; ls -1 *.bin | grep -v CVS )`
484                    for i in $files ; do
485                        if test ! -d "../input/"$i ; then
486                            ln -sf "../input/"$i $i
487                        fi
488                    done
489                    files=`( cd ../input_ad ; ls -1 | grep -v CVS )`
490                    for i in $files ; do
491                        if test ! -d "../input_ad/"$i ; then
492                            ln -sf "../input_ad/"$i $i
493                        fi
494                    done
495                fi
496            )
497      fi      fi
498  }  }
499    
# Line 301  runmodel() Line 501  runmodel()
501  {  {
502      # runmodel directory      # runmodel directory
503      #      #
504      #  runs "$COMMAND" in "directory"      #  runs "$COMMAND in "directory"
505      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
506      (      (
507          cd $1          cd $1
508          printf 'runmodel: ' 1>&2          printf 'runmodel ... ' 1>&2
509          # make output.txt          # make output.txt
510          $COMMAND          echo
511            rm -f run.log
512            # echo "COMMAND='$COMMAND'"
513            # echo "pwd='"`pwd`"'"
514            ( eval $COMMAND ) > run.log 2>&1
515          RETVAL=$?          RETVAL=$?
516          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
517              cp output.txt $CDIR"/output.txt"              tail run.log
518                echo successful 1>&2
519                # === Reduce the size of the testing emails!
520                # if test "x$ADM" = x ; then
521                #   cp output.txt $CDIR"/output.txt"
522                # else
523                #   cp output.txt_adm $CDIR"/output.txt_adm"
524                # fi
525                if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
526              return 0              return 0
527          else          else
528                tail run.log
529                echo failed 1>&2
530                cp run.log $CDIR"/run.log"
531                if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
532              return 1              return 1
533          fi          fi
534      )      )
# Line 322  createcodelet() Line 538  createcodelet()
538  {  {
539      # create codelet for comparing model output      # create codelet for comparing model output
540    
541      echo -n "creating the comparison code...  "      printf "creating the comparison code...  "
542      cat > tmp_cmpnum.f <<EOFA      cat > tmp_cmpnum.c <<EOF
543        program cmpnum  #include <stdio.h>
544        implicit none  #include <math.h>
545        real*8 a,b,diff  int main( int argc, char** argv )  {
546        integer linnum,best    int linnum,best,lncnt;
547        best=-16    double a,b,abave,relerr;
548    99  read(*,*,end=70,err=60) linnum,a,b    best = -22;
549        diff=0.5*(abs(a)+abs(b))    lncnt = 0;
550  c     print *,a,b,diff,abs(a-b)/diff    while( 1 & (lncnt+=1) < 999 )  {
551        if (diff.gt.1.e-12) then      scanf("%d", &linnum);
552          diff=abs(a-b)/diff      if (linnum == -1)  break;
553          if (diff.gt.0.) then      scanf("%lf", &a);  scanf("%lf", &b);
554  c         print *,int(log10(diff)),diff      abave = 0.5*(fabs(a)+fabs(b));
555            linnum=int(log10(diff))      if (abave > 0.0) {
556            best=max(best,linnum)        relerr=fabs(a-b)/abave;
557          endif        if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); }
558        else        else { linnum = -16 ; }
559          if (best.eq.-16.and.diff.ne.0.) best=-22        best = (best > linnum) ? best : linnum;
560        endif      }
561        goto 99    }
562    60  stop 'cmpnum: An error occured reading a,b'    if (lncnt == 999) best=-29;
563    70  print *,-best    printf("%d\n", -best);
564        end    return 0;
565  EOFA  }
566    EOF
567        $CC -o tmp_cmpnum tmp_cmpnum.c -lm
568    
569      f77 tmp_cmpnum.f      if [ -x ./tmp_cmpnum ]; then
     if [ -x ./a.out ]; then  
570          echo "OK"          echo "OK"
571          return 0          return 0
572      else      else
573          echo          echo
574          echo "createcodelet: failed to compile codelet"          echo "ERROR: failed to compile comparison code -- please specify"
575            echo "  a C compiler using the CC environment variable."
576          exit 1          exit 1
577      fi      fi
578  }  }
# Line 414  scandirs() Line 632  scandirs()
632    
633    
634  ###############################################################################  ###############################################################################
 ###############################################################################  
 ###############################################################################  
635    
636    
637  #  Default properties  #  Default properties
# Line 425  clean=0 Line 641  clean=0
641  expts=''  expts=''
642  # ieee=1  # ieee=1
643    
644  IEEE=  IEEE=true
645  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
646      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
647  fi  fi
# Line 436  QUICK=f Line 652  QUICK=f
652  NOGENMAKE=f  NOGENMAKE=f
653  NOCLEAN=f  NOCLEAN=f
654  NODEPEND=f  NODEPEND=f
655    POSTCLEAN=f
656    
657  BASH=  BASH=
658  OPTFILE=NONE  OPTFILE=NONE
659  ADDRESSES=  ADDRESSES=
660  TESTDIRS=  TESTDIRS=
661  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
662    HAVE_MPACK=
663  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
664  COMMAND="make output.txt"  COMMAND=
665  MAKE=make  if test "x$MAKE" = x ; then
666        MAKE=make
667    fi
668    if test "x$CC" = x ; then
669        CC=cc
670    fi
671    JOBS=
672  MPI=f  MPI=f
673    OUTDIR=
674    DELDIR=
675    
676    ADM=
677    
678  echo -n "parsing options...  "  # Additional monitor types
679    PTRACERS_NUM="1 2 3 4 5"
680    
681    printf "parsing options...  "
682    
683  ac_prev=  ac_prev=
684  for ac_option ; do  for ac_option ; do
# Line 496  for ac_option ; do Line 727  for ac_option ; do
727          -make=* | --make=*)          -make=* | --make=*)
728              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
729    
730            -odir | --odir)
731                ac_prev=OUTDIR ;;
732            -odir=* | --odir=*)
733                OUTDIR=$ac_optarg ;;
734    
735            -ptracers | --ptracers | -ptr | --ptr)
736                ac_prev=PTRACERS_NUM ;;
737            -ptracers=* | --ptracers=* | -ptr=* | --ptr=*)
738                PTRACERS_NUM=$ac_optarg ;;
739    
740            -j) ac_prev=JOBS ;;
741            -j=*) JOBS=$ac_optarg ;;
742    
743          -clean | --clean)          -clean | --clean)
744              CLEANUP=t ;;              CLEANUP=t ; DELDIR=t ;;
745    
746          -quick | --quick | -q | --q)          -quick | --quick | -q | --q)
747              QUICK=t ;;              QUICK=t ;;
# Line 508  for ac_option ; do Line 752  for ac_option ; do
752          -nodepend | --nodepend | -nd | --nd)          -nodepend | --nodepend | -nd | --nd)
753              NODEPEND=t ;;              NODEPEND=t ;;
754    
755          -mpi) MPI=true ;;          -postclean | --postclean | -pc | --pc)
756                POSTCLEAN=t ;;
757    
758            -mpi) MPI=t ;;
759    
760            -adm | -ad) ADM=t ;;
761    
762          -ieee) IEEE=true ;;          -ieee) IEEE=true ;;
763          -noieee) IEEE= ;;          -noieee) IEEE= ;;
# Line 517  for ac_option ; do Line 766  for ac_option ; do
766          -debug) debug=1 ;;          -debug) debug=1 ;;
767          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
768    
769            -deldir | -dd) DELDIR=t ;;
770    
771          -*)          -*)
772              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
773              usage              usage
# Line 545  if test "x$OPTFILE" = xNONE -a "x$MITGCM Line 796  if test "x$OPTFILE" = xNONE -a "x$MITGCM
796      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
797  fi  fi
798    
799    if test "x$ADM" = xt -a "x$COMMAND" = x ; then
800        COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1"
801    fi
802    
803    if test "x$COMMAND" = x ; then
804        COMMAND="$MAKE output.txt"
805    fi
806    
807  echo "OK"  echo "OK"
808    
809  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
810  createcodelet  createcodelet
811    
812  #  build the mpack utility  #  build the mpack utility
813  build_mpack  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
814        echo "skipping mpack build"
815    else
816        build_mpack
817    fi
818    
819  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
820  MACH=`hostname`  MACH=`hostname`
821  UNAMEA=`uname -a`  UNAMEA=`uname -a`
822  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
823  BASE=$MACH"_"$DATE"_"  BASE="tr_"$MACH"_"$DATE"_"
824    if test "x$OUTDIR" != x ; then
825        BASE="tr_"$OUTDIR"_"$DATE"_"
826    fi
827  DNUM=0  DNUM=0
828  DRESULTS="$BASE$DNUM"  DRESULTS="$BASE$DNUM"
829  while test -e $DRESULTS ; do  while test -e $DRESULTS ; do
# Line 567  done Line 833  done
833  mkdir $DRESULTS  mkdir $DRESULTS
834  RETVAL=$?  RETVAL=$?
835  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
836      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
837      exit 1      exit 1
838  fi  fi
839  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
840  date > $SUMMARY  printf "Start time:  " >> $SUMMARY
841  cat << EOF >> $SUMMARY  start_date=`date`
842                  T           S           U           V  echo $start_date > $SUMMARY
 G D M    c        m  s        m  s        m  s        m  s  
 E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .  
 N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d  
 2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .  
   
 EOF  
   
 NDIR=0  
843    
844    of_path=
845  if test "x$OPTFILE" != xNONE ; then  if test "x$OPTFILE" != xNONE ; then
846      if test -r $OPTFILE ; then      if test -r $OPTFILE ; then
847          OPTFILE=`pwd`"/$OPTFILE"          # get the path
848            path=${OPTFILE%/*}
849            if test "x$path" = x ; then
850                of_path=`pwd`
851            else
852                of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
853            fi
854            file=${OPTFILE##*/}
855            OPTFILE=$of_path/$file
856            cp $OPTFILE $DRESULTS
857            echo >> $SUMMARY
858            echo "  OPTFILE=$OPTFILE" >> $SUMMARY
859        else
860            echo | tee $SUMMARY
861            echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
862            exit 1
863      fi      fi
864    else
865        echo >> $SUMMARY
866        echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
867        echo "   so the genmake default will be used." >> $SUMMARY
868  fi  fi
869  echo  echo
 echo "OPTFILE=$OPTFILE" >> $SUMMARY  
870  echo >> $SUMMARY  echo >> $SUMMARY
871    if test "x$ADM" = x ; then
872        line_0="            ----T-----  ----S-----  ----U-----  ----V-----"
873        line_1="G D M    c        m  s        m  s        m  s        m  s"
874        line_2="E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  ."
875        line_3="N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d"
876        line_4="2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  ."
877        for ii in $PTRACERS_NUM ; do
878            #  tst=`eval 'echo $HAVE_PTR0'$ii`
879            #  if test "x$tst" = xt ; then
880            line_0="$line_0  --PTR 0"$ii"--"
881            line_1="$line_1        m  s"
882            line_2="$line_2  m  m  e  ."
883            line_3="$line_3  i  a  a  d"
884            line_4="$line_4  n  x  n  ."
885            #  fi
886        done
887        echo "$line_0" | tee -a $SUMMARY
888        echo "$line_1" | tee -a $SUMMARY
889        echo "$line_2" | tee -a $SUMMARY
890        echo "$line_3" | tee -a $SUMMARY
891        echo "$line_4" | tee -a $SUMMARY
892        echo " "       | tee -a $SUMMARY
893    else
894        echo "ADJOINT=true" >> $SUMMARY
895        echo >> $SUMMARY
896        cat << EOF | tee -a $SUMMARY
897    G D M    C  G
898    E p a R  o  r
899    N n k u  s  a
900    2 d e n  t  d
901    
902    EOF
903    fi
904    
905  #  ...and each test directory...  #  ...and each test directory...
906  for dir in $TESTDIRS ; do  for dir in $TESTDIRS ; do
# Line 603  for dir in $TESTDIRS ; do Line 913  for dir in $TESTDIRS ; do
913          if test -r $dir/input/Makefile ; then          if test -r $dir/input/Makefile ; then
914              ( cd $dir/input ; make CLEAN )              ( cd $dir/input ; make CLEAN )
915          fi          fi
916            (
917                cd $dir
918                rm -rf tr_run.*
919            )
920          continue          continue
921      fi      fi
922    
923      #  Verify that the testdir exists and contains previous      #  Verify that the testdir exists and contains previous
924      #  results in the correct location--or skip this directory!      #  results in the correct location--or skip this directory!
925      if test ! -r $dir"/results/output.txt" ; then      fout=
926          echo "can't read \"$dir/results/output.txt\" -- skipping $dir"      if test "x$ADM" = x ; then
927            fout=$dir"/results/output.txt"
928        else
929            fout=$dir"/results_ad/output.txt_adm"
930        fi
931        if test ! -r $fout ; then
932            echo "can't read \"$fout\" -- skipping $dir"
933          continue          continue
934      fi      fi
935        if test "x$ADM" = x ; then
936            check_for_add_mon_output  $fout
937        fi
938    
939      echo "-------------------------------------------------------------------------------"      # Check for additional types of monitor output
     echo  
     echo "Experiment:  $dir"  
     echo  
     unset genmake makedepend make run  
     results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'  
940    
941      if [ -r $dir/build ]; then      builddir="input"
942          seperatebuilddir=1      rundir="input"
943          builddir=build      use_seperate_build=0
944          rundir=build      if test -d $dir/build -a -r $dir/build ; then
945          ( cd $dir/build; ln -sf ../input/* . )          builddir="build"
946      else          rundir="build"
947          seperatebuilddir=0          use_seperate_build=1
948          builddir=input          linkdata $use_seperate_build $dir/$rundir
         rundir=input  
949      fi      fi
950            
951      CODE_DIR=$dir/code      #  Check whether there are "extra runs" for this testdir
952      BUILD_DIR=$dir/$builddir      extra_runs=
953      MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"      if test "x$ADM" = x -a "x$use_seperate_build" = x1 ; then
954      NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"          ex_run_dirs=`( cd $dir ; echo input.* )`
955            echo "ex_run_dirs='$ex_run_dirs'"
956            for exd in $ex_run_dirs ; do
957                name=`echo $exd | sed -e 's/input.//g'`
958                outf="$dir/results/output.txt.$name"
959                if test -f $outf -a -r $outf ; then
960                    extra_runs="$extra_runs $name"
961                fi
962            done
963        fi
964    
965      #  Is this an MPI run?      if test "x$ADM" = x ; then
966      if test "x$MPI" = xt ; then          code_dir=code
967          FILES=$MPI_FILES          CODE_DIR=$dir/code
         endings="_mpi"  
968      else      else
969          FILES=$NOMPI_FILES          code_dir=code_ad
970          endings="_nompi"          CODE_DIR=$dir/code_ad
971      fi      fi
972            BUILD_DIR=$dir/$builddir
973      #  Check to see that we have the files  
974      have_files=t      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then
975      for i in $FILES ; do          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
         if test ! -r $CODE_DIR/$i ; then  
             echo "Warning: can't read file $CODE_DIR/$i"  
             have_files=f  
         fi  
     done  
     if test "x$have_files" != xt -a "x$MPI" = xt ; then  
         echo "Skipping $dir due to lack of input files (see above warning)"  
976          continue          continue
977      fi      fi
978        
979      #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR      echo "-------------------------------------------------------------------------------"
980      if test "x$have_files" = xt ; then      echo
981          for i in $FILES ; do      echo "Experiment:  $dir"
982              sstr="s|$endings||"      echo
983              name=`echo $i | sed -e $sstr `      unset genmake makedepend make run
984              cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
985              RETVAL=$?  
             if test "x$RETVAL" != x0 ; then  
                 cp $CODE_DIR/$i $BUILD_DIR/$name  
             fi  
         done  
     fi  
       
986      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir for each OPTFILE/tdir combination
987      CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      rel_CDIR=$DRESULTS"/"$dir
988      mkdir $CDIR      mkdir $rel_CDIR
989      CDIR=`pwd`"/$CDIR"      CDIR=`pwd`"/$rel_CDIR"
990            
991      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
992          makeclean $dir/$builddir          makeclean $dir/$builddir
993      else      else
994          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
995              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
996                && symlink_mpifiles $dir $code_dir $builddir \
997              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
998              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
999              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $use_seperate_build $dir/$rundir \
1000              && runmodel $dir/$builddir && run=Y \              && runmodel $dir/$rundir && run=Y \
1001              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
1002      fi      fi
1003            
1004      echo      echo
1005      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      if test "x$ADM" = x ; then
1006          ${run:-N} $results          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1007      echo          echo
1008      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          echo "$fres" >> $SUMMARY
1009          ${run:-N} $results >> $SUMMARY          echo "fresults='$fres'" > $CDIR"/summary.txt"
1010      echo "fresults='" > $CDIR"/summary.txt"          echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1011      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1012          ${run:-N} $results >> $CDIR"/summary.txt"          echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1013      echo "'" >> $CDIR"/summary.txt"          echo "tdir='$dir'" >> $CDIR"/summary.txt"
1014      echo "MACH='$MACH'" >> $CDIR"/summary.txt"  
1015      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"          for ex in $extra_runs ; do
1016      echo "DATE='$DATE'" >> $CDIR"/summary.txt"              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"
1017      echo "tdir='$dir'" >> $CDIR"/summary.txt"              for ldir in input.$ex input ; do
1018                    (
1019                        cd "$dir/$ldir" > /dev/null 2>&1
1020                        ls -1 2>/dev/null \
1021                            | sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g'
1022                    ) > tr_exrun_links
1023                    (
1024                        cd "$dir/tr_run.$ex"
1025                        cat ../../tr_exrun_links | while read i ; do
1026                            if test ! "x$i" = x ; then
1027                                test ! -r $i  &&  ln -s "../"$ldir"/"$i $i
1028                            fi
1029                        done
1030                    )
1031                    test -e tr_exrun_links  &&  rm -f tr_exrun_links
1032                done
1033                ldir=build
1034                (
1035                    cd "$dir/$ldir" > /dev/null 2>&1
1036                    ls -1 Makefile *.[fFhco] mitgcmuv  2>/dev/null \
1037                        | sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g'
1038                ) > tr_exrun_links
1039                (
1040                    cd "$dir/tr_run.$ex"
1041                        cat ../../tr_exrun_links | while read i ; do
1042                            if test ! "x$i" = x ; then
1043                                test ! -r $i  &&  ln -s "../"$ldir"/"$i $i
1044                            fi
1045                        done
1046                )
1047                test -e tr_exrun_links  &&  rm -f tr_exrun_links
1048                runmodel $dir/tr_run.$ex && run=Y \
1049                    && results=`testoutput $dir tr_run.$ex "."$ex`
1050                fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1051                fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1052                fres="$fres.$ex"
1053                echo
1054                echo "$fres" >> $SUMMARY
1055                echo "fresults='$fres'" > $CDIR"/summary.txt"
1056                echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1057                echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1058                echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1059                echo "tdir='$dir'" >> $CDIR"/summary.txt"
1060            done
1061        else
1062            fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1063            fres=$fres"$results   $dir"
1064            echo
1065            echo "$fres" >> $SUMMARY
1066            echo "fresults='$fres'" > $CDIR"/summary.txt"
1067            echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1068            echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1069            echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1070            echo "tdir='$dir'" >> $CDIR"/summary.txt"
1071        fi
1072    
1073        postclean $dir/$builddir
1074            
1075      (      echo "-------------------------------------------------------------------------------"
         cd $DRESULTS  
         tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1  
         gzip $NDIR".tar"  
     )  
1076            
1077      if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then  done
1078          echo "No mail sent"  
1079      else  printf "Start time:  " >> $SUMMARY
1080          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES  echo $start_date >> $SUMMARY
1081    printf "End time:    " >> $SUMMARY
1082    date >> $SUMMARY
1083    
1084    #  If addresses were supplied and mpack built successfully, then try
1085    #  to send email using mpack.
1086    if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
1087        echo "No results email was sent."
1088    else
1089        if test "x$HAVE_MPACK" = xt ; then
1090            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
1091                && gzip $DRESULTS".tar" \
1092                && $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES
1093          RETVAL=$?          RETVAL=$?
1094          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
1095              echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"              echo
1096                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
1097                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
1098                echo "  summary of results from the directory \"$DRESULTS\"."
1099                echo
1100          else          else
1101              rm -f $DRESULTS"/"$NDIR".tar*"              echo
1102                echo "An email containing results was sent to the following addresses:"
1103                echo "  \"$ADDRESSES\""
1104                echo
1105          fi          fi
1106            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
1107            test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
1108      fi      fi
1109    fi
1110    
1111      echo "-------------------------------------------------------------------------------"  # rm -f tmp_cmpnum.f a.out
1112        rm -f tmp_cmpnum.c tmp_cmpnum
     NDIR=$(( $NDIR + 1 ))  
       
 done  
1113    
1114  rm tmp_cmpnum.f a.out  if test "x$CLEANUP" != xt ; then
1115        cat $SUMMARY | sed 's/ -- -- -- --//g'
1116        if test -e tr_out.txt ; then
1117            mv tr_out.txt tr_out.txt.old
1118        fi
1119        cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt
1120    fi
1121    
1122  cat $SUMMARY  if test "x$DELDIR" = xt ; then
1123        rm -rf $DRESULTS
1124    fi
1125    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.70

  ViewVC Help
Powered by ViewVC 1.1.22