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

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.67

  ViewVC Help
Powered by ViewVC 1.1.22