/[MITgcm]/MITgcm/verification/testreport
ViewVC logotype

Diff of /MITgcm/verification/testreport

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.9.2.4 by edhill, Fri Oct 3 05:12:18 2003 UTC revision 1.66 by edhill, Fri Feb 4 16:41:42 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 11  usage() Line 12  usage()
12      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
13      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
14      echo "  (-mpi)                   use MPI input files"      echo "  (-mpi)                   use MPI input files"
15        echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
16        echo "                             (DEF=\"-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 "  (-c|-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\""
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          fi
65          echo -n "building mpack...  "          printf "building mpack...  "
66          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1          if test "x$CC" = x ; then
67                export CC=cc
68            fi
69            ( cd $MPACKDIR && ./configure && $MAKE ) > tr_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 78  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}' `          lncnt=`wc -l tmp1.txt | awk '{print $1}' `
99          if [ $lncnt -lt 3 ]; then          if [ $lncnt -lt 3 ]; then
100              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
# Line 91  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}' `      lncnt=`wc -l tmp2.txt | awk '{print $1}' `
114      if [ $lncnt -lt 3 ]; then      if [ $lncnt -lt 3 ]; then
115          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
# Line 108  testoutput_for_prop() Line 124  testoutput_for_prop()
124      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
125          echo testoutput_for_prop: compare_lines 1>&2          echo testoutput_for_prop: compare_lines 1>&2
126      fi      fi
127      compare_lines      if [ $verbose -gt 1 ]; then
128      digits_of_similarity=$?          cat tmp3.txt 1>&2
129        fi
130        echo "-1" >> tmp3.txt
131        # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
132        cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
133        digits_of_similarity=`./tmp_cmpnum < tmp4.txt`
134      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
135          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
136              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2
# Line 120  testoutput_for_prop() Line 141  testoutput_for_prop()
141              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
142          fi          fi
143      fi      fi
144      rm tmp1.txt tmp2.txt tmp3.txt      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
145            
146      return $digits_of_similarity      return $digits_of_similarity
147  }  }
# Line 140  dashnum() Line 161  dashnum()
161      done      done
162  }  }
163    
164    testoutput_ad()
165    {
166        grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt
167        grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt
168        grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt
169        grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt
170        join t05.txt t15.txt > t5.txt
171        join t06.txt t16.txt > t6.txt
172        echo "-1" >> t5.txt
173        echo "-1" >> t6.txt
174        digits_5=`./tmp_cmpnum < t5.txt`
175        digits_6=`./tmp_cmpnum < t6.txt`
176        dashnum $digits_5 $digits_6
177        rm -f t[01][56].txt t[56].txt
178    }
179    
180    check_for_add_mon_output()
181    {
182        # Check for additional types of monitor output
183        if test "x$1" = x ; then
184            return
185        fi
186    
187        for ii in $PTRACERS_NUM ; do
188            eval "HAVE_PTR0"$ii"=f"
189        done
190    
191        ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max"
192        ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd"
193        for ii in $PTRACERS_NUM ; do
194            for jj in $ptr_add ; do
195                name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`
196                tst=`grep $name $1 | wc -l | awk '{print $1}'`
197                if test ! "x$tst" = x0 ; then
198                    eval "HAVE_PTR0"$ii"=t"
199                fi
200            done
201            #  eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"'
202        done
203    }
204    
205  testoutput()  testoutput()
206  {  {
207      # testoutput diretory subdir      # testoutput directory subdir extension
208      #      #
209      #  test output in "directory"      #  test output in "directory"
210        if test "x$ADM" = x ; then
211            if [ $debug -gt 0 ]; then
212                echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2
213            fi
214            testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$?
215            if [ $debug -gt 0 ]; then
216                echo testoutput: cg2dres=$cg2dres 1>&2
217            fi
218            testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2 $3; tmin=$?
219            testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2 $3; tmax=$?
220            testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2 $3; tmean=$?
221            testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2 $3; tsd=$?
222            testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2 $3; smin=$?
223            testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2 $3; smax=$?
224            testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2 $3; smean=$?
225            testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2 $3; ssd=$?
226            testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2 $3; umin=$?
227            testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2 $3; umax=$?
228            testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2 $3; umean=$?
229            testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2 $3; usd=$?
230            testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2 $3; vmin=$?
231            testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$?
232            testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$?
233            testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$?
234    
235            #  This is for PTRACERS
236            for ii in $PTRACERS_NUM ; do
237                eval `echo "p0"$ii"_min=99"`
238                eval `echo "p0"$ii"_max=99"`
239                eval `echo "p0"$ii"_mean=99"`
240                eval `echo "p0"$ii"_sd=99"`
241                tst=`eval 'echo "$HAVE_PTR0'$ii'"'`
242                #echo 'tst = '$tst
243                if test "x$tst" = xt ; then
244                    a="trcstat_ptracer0"
245                    testoutput_for_prop $1 "$a"$ii"_min"  "p0"$ii"_min"  $2 $3
246                    RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL`
247                    testoutput_for_prop $1 "$a"$ii"_max"  "p0"$ii"_max"  $2 $3
248                    RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL`
249                    testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3
250                    RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL`
251                    testoutput_for_prop $1 "$a"$ii"_sd"   "p0"$ii"_sd"   $2 $3
252                    RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL`
253                fi
254            done
255    
256      if [ $debug -gt 0 ]; then          allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd"
257          echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2          allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd"
258      fi          allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd"
259      testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$?          allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd"
260      if [ $debug -gt 0 ]; then          allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd"
261          echo testoutput: cg2dres=$cg2dres 1>&2          allargs="$allargs $p04_min $p04_max $p04_mean $p04_sd"
262            allargs="$allargs $p05_min $p05_max $p05_mean $p05_sd"
263    
264            eval "dashnum $allargs"
265    
266        else
267            testoutput_ad $1 $2 "precision_grdchk_result"
268      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  
269  }  }
270    
271  genmakemodel()  genmakemodel()
# Line 181  genmakemodel() Line 274  genmakemodel()
274      if test "x$NOGENMAKE" = xt ; then      if test "x$NOGENMAKE" = xt ; then
275          echo "genmake skipped!"          echo "genmake skipped!"
276      else      else
277          GENMAKE2="$BASH ../../../tools/genmake2"          if test "x$BASH" = x ; then
278                GENMAKE2="../../../tools/genmake2"
279            else
280                GENMAKE2="$BASH ../../../tools/genmake2 -bash $BASH"
281            fi
282          (          (
283              cd $1;              cd $1;
284                command="$GENMAKE2  -ds -m $MAKE"
285                if test "x$ADM" = x ; then
286                    command="$command --mods=../code"
287                else
288                    command="$command --mods=../code_ad"
289                    command="$command -adof=../../../tools/adjoint_options/adjoint_staf"
290                fi
291                if test "x$OPTFILE" != xNONE ; then
292                    command="$command --optfile=$OPTFILE"
293                fi
294                if test "x$IEEE" != x ; then
295                    command="$command -ieee"
296                fi
297                if test "x$MPI" = xt ; then
298                    command="$command -mpi"
299                fi
300              printf 'genmake ... ' 1>&2              printf 'genmake ... ' 1>&2
301              # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1              $command > make.log 2>&1
             $GENMAKE2  -ds -m $MAKE --mods=../code "--optfile="$OPTFILE > make.log 2>&1  
302              RETVAL=$?              RETVAL=$?
303              for i in gm_state gm_optfile gm_local Makefile ; do              #  Reduce the size of the testing emails!
304                  if test -r $i ; then              head -100 Makefile > $CDIR/Makefile_head
                     cp $i $CDIR  
                 fi  
             done  
305              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
306                  tail make.log                  tail make.log
307                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed" 1>&2
308                  cp make.log $CDIR                  cp genmake_* make.log $CDIR
309                  return 1                  return 1
310              else              else
311                  echo "succesful" 1>&2                  echo "successful" 1>&2
312              fi              fi
313          )          )
314      fi      fi
# Line 227  makeclean() Line 336  makeclean()
336                      return 1                      return 1
337                  fi                  fi
338              fi              fi
339              echo succesful 1>&2              echo successful 1>&2
340              exit 0              exit 0
341          )          )
342      fi      fi
# Line 250  makedependmodel() Line 359  makedependmodel()
359                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
360                  return 1                  return 1
361              else              else
362                  echo succesful 1>&2                  echo successful 1>&2
363              fi              fi
364          )          )
365      fi      fi
# Line 263  makemodel() Line 372  makemodel()
372          cd $1;          cd $1;
373          if test -r Makefile ; then          if test -r Makefile ; then
374              printf 'make ... ' 1>&2              printf 'make ... ' 1>&2
375              $MAKE >> make.log 2>&1              if test "x$ADM" = x ; then
376                    if test "x$JOBS" = x ; then
377                        $MAKE >> make.log 2>&1
378                    else
379                        $MAKE -j $JOBS >> make.log 2>&1
380                    fi
381                else
382                    $MAKE adall >> make.log 2>&1
383                fi
384              RETVAL=$?              RETVAL=$?
385              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
386                  tail make.log                  tail make.log
# Line 271  makemodel() Line 388  makemodel()
388                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
389                  return 1                  return 1
390              else              else
391                  echo succesful 1>&2                  echo successful 1>&2
392              fi              fi
393          fi          fi
394      )      )
395  }  }
396    
397    symlink_mpifiles()
398    {
399        # Put special links so that MPI specific files are used
400        # This MUST be invoked between makeclean and makelinks because
401        # the Makefile will link to non-mpi files by default
402    
403        dir=$1
404        code_dir=$2
405        BUILD_DIR=$dir/$3
406        CODE_DIR=$dir/$code_dir
407        
408        # These are files that should replace their counter-part when using -mpi
409        MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")`
410    
411        #  Is this an MPI run?
412        if test "x$MPI" = xt ; then
413            # YES: We symbolically link these files to the build
414            # dir so long as there is no real file in place
415            for ii in $MPI_FILES ; do
416                i=`echo $ii | sed 's:^\./::'`
417                name=`echo $i | sed 's:_mpi::' `
418                cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
419                RETVAL=$?
420                if test "x$RETVAL" != x0 ; then
421                    if ! test -f $BUILD_DIR/$i ; then
422                        #echo Linking $name to $i
423                        (cd $BUILD_DIR; ln -sf ../$code_dir/$i $name)
424                    fi
425                fi
426            done
427        else
428            # NO: We undo any _mpi symbolically linked files
429            for ii in $MPI_FILES ; do
430                i=`echo $ii | sed 's:^\./::'`
431                name=`echo $i | sed 's:_mpi::' `
432                if test -L $BUILD_DIR/$name ; then
433                    cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1
434                    RETVAL=$?
435                    if test "x$RETVAL" = x0 ; then
436                        #echo Un-linking $name from $linktarg
437                        rm -f $BUILD_DIR/$name
438                    fi
439                fi
440            done
441        fi
442        
443    }
444    
445  linkdata()  linkdata()
446  {  {
447      # linkdata flag      # linkdata flag
448      #      #
449      # symbolically link data files to run directory      # symbolically link data files to run directory
450      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
451          ( cd $2 ;  ln -sf ../input/* . )          (
452                cd $2
453                if test "x$ADM" = x ; then
454                    files=`( cd ../input ; ls -1 | grep -v CVS )`
455                    for i in $files ; do
456                        if test ! -d "../input/"$i -a ! -f $i ; then
457                            ln -sf "../input/"$i $i
458                        fi
459                    done
460                else
461                    files=`( cd ../input ; ls -1 *.bin | grep -v CVS )`
462                    for i in $files ; do
463                        if test ! -d "../input/"$i ; then
464                            ln -sf "../input/"$i $i
465                        fi
466                    done
467                    files=`( cd ../input_ad ; ls -1 | grep -v CVS )`
468                    for i in $files ; do
469                        if test ! -d "../input_ad/"$i ; then
470                            ln -sf "../input_ad/"$i $i
471                        fi
472                    done
473                fi
474            )
475      fi      fi
476  }  }
477    
# Line 291  runmodel() Line 479  runmodel()
479  {  {
480      # runmodel directory      # runmodel directory
481      #      #
482      #  runs "$COMMAND" in "directory"      #  runs "$COMMAND in "directory"
483      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
484      (      (
485          cd $1          cd $1
486          printf 'runmodel: ' 1>&2          printf 'runmodel ... ' 1>&2
487          # make output.txt          # make output.txt
488          $COMMAND          echo
489            rm -f run.log
490            # echo "COMMAND='$COMMAND'"
491            # echo "pwd='"`pwd`"'"
492            ( eval $COMMAND ) > run.log 2>&1
493          RETVAL=$?          RETVAL=$?
494          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
495              cp output.txt $CDIR"/output.txt"              tail run.log
496                echo successful 1>&2
497                # === Reduce the size of the testing emails!
498                # if test "x$ADM" = x ; then
499                #   cp output.txt $CDIR"/output.txt"
500                # else
501                #   cp output.txt_adm $CDIR"/output.txt_adm"
502                # fi
503                if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
504              return 0              return 0
505          else          else
506                tail run.log
507                echo failed 1>&2
508                cp run.log $CDIR"/run.log"
509                if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
510              return 1              return 1
511          fi          fi
512      )      )
# Line 312  createcodelet() Line 516  createcodelet()
516  {  {
517      # create codelet for comparing model output      # create codelet for comparing model output
518    
519      echo -n "creating the comparison code...  "      printf "creating the comparison code...  "
520      cat > tmp_cmpnum.f <<EOFA      cat > tmp_cmpnum.c <<EOF
521        program cmpnum  #include <stdio.h>
522        implicit none  #include <math.h>
523        real*8 a,b,diff  int main( int argc, char** argv )  {
524        integer linnum,best    int linnum,best,lncnt;
525        best=-16    double a,b,abave,relerr;
526    99  read(*,*,end=70,err=60) linnum,a,b    best = -22;
527        diff=0.5*(abs(a)+abs(b))    lncnt = 0;
528  c     print *,a,b,diff,abs(a-b)/diff    while( 1 & (lncnt+=1) < 999 )  {
529        if (diff.gt.1.e-12) then      scanf("%d", &linnum);
530          diff=abs(a-b)/diff      if (linnum == -1)  break;
531          if (diff.gt.0.) then      scanf("%lf", &a);  scanf("%lf", &b);
532  c         print *,int(log10(diff)),diff      abave = 0.5*(fabs(a)+fabs(b));
533            linnum=int(log10(diff))      if (abave > 0.0) {
534            best=max(best,linnum)        relerr=fabs(a-b)/abave;
535          endif        if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); }
536        else        else { linnum = -16 ; }
537          if (best.eq.-16.and.diff.ne.0.) best=-22        best = (best > linnum) ? best : linnum;
538        endif      }
539        goto 99    }
540    60  stop 'cmpnum: An error occured reading a,b'    if (lncnt == 999) best=-29;
541    70  print *,-best    printf("%d\n", -best);
542        end    return 0;
543  EOFA  }
544    EOF
545        $CC -o tmp_cmpnum tmp_cmpnum.c -lm
546    
547      f77 tmp_cmpnum.f      if [ -x ./tmp_cmpnum ]; then
     if [ -x ./a.out ]; then  
548          echo "OK"          echo "OK"
549          return 0          return 0
550      else      else
551          echo          echo
552          echo "createcodelet: failed to compile codelet"          echo "ERROR: failed to compile comparison code -- please specify"
553            echo "  a C compiler using the CC environment variable."
554          exit 1          exit 1
555      fi      fi
556  }  }
# Line 383  $0 [-help] [-quick] [-verbose] dir1 [dir Line 589  $0 [-help] [-quick] [-verbose] dir1 [dir
589   -debug     Produce even more output which will mean nothing to most   -debug     Produce even more output which will mean nothing to most
590   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.   -force     Do "make CLEAN" before compiling. This forces a complete rebuild.
591   -clean     Do "make CLEAN" after compiling and testing.   -clean     Do "make CLEAN" after compiling and testing.
  -noieee    By default, $0 uses the -ieee option for genmake. This turns it off.  
592   -cleanup   Aggresively removes all model output, executables and object files   -cleanup   Aggresively removes all model output, executables and object files
593              and then exits. Use with care.              and then exits. Use with care.
594    
# Line 405  scandirs() Line 610  scandirs()
610    
611    
612  ###############################################################################  ###############################################################################
 ###############################################################################  
 ###############################################################################  
613    
614    
615  #  Default properties  #  Default properties
# Line 416  clean=0 Line 619  clean=0
619  expts=''  expts=''
620  # ieee=1  # ieee=1
621    
622    IEEE=true
623    if test "x$MITGCM_IEEE" != x ; then
624        IEEE=$MITGCM_IEEE
625    fi
626    
627    
628  CLEANUP=f  CLEANUP=f
629  QUICK=f  QUICK=f
630  NOGENMAKE=f  NOGENMAKE=f
# Line 423  NOCLEAN=f Line 632  NOCLEAN=f
632  NODEPEND=f  NODEPEND=f
633    
634  BASH=  BASH=
635  OPTFILES=  OPTFILE=NONE
636  ADDRESSES=  ADDRESSES=
637  TESTDIRS=  TESTDIRS=
638  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
639    HAVE_MPACK=
640  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
641  COMMAND="make output.txt"  COMMAND=
642  MAKE=make  if test "x$MAKE" = x ; then
643        MAKE=make
644    fi
645    if test "x$CC" = x ; then
646        CC=cc
647    fi
648    JOBS=
649  MPI=f  MPI=f
650    DELDIR=
651    
652    ADM=
653    
654    # Additional monitor types
655    PTRACERS_NUM="1 2 3 4 5"
656    
657  echo -n "parsing options...  "  printf "parsing options...  "
658    
659  ac_prev=  ac_prev=
660  for ac_option ; do  for ac_option ; do
# Line 452  for ac_option ; do Line 674  for ac_option ; do
674              usage ;;              usage ;;
675                    
676          -optfile | --optfile | -of | --of)          -optfile | --optfile | -of | --of)
677              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
678          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
679              OPTFILES=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
680                    
681          -addr | --addr | -a | --a)          -addr | --addr | -a | --a)
682              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
# Line 481  for ac_option ; do Line 703  for ac_option ; do
703          -make=* | --make=*)          -make=* | --make=*)
704              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
705    
706            -ptracers | --ptracers | -ptr | --ptr)
707                ac_prev=PTRACERS_NUM ;;
708            -ptracers=* | --ptracers=* | -ptr=* | --ptr=*)
709                PTRACERS_NUM=$ac_optarg ;;
710    
711            -j) ac_prev=JOBS ;;
712            -j=*) JOBS=$ac_optarg ;;
713    
714          -clean | --clean)          -clean | --clean)
715              CLEANUP=t ;;              CLEANUP=t ;;
716    
# Line 494  for ac_option ; do Line 724  for ac_option ; do
724              NODEPEND=t ;;              NODEPEND=t ;;
725    
726          -mpi) MPI=t ;;          -mpi) MPI=t ;;
727    
728            -adm | -ad) ADM=t ;;
729    
730            -ieee) IEEE=true ;;
731            -noieee) IEEE= ;;
732    
733          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
734          -debug) debug=1 ;;          -debug) debug=1 ;;
         -clean) clean=1 ;;  
735          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
736    
737            -deldir | -dd) DELDIR=t ;;
738    
739          -*)          -*)
740              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
741              usage              usage
# Line 523  if test "x$TESTDIRS" = x ; then Line 760  if test "x$TESTDIRS" = x ; then
760      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
761  fi  fi
762    
763  if test "x$OPTFILES" = x ; then  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
764      OPTFILES=$MITGCM_OF      OPTFILE=$MITGCM_OF
765  fi  fi
766  if test "x$OPTFILES" = x ; then  
767      echo "Error: please specify an optfile using either the command-line or"  if test "x$ADM" = xt -a "x$COMMAND" = x ; then
768      echo "  the MITGCM_OF environment variable.  Also, examples are located "      COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1"
769      echo "  in \$ROOTDIR/tools/build_options"  fi
770      exit 1  
771    if test "x$COMMAND" = x ; then
772        COMMAND="$MAKE output.txt"
773  fi  fi
774    
775  echo "OK"  echo "OK"
# Line 539  echo "OK" Line 778  echo "OK"
778  createcodelet  createcodelet
779    
780  #  build the mpack utility  #  build the mpack utility
781  build_mpack  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
782        echo "skipping mpack build"
783    else
784        build_mpack
785    fi
786    
787  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
788  MACH=`hostname`  MACH=`hostname`
789  UNAMEA=`uname -a`  UNAMEA=`uname -a`
790  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
791  BASE=$MACH"_"$DATE"_"  BASE="tr_"$MACH"_"$DATE"_"
792  DNUM=0  DNUM=0
793  DRESULTS="$BASE$DNUM"  DRESULTS="$BASE$DNUM"
794  while test -e $DRESULTS ; do  while test -e $DRESULTS ; do
# Line 555  done Line 798  done
798  mkdir $DRESULTS  mkdir $DRESULTS
799  RETVAL=$?  RETVAL=$?
800  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
801      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
802      exit 1      exit 1
803  fi  fi
804  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
805  date > $SUMMARY  printf "Start time:  " >> $SUMMARY
806  cat << EOF >> $SUMMARY  start_date=`date`
807                  T           S           U           V  echo $start_date > $SUMMARY
808  G D M    c        m  s        m  s        m  s        m  s  
809  E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .  of_path=
810  N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d  if test "x$OPTFILE" != xNONE ; then
811  2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .      if test -r $OPTFILE ; then
812            # get the path
813            path=${OPTFILE%/*}
814            if test "x$path" = x ; then
815                of_path=`pwd`
816            else
817                of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
818            fi
819            file=${OPTFILE##*/}
820            OPTFILE=$of_path/$file
821            cp $OPTFILE $DRESULTS
822            echo >> $SUMMARY
823            echo "  OPTFILE=$OPTFILE" >> $SUMMARY
824        else
825            echo | tee $SUMMARY
826            echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
827            exit 1
828        fi
829    else
830        echo >> $SUMMARY
831        echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
832        echo "   so the genmake default will be used." >> $SUMMARY
833    fi
834    echo
835    echo >> $SUMMARY
836    if test "x$ADM" = x ; then
837        line_0="            ----T-----  ----S-----  ----U-----  ----V-----"
838        line_1="G D M    c        m  s        m  s        m  s        m  s"
839        line_2="E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  ."
840        line_3="N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d"
841        line_4="2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  ."
842        for ii in $PTRACERS_NUM ; do
843            #  tst=`eval 'echo $HAVE_PTR0'$ii`
844            #  if test "x$tst" = xt ; then
845            line_0="$line_0  --PTR 0"$ii"--"
846            line_1="$line_1        m  s"
847            line_2="$line_2  m  m  e  ."
848            line_3="$line_3  i  a  a  d"
849            line_4="$line_4  n  x  n  ."
850            #  fi
851        done
852        echo "$line_0" | tee -a $SUMMARY
853        echo "$line_1" | tee -a $SUMMARY
854        echo "$line_2" | tee -a $SUMMARY
855        echo "$line_3" | tee -a $SUMMARY
856        echo "$line_4" | tee -a $SUMMARY
857        echo " "       | tee -a $SUMMARY
858    else
859        echo "ADJOINT=true" >> $SUMMARY
860        echo >> $SUMMARY
861        cat << EOF | tee -a $SUMMARY
862    G D M    C  G
863    E p a R  o  r
864    N n k u  s  a
865    2 d e n  t  d
866    
867  EOF  EOF
868    fi
869    
870  NDIR=0  #  ...and each test directory...
871    for dir in $TESTDIRS ; do
872        
873        #  Cleanup only!
874        if test "x$CLEANUP" = xt ; then
875            if test -r $dir/build/Makefile ; then
876                ( cd $dir/build ; make CLEAN )
877            fi
878            if test -r $dir/input/Makefile ; then
879                ( cd $dir/input ; make CLEAN )
880            fi
881            (
882                cd $dir
883                rm -rf tr_run.*
884            )
885            continue
886        fi
887    
888        #  Verify that the testdir exists and contains previous
889        #  results in the correct location--or skip this directory!
890        fout=
891        if test "x$ADM" = x ; then
892            fout=$dir"/results/output.txt"
893        else
894            fout=$dir"/results_ad/output.txt_adm"
895        fi
896        if test ! -r $fout ; then
897            echo "can't read \"$fout\" -- skipping $dir"
898            continue
899        fi
900        if test "x$ADM" = x ; then
901            check_for_add_mon_output  $fout
902        fi
903    
904  #  For each optfile...      # Check for additional types of monitor output
 for OPTFILE in $OPTFILES ; do  
905    
906      OPTFILE=`pwd`"/$OPTFILE"      builddir="input"
907      if test ! -r $OPTFILE ; then      rundir="input"
908          echo "Error: can't read optfile \"$OPTFILE\""      use_seperate_build=0
909          exit 1      if test -d $dir/build -a -r $dir/build ; then
910            builddir="build"
911            rundir="build"
912            use_seperate_build=1
913            linkdata $use_seperate_build $dir/$rundir
914      fi      fi
     echo  
     echo "OPTFILE=$OPTFILE" >> $SUMMARY  
     echo >> $SUMMARY  
915            
916      #  ...and each test directory...      #  Check whether there are "extra runs" for this testdir
917      for dir in $TESTDIRS ; do      extra_runs=
918        if test "x$ADM" = x -a "x$use_seperate_build" = x1 ; then
919          #  Cleanup only!          ex_run_dirs=`( cd $dir ; echo input.* )`
920          if test "x$CLEANUP" = xt ; then          echo "ex_run_dirs='$ex_run_dirs'"
921              if test -r $dir/build/Makefile ; then          for exd in $ex_run_dirs ; do
922                  ( cd $dir/build ; make CLEAN )              name=`echo $exd | sed -e 's/input.//g'`
923              fi              outf="$dir/results/output.txt.$name"
924              if test -r $dir/input/Makefile ; then              if test -f $outf -a -r $outf ; then
925                  ( cd $dir/input ; make CLEAN )                  extra_runs="$extra_runs $name"
926              fi              fi
927              continue          done
928          fi      fi
929    
930          #  Verify that the testdir exists and contains previous      if test "x$ADM" = x ; then
931          #  results in the correct location--or skip this directory!          code_dir=code
932          if test ! -r $dir"/results/output.txt" ; then          CODE_DIR=$dir/code
933              echo      else
934              echo "can't read \"$dir/results/output.txt\" -- skipping $dir"          code_dir=code_ad
935              echo          CODE_DIR=$dir/code_ad
936              continue      fi
937          fi      BUILD_DIR=$dir/$builddir
938    
939          #  Is this an MPI run?      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then
940          if test "x$MPI" = xt ; then          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
941              if test ! -r $dir"/code/CPP_EEOPTIONS.h_mpi" -o ! -r $dir"/code/SIZE.h_mpi" ; then          continue
942                  echo | tee -a $SUMMARY      fi
                 echo "can't read \"$dir/code/CPP_EEOPTIONS.h_mpi\" or \"$dir/code/SIZE.h_mpi\"" \  
                     | tee -a $SUMMARY  
                 continue  
             else  
                 cmp $dir"/code/CPP_EEOPTIONS.h_mpi" $dir"/code/CPP_EEOPTIONS.h"  
                 RETVAL=$?  
                 if test "x$RETVAL" != x0 ; then  
                     cp $dir"/code/CPP_EEOPTIONS.h_mpi" $dir"/code/CPP_EEOPTIONS.h"  
                 fi  
                 cmp $dir"/code/SIZE.h_mpi" $dir"/code/SIZE.h"  
                 RETVAL=$?  
                 if test "x$RETVAL" != x0 ; then  
                     cp $dir"/code/SIZE.h_mpi" $dir"/code/SIZE.h"  
                 fi  
             fi  
         else  
             if test -r $dir"/code/CPP_EEOPTIONS.h_nompi" ; then  
                 cmp $dir"/code/CPP_EEOPTIONS.h_nompi" $dir"/code/CPP_EEOPTIONS.h"  
                 RETVAL=$?  
                 if test "x$RETVAL" != x0 ; then  
                     cp $dir"/code/CPP_EEOPTIONS.h_nompi" $dir"/code/CPP_EEOPTIONS.h"  
                 fi  
             fi  
             if test -r $dir"/code/SIZE.h_nompi" ; then  
                 cmp $dir"/code/SIZE.h_nompi" $dir"/code/SIZE.h"  
                 RETVAL=$?  
                 if test "x$RETVAL" != x0 ; then  
                     cp $dir"/code/SIZE.h_nompi" $dir"/code/SIZE.h"  
                 fi  
             fi  
         fi  
943    
944          #  Create an output dir for each OPTFILE/tdir combination      echo "-------------------------------------------------------------------------------"
945          CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      echo
946          mkdir $CDIR      echo "Experiment:  $dir"
947          CDIR=`pwd`"/$CDIR"      echo
948        unset genmake makedepend make run
949        results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
950    
951          #  ...configue, make, run, and compare the output.      #  Create an output dir for each OPTFILE/tdir combination
952          echo "-------------------------------------------------------------------------------"      rel_CDIR=$DRESULTS"/"$dir
953          echo      mkdir $rel_CDIR
954          echo "Experiment:  $dir"      CDIR=`pwd`"/$rel_CDIR"
955        
956        if test "x$CLEANUP" = xt ; then
957            makeclean $dir/$builddir
958        else
959            genmakemodel $dir/$builddir && genmake=Y \
960                && makeclean $dir/$builddir \
961                && symlink_mpifiles $dir $code_dir $builddir \
962                && makedependmodel $dir/$builddir && makedepend=Y \
963                && makemodel $dir/$builddir && make=Y \
964                && linkdata $use_seperate_build $dir/$rundir \
965                && runmodel $dir/$rundir && run=Y \
966                && results=`testoutput $dir $rundir`
967        fi
968        
969        echo
970        if test "x$ADM" = x ; then
971            fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
972          echo          echo
973          unset genmake makedepend make run          echo "$fres" >> $SUMMARY
974          results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'          echo "fresults='$fres'" > $CDIR"/summary.txt"
975            echo "MACH='$MACH'" >> $CDIR"/summary.txt"
976          if [ -r $dir/build ]; then          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
977              seperatebuilddir=1          echo "DATE='$DATE'" >> $CDIR"/summary.txt"
978              builddir=build          echo "tdir='$dir'" >> $CDIR"/summary.txt"
             rundir=build  
             ( cd $dir/build; ln -sf ../input/* . )  
         else  
             seperatebuilddir=0  
             builddir=input  
             rundir=input  
         fi  
   
         if test "x$CLEANUP" = xt ; then  
             makeclean $dir/$builddir  
         else  
             genmakemodel $dir/$builddir && genmake=Y \  
                 && makeclean $dir/$builddir \  
                 && makedependmodel $dir/$builddir && makedepend=Y \  
                 && makemodel $dir/$builddir && make=Y \  
                 && linkdata $seperatebuilddir $dir/$rundir \  
                 && runmodel $dir/$builddir && run=Y \  
                 && results=`testoutput $dir $rundir`  
         fi  
979    
980            for ex in $extra_runs ; do
981                test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"
982                for ldir in input.$ex input ; do
983                    (
984                        cd "$dir/$ldir" > /dev/null 2>&1
985                        ls -1 2>/dev/null \
986                            | sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g'
987                    ) > tr_exrun_links
988                    (
989                        cd "$dir/tr_run.$ex"
990                        cat ../../tr_exrun_links | while read i ; do
991                            if test ! "x$i" = x ; then
992                                test ! -r $i  &&  ln -s "../"$ldir"/"$i $i
993                            fi
994                        done
995                    )
996                    test -e tr_exrun_links  &&  rm -f tr_exrun_links
997                done
998                ldir=build
999                (
1000                    cd "$dir/$ldir" > /dev/null 2>&1
1001                    ls -1 Makefile *.[fFhco] mitgcmuv  2>/dev/null \
1002                        | sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g'
1003                ) > tr_exrun_links
1004                (
1005                    cd "$dir/tr_run.$ex"
1006                        cat ../../tr_exrun_links | while read i ; do
1007                            if test ! "x$i" = x ; then
1008                                test ! -r $i  &&  ln -s "../"$ldir"/"$i $i
1009                            fi
1010                        done
1011                )
1012                test -e tr_exrun_links  &&  rm -f tr_exrun_links
1013                runmodel $dir/tr_run.$ex && run=Y \
1014                    && results=`testoutput $dir tr_run.$ex "."$ex`
1015                fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1016                fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1017                fres="$fres.$ex"
1018                echo
1019                echo "$fres" >> $SUMMARY
1020                echo "fresults='$fres'" > $CDIR"/summary.txt"
1021                echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1022                echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1023                echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1024                echo "tdir='$dir'" >> $CDIR"/summary.txt"
1025            done
1026        else
1027            fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1028            fres=$fres"$results   $dir"
1029          echo          echo
1030          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          echo "$fres" >> $SUMMARY
1031              ${run:-N} $results          echo "fresults='$fres'" > $CDIR"/summary.txt"
         echo  
         formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \  
             ${run:-N} $results >> $SUMMARY  
         echo "fresults='" > $CDIR"/summary.txt"  
         formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \  
             ${run:-N} $results >> $CDIR"/summary.txt"  
         echo "'" >> $CDIR"/summary.txt"  
1032          echo "MACH='$MACH'" >> $CDIR"/summary.txt"          echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1033          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1034          echo "DATE='$DATE'" >> $CDIR"/summary.txt"          echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1035          echo "tdir='$dir'" >> $CDIR"/summary.txt"          echo "tdir='$dir'" >> $CDIR"/summary.txt"
1036        fi
1037        
1038        echo "-------------------------------------------------------------------------------"
1039        
1040    done
1041    
1042          (  printf "Start time:  " >> $SUMMARY
1043              cd $DRESULTS  echo $start_date >> $SUMMARY
1044              tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1  printf "End time:    " >> $SUMMARY
1045              gzip $NDIR".tar"  date >> $SUMMARY
1046          )  
1047    #  If addresses were supplied and mpack built successfully, then try
1048          if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then  #  to send email using mpack.
1049              echo "No mail sent"  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
1050        echo "No results email was sent."
1051    else
1052        if test "x$HAVE_MPACK" = xt ; then
1053            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
1054                && gzip $DRESULTS".tar" \
1055                && $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES
1056            RETVAL=$?
1057            if test "x$RETVAL" != x0 ; then
1058                echo
1059                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
1060                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
1061                echo "  summary of results from the directory \"$DRESULTS\"."
1062                echo
1063          else          else
1064              $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES              echo
1065              RETVAL=$?              echo "An email containing results was sent to the following addresses:"
1066              if test "x$RETVAL" != x0 ; then              echo "  \"$ADDRESSES\""
1067                  echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"              echo
             else  
                 rm -f $DRESULTS"/"$NDIR".tar*"  
             fi  
1068          fi          fi
1069            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
1070            test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
1071        fi
1072    fi
1073    
1074          NDIR=$(( $NDIR + 1 ))  # rm -f tmp_cmpnum.f a.out
1075            rm -f tmp_cmpnum.c tmp_cmpnum
     done  
 done  
1076    
1077  rm tmp_cmpnum.f a.out  if test "x$CLEANUP" != xt ; then
1078        cat $SUMMARY | sed 's/ -- -- -- --//g'
1079        if test -e tr_out.txt ; then
1080            mv tr_out.txt tr_out.txt.old
1081        fi
1082        cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt
1083    fi
1084    
1085  cat $SUMMARY  if test "x$DELDIR" = xt ; then
1086        rm -rf $DRESULTS
1087    fi
1088    

Legend:
Removed from v.1.9.2.4  
changed lines
  Added in v.1.66

  ViewVC Help
Powered by ViewVC 1.1.22