/[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.2 by edhill, Mon Sep 1 16:50:27 2003 UTC revision 1.56 by edhill, Thu Dec 9 16:41:41 2004 UTC
# Line 1  Line 1 
1  #!/bin/bash  #! /usr/bin/env bash
2  #  #
3  #  $Header$  #  $Header$
4    #  $Name$
5  #  #
6    
7  usage()  usage()
# Line 10  usage() Line 11  usage()
11      echo      echo
12      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
13      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
14      echo "  (-optfile=|-of=)STRING   list of genmake2 \"optfiles\""      echo "  (-mpi)                   use MPI input files"
15      echo "  (-a|-addr)STRING         list of email recipients"      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
16      echo "  (-t|-tdir)STRING         list of \"test\" dirs"      echo "                             (DEF=\"-ieee\")"
17        echo "  (-optfile=|-of=)STRING   list of optfiles to use"
18        echo "  (-a|-addr) STRING        list of email recipients"
19        echo "                             (DEF=\"edhill@mitgcm.org\")"
20        echo "  (-t|-tdir) STRING        list of test dirs to use"
21        echo "                             (DEF=\"\" which builds all)"
22        echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"
23        echo "                             Bourne-compatible \"sh\" shell"
24        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\")"
28        echo "  (-m|-make) STRING        command to use for \"make\""
29        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\""
35        echo "  (-nogenmake|-ng)         skip the genmake stage"
36        echo "  (-noclean|-nc)           skip the \"make clean\" stage"
37        echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
38        echo "  (-deldir|-dd)            on success, delete the output directory"
39        echo
40        echo "and where STRING can be a whitespace-delimited list"
41        echo "such as:"
42        echo
43        echo "  -t 'exp0 exp2 exp3' "
44        echo "  -addr='abc@123.com testing@home.org'"
45        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      echo
49      exit 1      exit 1
50  }  }
# Line 20  usage() Line 52  usage()
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 60  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 73  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 90  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 102  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 122  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()
272  {  {
273      # genmakemodel directory      # genmakemodel directory
274      GENMAKE2="../../../tools/genmake2"      if test "x$NOGENMAKE" = xt ; then
275      (          echo "genmake skipped!"
276          cd $1;      else
277          printf 'genmake ... ' 1>&2          if test "x$BASH" = x ; then
278          # ../../../tools/genmake -ieee -mods=../code > make.log 2>&1              GENMAKE2="../../../tools/genmake2"
         $GENMAKE2  -ds --mods=../code "--optfile="$OPTFILE > make.log 2>&1  
         RETVAL=$?  
         for i in gm_state gm_optfile gm_local Makefile ; do  
             if test -r $i ; then  
                 cp $i $CDIR  
             fi  
         done  
         if test "x$RETVAL" != x0 ; then  
             tail make.log  
             echo "genmakemodel: genmake failed" 1>&2  
             cp make.log $CDIR  
             return 1  
279          else          else
280              echo "succesful" 1>&2              GENMAKE2="$BASH ../../../tools/genmake2 -bash $BASH"
281          fi          fi
282      )          (
283                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                printf 'genmake ... ' 1>&2
298                $command > make.log 2>&1
299                RETVAL=$?
300                #  Reduce the size of the testing emails!
301                head -100 Makefile > $CDIR/Makefile_head
302                if test "x$RETVAL" != x0 ; then
303                    tail make.log
304                    echo "genmakemodel: genmake failed" 1>&2
305                    cp genmake_* make.log $CDIR
306                    return 1
307                else
308                    echo "successful" 1>&2
309                fi
310            )
311        fi
312  }  }
313    
314  makeclean()  makeclean()
315  {  {
316      # makeclean directory      # makeclean directory
317      (      if test "x$NOCLEAN" = xt ; then
318          cd $1;          echo "make CLEAN skipped!"
319          rm -f output.txt      else
320          printf 'make CLEAN ... ' 2>&1          (
321          if test -r Makefile ; then              cd $1;
322              make CLEAN >> make.log 2>&1              if test -e output.txt ; then
323              RETVAL=$?                  rm -f output.txt
             if test "x$RETVAL" != x0 ; then  
                 tail make.log  
                 echo "makeclean: \"make CLEAN\" failed" 1>&2  
                 cp make.log $CDIR"/make.log"  
                 return 1  
324              fi              fi
325          fi              printf 'make CLEAN ... ' 2>&1
326          echo succesful 1>&2              if test -r Makefile ; then
327          exit 0                  $MAKE CLEAN >> make.log 2>&1
328      )                  RETVAL=$?
329                    if test "x$RETVAL" != x0 ; then
330                        tail make.log
331                        echo "makeclean: \"make CLEAN\" failed" 1>&2
332                        cp make.log $CDIR"/make.log"
333                        return 1
334                    fi
335                fi
336                echo successful 1>&2
337                exit 0
338            )
339        fi
340  }  }
341    
342  makedependmodel()  makedependmodel()
343  {  {
344      # makedependmodel directory      # makedependmodel directory
345      (      if test "x$NODEPEND" = xt ; then
346          cd $1;          echo "make depend skipped!"
347          printf 'make depend ... ' 1>&2      else
348          make depend >> make.log 2>&1          (
349          RETVAL=$?              cd $1;
350          if test "x$RETVAL" != x0 ; then              printf 'make depend ... ' 1>&2
351              tail make.log              $MAKE depend >> make.log 2>&1
352              echo "makedependmodel: make depend failed" 1>&2              RETVAL=$?
353              cp make.log $CDIR"/make.log"              if test "x$RETVAL" != x0 ; then
354              return 1                  tail make.log
355          else                  echo "makedependmodel: make depend failed" 1>&2
356              echo succesful 1>&2                  cp make.log $CDIR"/make.log"
357          fi                  return 1
358      )              else
359                    echo successful 1>&2
360                fi
361            )
362        fi
363  }  }
364    
365  makemodel()  makemodel()
# Line 231  makemodel() Line 369  makemodel()
369          cd $1;          cd $1;
370          if test -r Makefile ; then          if test -r Makefile ; then
371              printf 'make ... ' 1>&2              printf 'make ... ' 1>&2
372              make >> make.log 2>&1              if test "x$ADM" = x ; then
373                    if test "x$JOBS" = x ; then
374                        $MAKE >> make.log 2>&1
375                    else
376                        $MAKE -j $JOBS >> make.log 2>&1
377                    fi
378                else
379                    $MAKE adall >> make.log 2>&1
380                fi
381              RETVAL=$?              RETVAL=$?
382              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
383                  tail make.log                  tail make.log
# Line 239  makemodel() Line 385  makemodel()
385                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
386                  return 1                  return 1
387              else              else
388                  echo succesful 1>&2                  echo successful 1>&2
389              fi              fi
390          fi          fi
391      )      )
392  }  }
393    
394    symlink_mpifiles()
395    {
396        # Put special links so that MPI specific files are used
397        # This MUST be invoked between makeclean and makelinks because
398        # the Makefile will link to non-mpi files by default
399    
400        dir=$1
401        code_dir=$2
402        BUILD_DIR=$dir/$3
403        CODE_DIR=$dir/$code_dir
404        
405        # These are files that should replace their counter-part when using -mpi
406        MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")`
407    
408        #  Is this an MPI run?
409        if test "x$MPI" = xt ; then
410            # YES: We symbolically link these files to the build
411            # dir so long as there is no real file in place
412            for ii in $MPI_FILES ; do
413                i=`echo $ii | sed 's:^\./::'`
414                name=`echo $i | sed 's:_mpi::' `
415                cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
416                RETVAL=$?
417                if test "x$RETVAL" != x0 ; then
418                    if ! test -f $BUILD_DIR/$i ; then
419                        #echo Linking $name to $i
420                        (cd $BUILD_DIR; ln -sf ../$code_dir/$i $name)
421                    fi
422                fi
423            done
424        else
425            # NO: We undo any _mpi symbolically linked files
426            for ii in $MPI_FILES ; do
427                i=`echo $ii | sed 's:^\./::'`
428                name=`echo $i | sed 's:_mpi::' `
429                if test -L $BUILD_DIR/$name ; then
430                    cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1
431                    RETVAL=$?
432                    if test "x$RETVAL" = x0 ; then
433                        #echo Un-linking $name from $linktarg
434                        rm -f $BUILD_DIR/$name
435                    fi
436                fi
437            done
438        fi
439        
440    }
441    
442  linkdata()  linkdata()
443  {  {
444      # linkdata flag      # linkdata flag
445      #      #
446      # symbolically link data files to run directory      # symbolically link data files to run directory
447      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
448          ( cd $2 ;  ln -sf ../input/* . )          (
449                cd $2
450                if test "x$ADM" = x ; then
451                    files=`( cd ../input ; ls -1 | grep -v CVS )`
452                    for i in $files ; do
453                        if test ! -d "../input/"$i ; then
454                            ln -sf "../input/"$i $i
455                        fi
456                    done
457                else
458                    files=`( cd ../input ; ls -1 *.bin | grep -v CVS )`
459                    for i in $files ; do
460                        if test ! -d "../input/"$i ; then
461                            ln -sf "../input/"$i $i
462                        fi
463                    done
464                    files=`( cd ../input_ad ; ls -1 | grep -v CVS )`
465                    for i in $files ; do
466                        if test ! -d "../input_ad/"$i ; then
467                            ln -sf "../input_ad/"$i $i
468                        fi
469                    done
470                fi
471            )
472      fi      fi
473  }  }
474    
475  runmodel()  runmodel()
476  {  {
477      # runmodel directory exe      # runmodel directory
478      #      #
479      #  runs the model "exe" in "directory" (exe is relative to directory)      #  runs "$COMMAND in "directory"
480        #  (where "$COMMAND" is relative to "directory")
481      (      (
482          cd $1          cd $1
483          if [ -x $2 ]; then          printf 'runmodel ... ' 1>&2
484              if [ $quick -eq 0 ]; then          # make output.txt
485                  rm -f output.txt          echo
486              fi          rm -f run.log
487              printf 'runmodel: ' 1>&2          # echo "COMMAND='$COMMAND'"
488              make output.txt          # echo "pwd='"`pwd`"'"
489              RETVAL=$?          ( eval $COMMAND ) > run.log 2>&1
490              if test "x$RETVAL" = x0 ; then          RETVAL=$?
491                  cp output.txt $CDIR"/output.txt"          if test "x$RETVAL" = x0 ; then
492                  return 0              tail run.log
493              else              echo successful 1>&2
494                  return 1              # === Reduce the size of the testing emails!
495              fi              # if test "x$ADM" = x ; then
496                #   cp output.txt $CDIR"/output.txt"
497                # else
498                #   cp output.txt_adm $CDIR"/output.txt_adm"
499                # fi
500                if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
501                return 0
502            else
503                tail run.log
504                echo failed 1>&2
505                cp run.log $CDIR"/run.log"
506                if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
507                return 1
508          fi          fi
509      )      )
510  }  }
# Line 283  createcodelet() Line 513  createcodelet()
513  {  {
514      # create codelet for comparing model output      # create codelet for comparing model output
515    
516      echo -n "creating the comparison code...  "      printf "creating the comparison code...  "
517      cat > tmp_cmpnum.f <<EOFA      cat > tmp_cmpnum.c <<EOF
518        program cmpnum  #include <stdio.h>
519        implicit none  #include <math.h>
520        real*8 a,b,diff  int main( int argc, char** argv )  {
521        integer linnum,best    int linnum,best,lncnt;
522        best=-16    double a,b,abave,relerr;
523    99  read(*,*,end=70,err=60) linnum,a,b    best = -16;
524        diff=0.5*(abs(a)+abs(b))    lncnt = 0;
525  c     print *,a,b,diff,abs(a-b)/diff    while( 1 & (lncnt+=1) < 999 )  {
526        if (diff.gt.1.e-12) then      scanf("%d", &linnum);
527          diff=abs(a-b)/diff      if (linnum == -1)  break;
528          if (diff.gt.0.) then      scanf("%lf", &a);  scanf("%lf", &b);
529  c         print *,int(log10(diff)),diff      abave = 0.5*(fabs(a)+fabs(b));
530            linnum=int(log10(diff))      if (abave > 0.0) {
531            best=max(best,linnum)        relerr=fabs(a-b)/abave;
532          endif        if (relerr > 0.0) {
533        else          linnum = (int)log10(relerr);
534          if (best.eq.-16.and.diff.ne.0.) best=-22          best = (best > linnum) ? best : linnum;
535        endif        }
536        goto 99      }
537    60  stop 'cmpnum: An error occured reading a,b'      else {
538    70  print *,-best        if (best == -16)  best = -22;
539        end      }
540  EOFA    }
541      if (lncnt == 999) best=-29;
542      printf("%d\n", -best);
543      return 0;
544    }
545    EOF
546        cc -o tmp_cmpnum tmp_cmpnum.c -lm
547    
548      f77 tmp_cmpnum.f      if [ -x ./tmp_cmpnum ]; then
     if [ -x ./a.out ]; then  
549          echo "OK"          echo "OK"
550          return 0          return 0
551      else      else
552          echo          echo
553          echo "createcodelet: failed to compile codelet" | tee          echo "ERROR: failed to compile comparison code"
554          exit 1          exit 1
555      fi      fi
556  }  }
# Line 347  show_help() Line 582  show_help()
582  {  {
583      cat - << EOF      cat - << EOF
584  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]  $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
585   -help      Show this help message  
586   -quick     Skip "genmake" and "make depend" if the Makefile exists   -help|-h      Show this help message
587   -quiet     Reduce the amount of output   -quiet     Reduce the amount of output
588   -verbose   Produce copious amounts of output   -verbose   Produce copious amounts of output
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 376  scandirs() Line 610  scandirs()
610    
611    
612  ###############################################################################  ###############################################################################
 ###############################################################################  
 ###############################################################################  
613    
614    
615  #  Default properties  #  Default properties
616  debug=0  debug=0
617  verbose=1  verbose=1
 quick=0  
618  clean=0  clean=0
 ieee=1  
619  expts=''  expts=''
620    # ieee=1
621    
622    IEEE=true
623    if test "x$MITGCM_IEEE" != x ; then
624        IEEE=$MITGCM_IEEE
625    fi
626    
627  OPTFILES=  
628  ADDRESSES=edhill@mitgcm.org  CLEANUP=f
629    QUICK=f
630    NOGENMAKE=f
631    NOCLEAN=f
632    NODEPEND=f
633    
634    BASH=
635    OPTFILE=NONE
636    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=
642    MAKE=make
643    JOBS=
644    MPI=f
645    DELDIR=
646    
647    ADM=
648    
649    # Additional monitor types
650    PTRACERS_NUM="1 2 3 4 5"
651    
652  echo -n "parsing options...  "  printf "parsing options...  "
653    
654  ac_prev=  ac_prev=
655  for ac_option ; do  for ac_option ; do
# Line 414  for ac_option ; do Line 669  for ac_option ; do
669              usage ;;              usage ;;
670                    
671          -optfile | --optfile | -of | --of)          -optfile | --optfile | -of | --of)
672              ac_prev=OPTFILES ;;              ac_prev=OPTFILE ;;
673          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
674              OPTFILES=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
675                    
676          -addr | --addr | -a | --a)          -addr | --addr | -a | --a)
677              ac_prev=ADDRESSES ;;              ac_prev=ADDRESSES ;;
# Line 428  for ac_option ; do Line 683  for ac_option ; do
683          -tdir=* | --tdir=*)          -tdir=* | --tdir=*)
684              TESTDIRS=$ac_optarg ;;              TESTDIRS=$ac_optarg ;;
685    
686          -quick) quick=1 ;;          -bash | --bash | -b | --b)
687                ac_prev=BASH ;;
688            -bash=* | --bash=*)
689                BASH=$ac_optarg ;;
690    
691            -command | --command | -c | --c)
692                ac_prev=COMMAND ;;
693            -command=* | --command=*)
694                COMMAND=$ac_optarg ;;
695    
696            -make | --make | -m | --m)
697                ac_prev=MAKE ;;
698            -make=* | --make=*)
699                MAKE=$ac_optarg ;;
700    
701            -ptracers | --ptracers | -ptr | --ptr)
702                ac_prev=PTRACERS_NUM ;;
703            -ptracers=* | --ptracers=* | -ptr=* | --ptr=*)
704                PTRACERS_NUM=$ac_optarg ;;
705    
706            -j) ac_prev=JOBS ;;
707            -j=*) JOBS=$ac_optarg ;;
708    
709            -clean | --clean)
710                CLEANUP=t ;;
711    
712            -quick | --quick | -q | --q)
713                QUICK=t ;;
714            -nogenmake | --nogenmake | -ng | --ng)
715                NOGENMAKE=t ;;
716            -noclean | --noclean | -nc | --nc)
717                NOCLEAN=t ;;
718            -nodepend | --nodepend | -nd | --nd)
719                NODEPEND=t ;;
720    
721            -mpi) MPI=t ;;
722    
723            -adm | -ad) ADM=t ;;
724    
725            -ieee) IEEE=true ;;
726            -noieee) IEEE= ;;
727    
728          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
729          -debug) debug=1 ;;          -debug) debug=1 ;;
         -clean) clean=1 ;;  
         -noieee) ieee=0 ;;  
730          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
731    
732            -deldir | -dd) DELDIR=t ;;
733    
734          -*)          -*)
735              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
736              usage              usage
# Line 449  for ac_option ; do Line 745  for ac_option ; do
745            
746  done  done
747    
748    if test "x$QUICK" = xt ; then
749        NOGENMAKE=t
750        NOCLEAN=t
751        NODEPEND=t
752    fi
753    
754  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
755      TESTDIRS=`scandirs`      TESTDIRS=`scandirs`
756  fi  fi
757    
758    if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
759        OPTFILE=$MITGCM_OF
760    fi
761    
762    if test "x$ADM" = xt -a "x$COMMAND" = x ; then
763        COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1"
764    fi
765    
766    if test "x$COMMAND" = x ; then
767        COMMAND="$MAKE output.txt"
768    fi
769    
770  echo "OK"  echo "OK"
771    
772  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
773  createcodelet  createcodelet
774    
775  #  build the mpack utility  #  build the mpack utility
776  build_mpack  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
777        echo "skipping mpack build"
778    else
779        build_mpack
780    fi
781    
782  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
783  MACH=`hostname`  MACH=`hostname`
784  UNAMEA=`uname -a`  UNAMEA=`uname -a`
785  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
786  BASE=$MACH"_"$DATE"_"  BASE="tr_"$MACH"_"$DATE"_"
787  DNUM=0  DNUM=0
788  DRESULTS="$BASE$DNUM"  DRESULTS="$BASE$DNUM"
789  while test -e $DRESULTS ; do  while test -e $DRESULTS ; do
# Line 475  done Line 793  done
793  mkdir $DRESULTS  mkdir $DRESULTS
794  RETVAL=$?  RETVAL=$?
795  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
796      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
797      exit 1      exit 1
798  fi  fi
799  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
800  date > $SUMMARY  printf "Start time:  " >> $SUMMARY
801  cat << EOF >> $SUMMARY  start_date=`date`
802                  T           S           U           V  echo $start_date > $SUMMARY
803  G D M    c        m  s        m  s        m  s        m  s  
804  E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .  of_path=
805  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
806  2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .      if test -r $OPTFILE ; then
807            # get the path
808            path=${OPTFILE%/*}
809            if test "x$path" = x ; then
810                of_path=`pwd`
811            else
812                of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
813            fi
814            file=${OPTFILE##*/}
815            OPTFILE=$of_path/$file
816            cp $OPTFILE $DRESULTS
817            echo >> $SUMMARY
818            echo "  OPTFILE=$OPTFILE" >> $SUMMARY
819        else
820            echo | tee $SUMMARY
821            echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
822            exit 1
823        fi
824    else
825        echo >> $SUMMARY
826        echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
827        echo "   so the genmake default will be used." >> $SUMMARY
828    fi
829    echo
830    echo >> $SUMMARY
831    if test "x$ADM" = x ; then
832        line_0="            ----T-----  ----S-----  ----U-----  ----V-----"
833        line_1="G D M    c        m  s        m  s        m  s        m  s"
834        line_2="E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  ."
835        line_3="N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d"
836        line_4="2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  ."
837        for ii in $PTRACERS_NUM ; do
838            #  tst=`eval 'echo $HAVE_PTR0'$ii`
839            #  if test "x$tst" = xt ; then
840            line_0="$line_0  --PTR 0"$ii"--"
841            line_1="$line_1        m  s"
842            line_2="$line_2  m  m  e  ."
843            line_3="$line_3  i  a  a  d"
844            line_4="$line_4  n  x  n  ."
845            #  fi
846        done
847        echo "$line_0" | tee -a $SUMMARY
848        echo "$line_1" | tee -a $SUMMARY
849        echo "$line_2" | tee -a $SUMMARY
850        echo "$line_3" | tee -a $SUMMARY
851        echo "$line_4" | tee -a $SUMMARY
852        echo " "       | tee -a $SUMMARY
853    else
854        echo "ADJOINT=true" >> $SUMMARY
855        echo >> $SUMMARY
856        cat << EOF | tee -a $SUMMARY
857    G D M    C  G
858    E p a R  o  r
859    N n k u  s  a
860    2 d e n  t  d
861    
862  EOF  EOF
863    fi
864    
865  NDIR=0  #  ...and each test directory...
866    for dir in $TESTDIRS ; do
867        
868        #  Cleanup only!
869        if test "x$CLEANUP" = xt ; then
870            if test -r $dir/build/Makefile ; then
871                ( cd $dir/build ; make CLEAN )
872            fi
873            if test -r $dir/input/Makefile ; then
874                ( cd $dir/input ; make CLEAN )
875            fi
876            continue
877        fi
878    
879  #  For each optfile...      #  Verify that the testdir exists and contains previous
880  for OPTFILE in $OPTFILES ; do      #  results in the correct location--or skip this directory!
881        fout=
882        if test "x$ADM" = x ; then
883            fout=$dir"/results/output.txt"
884        else
885            fout=$dir"/results_ad/output.txt_adm"
886        fi
887        if test ! -r $fout ; then
888            echo "can't read \"$fout\" -- skipping $dir"
889            continue
890        fi
891        if test "x$ADM" = x ; then
892            check_for_add_mon_output  $fout
893        fi
894    
895      OPTFILE=`pwd`"/$OPTFILE"      # Check for additional types of monitor output
896      if test ! -r $OPTFILE ; then  
897          echo "Error: can't read optfile \"$OPTFILE\""      builddir="input"
898          exit 1      rundir="input"
899        use_seperate_build=0
900        if test -d $dir/build -a -r $dir/build ; then
901            builddir="build"
902            rundir="build"
903            use_seperate_build=1
904            linkdata $use_seperate_build $dir/$rundir
905      fi      fi
     echo  
     echo "OPTFILE=$OPTFILE" >> $SUMMARY  
     echo >> $SUMMARY  
906            
907      #  ...and each test directory...      #  Check whether there are "extra runs" for this testdir
908      for dir in $TESTDIRS ; do      extra_runs=
909                if test "x$ADM" = x -a "x$use_seperate_build" = x1 ; then
910          #  Create an output dir for each OPTFILE/tdir combination          ex_run_dirs=`( cd $dir ; echo input.* )`
911          CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR          echo "ex_run_dirs='$ex_run_dirs'"
912          mkdir $CDIR          for exd in $ex_run_dirs ; do
913          CDIR=`pwd`"/$CDIR"              name=`echo $exd | sed -e 's/input.//g'`
914                outf="$dir/results/output.txt.$name"
915                if test -f $outf -a -r $outf ; then
916                    extra_runs="$extra_runs $name"
917                fi
918            done
919        fi
920    
921          #  ...configue, make, run, and compare the output.      if test "x$ADM" = x ; then
922          echo "-------------------------------------------------------------------------------"          code_dir=code
923          echo          CODE_DIR=$dir/code
924          echo "Experiment:  $dir"      else
925          echo          code_dir=code_ad
926          unset genmake makedepend make run          CODE_DIR=$dir/code_ad
927          results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'      fi
928          ( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; )      BUILD_DIR=$dir/$builddir
         if [ -r $dir/build ]; then  
             seperatebuilddir=1  
             builddir=build  
             rundir=build  
             ( cd $dir/build; ln -sf ../input/* . )  
         else  
             seperatebuilddir=0  
             builddir=input  
             rundir=input  
         fi  
929    
930          #  Verify that the testdir exists and contains previous      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then
931          #  results in the correct location--or skip this directory!          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
932          if test ! -r $dir"/results/output.txt" ; then          continue
933              echo | tee $SUMMARY      fi
934              echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \  
935                  | tee $SUMMARY      echo "-------------------------------------------------------------------------------"
936              continue      echo
937          fi      echo "Experiment:  $dir"
938        echo
939        unset genmake makedepend make run
940        results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
941    
942        #  Create an output dir for each OPTFILE/tdir combination
943        rel_CDIR=$DRESULTS"/"$dir
944        mkdir $rel_CDIR
945        CDIR=`pwd`"/$rel_CDIR"
946        
947        if test "x$CLEANUP" = xt ; then
948            makeclean $dir/$builddir
949        else
950          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
951              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
952                && symlink_mpifiles $dir $code_dir $builddir \
953              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
954              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
955              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $use_seperate_build $dir/$rundir \
956              && runmodel $dir/$builddir mitgcmuv && run=Y \              && runmodel $dir/$rundir && run=Y \
957              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
958        fi
959        
960        echo
961        if test "x$ADM" = x ; then
962            fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
963          echo          echo
964          formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \          echo "$fres" >> $SUMMARY
965              ${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"  
966          echo "MACH='$MACH'" >> $CDIR"/summary.txt"          echo "MACH='$MACH'" >> $CDIR"/summary.txt"
967          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
968          echo "DATE='$DATE'" >> $CDIR"/summary.txt"          echo "DATE='$DATE'" >> $CDIR"/summary.txt"
969          echo "tdir='$dir'" >> $CDIR"/summary.txt"          echo "tdir='$dir'" >> $CDIR"/summary.txt"
970    
971          (          for ex in $extra_runs ; do
972              cd $DRESULTS              test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex"
973              tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1              mkdir "$dir/tr_run.$ex"
974              gzip $NDIR".tar"              links=`( cd "$dir/input" > /dev/null 2>&1 ; ls -1 | grep -v CVS )`
975          )              (
976                    cd "$dir/tr_run.$ex"
977                    for i in $links; do
978                        ln -s ../input/$i $i
979                    done
980                )
981                links=`( cd "$dir/input.$ex" > /dev/null 2>&1 ; ls -1 | grep -v CVS )`
982                (
983                    cd "$dir/tr_run.$ex"
984                    for i in $links; do
985                        test -e $i  &&  rm -f $i
986                        ln -s ../input.$ex/$i $i
987                    done
988                    ln -s ../$builddir/mitgcmuv mitgcmuv
989                )
990                runmodel $dir/tr_run.$ex && run=Y \
991                    && results=`testoutput $dir tr_run.$ex "."$ex`
992                fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
993                fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
994                fres="$fres.$ex"
995                echo
996                echo "$fres" >> $SUMMARY
997                echo "fresults='$fres'" > $CDIR"/summary.txt"
998                echo "MACH='$MACH'" >> $CDIR"/summary.txt"
999                echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1000                echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1001                echo "tdir='$dir'" >> $CDIR"/summary.txt"
1002            done
1003        else
1004            fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1005            fres=$fres"$results   $dir"
1006            echo
1007            echo "$fres" >> $SUMMARY
1008            echo "fresults='$fres'" > $CDIR"/summary.txt"
1009            echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1010            echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1011            echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1012            echo "tdir='$dir'" >> $CDIR"/summary.txt"
1013        fi
1014        
1015        echo "-------------------------------------------------------------------------------"
1016        
1017    done
1018    
1019          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES  printf "Start time:  " >> $SUMMARY
1020    echo $start_date >> $SUMMARY
1021    printf "End time:    " >> $SUMMARY
1022    date >> $SUMMARY
1023    
1024    #  If addresses were supplied and mpack built successfully, then try
1025    #  to send email using mpack.
1026    if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
1027        echo "No results email was sent."
1028    else
1029        if test "x$HAVE_MPACK" = xt ; then
1030            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
1031                && gzip $DRESULTS".tar" \
1032                && $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES
1033          RETVAL=$?          RETVAL=$?
1034          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
1035              echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"              echo
1036                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
1037                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
1038                echo "  summary of results from the directory \"$DRESULTS\"."
1039                echo
1040          else          else
1041              rm -f $DRESULTS"/"$NDIR".tar*"              echo
1042                echo "An email containing results was sent to the following addresses:"
1043                echo "  \"$ADDRESSES\""
1044                echo
1045          fi          fi
1046            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
1047            test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
1048        fi
1049    fi
1050    
1051          NDIR=$(( $NDIR + 1 ))  # rm -f tmp_cmpnum.f a.out
1052            rm -f tmp_cmpnum.c tmp_cmpnum
     done  
 done  
1053    
1054  rm tmp_cmpnum.f a.out  if test "x$CLEANUP" != xt ; then
1055        cat $SUMMARY
1056        if test -e tr_out.txt ; then
1057            mv tr_out.txt tr_out.txt.old
1058        fi
1059        cat $SUMMARY > tr_out.txt
1060    fi
1061    
1062  cat $SUMMARY  if test "x$DELDIR" = xt ; then
1063        rm -rf $DRESULTS
1064    fi
1065    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.56

  ViewVC Help
Powered by ViewVC 1.1.22