/[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.11 by edhill, Fri Oct 10 03:29:44 2003 UTC revision 1.24 by edhill, Sun Nov 30 01:28:51 2003 UTC
# Line 1  Line 1 
1  #!/bin/bash  #! /usr/bin/env bash
2  #  #
3  #  $Header$  #  $Header$
4  #  $Name$  #  $Name$
# Line 13  usage() Line 13  usage()
13      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
14      echo "  (-mpi)                   use MPI input files"      echo "  (-mpi)                   use MPI input files"
15      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
16        echo "                             (DEF=\"noieee\")"
17      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-optfile=|-of=)STRING   list of optfiles to use"
18      echo "  (-a|-addr)STRING         list of email recipients"      echo "  (-a|-addr) STRING        list of email recipients"
19      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"edhill@mitgcm.org\")"
20      echo "  (-t|-tdir)STRING         list of test dirs to use"      echo "  (-t|-tdir) STRING        list of test dirs to use"
21      echo "                             (DEF=\"\" which builds all)"      echo "                             (DEF=\"\" which builds all)"
22      echo "  (-b|-bash)STRING         location of \"bash\" executable"      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"
23      echo "                             (DEF=\"\" for \"/bin/bash\")"      echo "                             Bourne-compatible \"sh\" shell"
24      echo "  (-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 "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\""
31      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
# Line 44  build_mpack() Line 47  build_mpack()
47      echo -n "building the mpack utility...  "      echo -n "building the mpack utility...  "
48      if test ! -x "$MPACKDIR/mpack" ; then      if test ! -x "$MPACKDIR/mpack" ; then
49          if test ! -d $MPACKDIR ; then          if test ! -d $MPACKDIR ; then
50                echo
51              echo "Error: can't find \"$MPACKDIR\""              echo "Error: can't find \"$MPACKDIR\""
52              echo "  are you sure this program is being run in the correct "              echo "  are you sure this program is being run in the correct "
53              echo "  (that is, \"MITGCM_ROOT\verification\") directory?"              echo "  (that is, \"MITGCM_ROOT\verification\") directory?"
54              exit 1              echo
55                HAVE_MPACK=f
56          fi          fi
57          echo -n "building mpack...  "          echo -n "building mpack...  "
58          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1
# Line 55  build_mpack() Line 60  build_mpack()
60          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
61              echo              echo
62              echo "Error building the mpack tools at: $MPACK_DIR"              echo "Error building the mpack tools at: $MPACK_DIR"
63              exit 1              echo
64                HAVE_MPACK=f
65            else
66                HAVE_MPACK=t
67          fi          fi
68        else
69            HAVE_MPACK=t
70      fi      fi
71      echo "OK"      echo "OK"
72  }  }
73    
 compare_lines()  
 {  
     # use codelet to compare lines  
     if [ $verbose -gt 1 ]; then  
         cat tmp3.txt 1>&2  
     fi  
     return `./a.out < tmp3.txt`  
 }  
   
74  testoutput_for_prop()  testoutput_for_prop()
75  {  {
76      # testoutput_for_prop dir s1 label subdir      # testoutput_for_prop dir s1 label subdir
# Line 81  testoutput_for_prop() Line 82  testoutput_for_prop()
82          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2
83      fi      fi
84      if [ -r $1/$4/output.txt ]; then      if [ -r $1/$4/output.txt ]; then
85          grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt          grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt
86          lncnt=`wc -l tmp1.txt | awk '{print $1}' `          lncnt=`wc -l tmp1.txt | awk '{print $1}' `
87          if [ $lncnt -lt 3 ]; then          if [ $lncnt -lt 3 ]; then
88              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
# Line 96  testoutput_for_prop() Line 97  testoutput_for_prop()
97      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
98          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2
99      fi      fi
100      grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt      grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt
101      lncnt=`wc -l tmp2.txt | awk '{print $1}' `      lncnt=`wc -l tmp2.txt | awk '{print $1}' `
102      if [ $lncnt -lt 3 ]; then      if [ $lncnt -lt 3 ]; then
103          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
# Line 111  testoutput_for_prop() Line 112  testoutput_for_prop()
112      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
113          echo testoutput_for_prop: compare_lines 1>&2          echo testoutput_for_prop: compare_lines 1>&2
114      fi      fi
115      compare_lines      if [ $verbose -gt 1 ]; then
116      digits_of_similarity=$?          cat tmp3.txt 1>&2
117        fi
118        echo "-1" >> tmp3.txt
119        # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
120        cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
121        digits_of_similarity=`./tmp_cmpnum < tmp4.txt`
122      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
123          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
124              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2
# Line 123  testoutput_for_prop() Line 129  testoutput_for_prop()
129              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
130          fi          fi
131      fi      fi
132      rm tmp1.txt tmp2.txt tmp3.txt      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
133            
134      return $digits_of_similarity      return $digits_of_similarity
135  }  }
# Line 143  dashnum() Line 149  dashnum()
149      done      done
150  }  }
151    
152    testoutput_ad()
153    {
154        grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt
155        grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt
156        grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt
157        grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt
158        join t05.txt t15.txt > t5.txt
159        join t06.txt t16.txt > t6.txt
160        echo "-1" >> t5.txt
161        echo "-1" >> t6.txt
162        digits_5=`./tmp_cmpnum < t5.txt`
163        digits_6=`./tmp_cmpnum < t6.txt`
164        dashnum $digits_5 $digits_6
165        rm -f t[01][56].txt t[56].txt
166    }
167    
168  testoutput()  testoutput()
169  {  {
170      # testoutput diretory subdir      # testoutput directory subdir
171      #      #
172      #  test output in "directory"      #  test output in "directory"
173        if test "x$ADM" = x ; then
174      if [ $debug -gt 0 ]; then          if [ $debug -gt 0 ]; then
175          echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2              echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2
176      fi          fi
177      testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$?          testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$?
178      if [ $debug -gt 0 ]; then          if [ $debug -gt 0 ]; then
179          echo testoutput: cg2dres=$cg2dres 1>&2              echo testoutput: cg2dres=$cg2dres 1>&2
180            fi
181            testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?
182            testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?
183            testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?
184            testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$?
185            testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$?
186            testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$?
187            testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$?
188            testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$?
189            testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$?
190            testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$?
191            testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$?
192            testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$?
193            testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$?
194            testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$?
195            testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$?
196            testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$?
197            dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \
198                $umin $umax $umean $usd $vmin $vmax $vmean $vsd
199        else
200            testoutput_ad $1 $2 "precision_grdchk_result"
201      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  
202  }  }
203    
204  genmakemodel()  genmakemodel()
# Line 187  genmakemodel() Line 210  genmakemodel()
210          GENMAKE2="$BASH ../../../tools/genmake2"          GENMAKE2="$BASH ../../../tools/genmake2"
211          (          (
212              cd $1;              cd $1;
213              command="$GENMAKE2  -ds -m $MAKE --mods=../code"              command="$GENMAKE2  -ds -m $MAKE"
214                if test "x$ADM" = x ; then
215                    command="$command --mods=../code"
216                else
217                    command="$command --mods=../code_ad"
218                    command="$command -adof=../../../tools/adjoint_options/adjoint_staf"
219                fi
220              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
221                  command="$command --optfile=$OPTFILE"                  command="$command --optfile=$OPTFILE"
                 # echo "  command=\"$command\""  
222              fi              fi
223              if test "x$IEEE" != x ; then              if test "x$IEEE" != x ; then
224                  command="$command -ieee"                  command="$command -ieee"
225              fi              fi
             # echo "command: \"$command\""  
226              printf 'genmake ... ' 1>&2              printf 'genmake ... ' 1>&2
227              $command > make.log 2>&1              $command > make.log 2>&1
228              RETVAL=$?              RETVAL=$?
229              for i in genmake_state genmake_optfile genmake_local Makefile ; do              cp Makefile $CDIR
                 if test -r $i ; then  
                     cp $i $CDIR  
                 fi  
             done  
230              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
231                  tail make.log                  tail make.log
232                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed" 1>&2
233                  cp make.log $CDIR                  cp genmake_* make.log $CDIR
234                  return 1                  return 1
235              else              else
236                  echo "succesful" 1>&2                  echo "successful" 1>&2
237              fi              fi
238          )          )
239      fi      fi
# Line 238  makeclean() Line 261  makeclean()
261                      return 1                      return 1
262                  fi                  fi
263              fi              fi
264              echo succesful 1>&2              echo successful 1>&2
265              exit 0              exit 0
266          )          )
267      fi      fi
# Line 261  makedependmodel() Line 284  makedependmodel()
284                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
285                  return 1                  return 1
286              else              else
287                  echo succesful 1>&2                  echo successful 1>&2
288              fi              fi
289          )          )
290      fi      fi
# Line 274  makemodel() Line 297  makemodel()
297          cd $1;          cd $1;
298          if test -r Makefile ; then          if test -r Makefile ; then
299              printf 'make ... ' 1>&2              printf 'make ... ' 1>&2
300              $MAKE >> make.log 2>&1              if test "x$ADM" = x ; then
301                    $MAKE >> make.log 2>&1
302                else
303                    $MAKE adall >> make.log 2>&1
304                fi
305              RETVAL=$?              RETVAL=$?
306              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
307                  tail make.log                  tail make.log
# Line 282  makemodel() Line 309  makemodel()
309                  cp make.log $CDIR"/make.log"                  cp make.log $CDIR"/make.log"
310                  return 1                  return 1
311              else              else
312                  echo succesful 1>&2                  echo successful 1>&2
313              fi              fi
314          fi          fi
315      )      )
# Line 293  linkdata() Line 320  linkdata()
320      # linkdata flag      # linkdata flag
321      #      #
322      # symbolically link data files to run directory      # symbolically link data files to run directory
323      if [ $1 -ne 0 ]; then      if test "x$1" = x1 ; then
324          ( cd $2 ;  ln -sf ../input/* . )          (
325                cd $2
326                if test "x$ADM" = x ; then
327                    files=`( cd ../input ; ls -1 | grep -v CVS )`
328                    for i in $files ; do
329                        if test ! -d "../input/"$i ; then
330                            ln -sf "../input/"$i $i
331                        fi
332                    done
333                else
334                    files=`( cd ../input ; ls -1 *.bin | grep -v CVS )`
335                    for i in $files ; do
336                        if test ! -d "../input/"$i ; then
337                            ln -sf "../input/"$i $i
338                        fi
339                    done
340                    files=`( cd ../input_ad ; ls -1 | grep -v CVS )`
341                    for i in $files ; do
342                        if test ! -d "../input_ad/"$i ; then
343                            ln -sf "../input_ad/"$i $i
344                        fi
345                    done
346                fi
347            )
348      fi      fi
349  }  }
350    
# Line 302  runmodel() Line 352  runmodel()
352  {  {
353      # runmodel directory      # runmodel directory
354      #      #
355      #  runs "$COMMAND" in "directory"      #  runs "$COMMAND in "directory"
356      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
357      (      (
358          cd $1          cd $1
359          printf 'runmodel: ' 1>&2          printf 'runmodel ... ' 1>&2
360          # make output.txt          # make output.txt
361          $COMMAND          $COMMAND >> run.log 2>&1
362          RETVAL=$?          RETVAL=$?
363          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
364              cp output.txt $CDIR"/output.txt"              echo successful 1>&2
365                if test "x$ADM" = x ; then
366                    cp output.txt $CDIR"/output.txt"
367                else
368                    cp output.txt_adm $CDIR"/output.txt_adm"
369                fi
370              return 0              return 0
371          else          else
372                tail run.log
373                echo failed 1>&2
374                cp run.log $CDIR"/run.log"
375              return 1              return 1
376          fi          fi
377      )      )
# Line 324  createcodelet() Line 382  createcodelet()
382      # create codelet for comparing model output      # create codelet for comparing model output
383    
384      echo -n "creating the comparison code...  "      echo -n "creating the comparison code...  "
385      cat > tmp_cmpnum.f <<EOFA      cat > tmp_cmpnum.c <<EOF
386        program cmpnum  #include <stdio.h>
387        implicit none  #include <math.h>
388        real*8 a,b,diff  int main( int argc, char** argv )  {
389        integer linnum,best    int linnum,best;
390        best=-16    double a,b,diff;
391    99  read(*,*,end=70,err=60) linnum,a,b    best = -16;
392        diff=0.5*(abs(a)+abs(b))    while( 1 )  {
393  c     print *,a,b,diff,abs(a-b)/diff      scanf("%d", &linnum);
394        if (diff.gt.1.e-12) then      if (linnum == -1)  break;
395          diff=abs(a-b)/diff      scanf("%lf", &a);  scanf("%lf", &b);
396          if (diff.gt.0.) then      diff = 0.5*(fabs(a)+fabs(b));
397  c         print *,int(log10(diff)),diff      if (diff > 1.e-12) {
398            linnum=int(log10(diff))        diff=fabs(a-b)/diff;
399            best=max(best,linnum)        if (diff > 0.0) {
400          endif          linnum = (int)log10(diff);
401        else          best = (best > linnum) ? best : linnum;
402          if (best.eq.-16.and.diff.ne.0.) best=-22        }
403        endif        else {
404        goto 99          if (best == -16 && diff != 0)  best = -22;
405    60  stop 'cmpnum: An error occured reading a,b'        }
406    70  print *,-best      }
407        end    }
408  EOFA    printf("%d\n", -best);
409      return 0;
410    }
411    EOF
412        cc -o tmp_cmpnum tmp_cmpnum.c -lm
413    
414      f77 tmp_cmpnum.f      if [ -x ./tmp_cmpnum ]; then
     if [ -x ./a.out ]; then  
415          echo "OK"          echo "OK"
416          return 0          return 0
417      else      else
418          echo          echo
419          echo "createcodelet: failed to compile codelet"          echo "ERROR: failed to compile comparison code"
420          exit 1          exit 1
421      fi      fi
422  }  }
# Line 415  scandirs() Line 476  scandirs()
476    
477    
478  ###############################################################################  ###############################################################################
 ###############################################################################  
 ###############################################################################  
479    
480    
481  #  Default properties  #  Default properties
# Line 443  OPTFILE=NONE Line 502  OPTFILE=NONE
502  ADDRESSES=  ADDRESSES=
503  TESTDIRS=  TESTDIRS=
504  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
505    HAVE_MPACK=
506  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
507  COMMAND="make output.txt"  COMMAND=
508  MAKE=make  MAKE=make
509  MPI=f  MPI=f
510    
511    ADM=
512    
513  echo -n "parsing options...  "  echo -n "parsing options...  "
514    
515  ac_prev=  ac_prev=
# Line 509  for ac_option ; do Line 571  for ac_option ; do
571          -nodepend | --nodepend | -nd | --nd)          -nodepend | --nodepend | -nd | --nd)
572              NODEPEND=t ;;              NODEPEND=t ;;
573    
574          -mpi) MPI=true ;;          -mpi) MPI=t ;;
575    
576            -adm | -ad) ADM=t ;;
577    
578          -ieee) IEEE=true ;;          -ieee) IEEE=true ;;
579          -noieee) IEEE= ;;          -noieee) IEEE= ;;
# Line 546  if test "x$OPTFILE" = xNONE -a "x$MITGCM Line 610  if test "x$OPTFILE" = xNONE -a "x$MITGCM
610      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
611  fi  fi
612    
613    if test "x$ADM" = xt -a "x$COMMAND" = x ; then
614        COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1"
615    fi
616    
617    if test "x$COMMAND" = x ; then
618        COMMAND="make output.txt"
619    fi
620    
621  echo "OK"  echo "OK"
622    
623  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
# Line 568  done Line 640  done
640  mkdir $DRESULTS  mkdir $DRESULTS
641  RETVAL=$?  RETVAL=$?
642  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
643      echo "Error: can't create results directory \"./$DRESULTS\""      echo "ERROR: Can't create results directory \"./$DRESULTS\""
644      exit 1      exit 1
645  fi  fi
646  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
647  date > $SUMMARY  echo -n "Start time:  " >> $SUMMARY
648  cat << EOF >> $SUMMARY  start_date=`date`
649                  T           S           U           V  echo $start_date > $SUMMARY
 G D M    c        m  s        m  s        m  s        m  s  
 E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .  
 N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d  
 2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .  
   
 EOF  
   
 NDIR=0  
650    
651  of_path=  of_path=
652  if test "x$OPTFILE" != xNONE ; then  if test "x$OPTFILE" != xNONE ; then
# Line 596  if test "x$OPTFILE" != xNONE ; then Line 660  if test "x$OPTFILE" != xNONE ; then
660          fi          fi
661          file=${OPTFILE##*/}          file=${OPTFILE##*/}
662          OPTFILE=$of_path/$file          OPTFILE=$of_path/$file
663            cp $OPTFILE $DRESULTS
664            echo >> $SUMMARY
665            echo "  OPTFILE=$OPTFILE" >> $SUMMARY
666      else      else
667          echo          echo | tee $SUMMARY
668          echo "WARNING: can't read OPTFILE=\"$OPTFILE\" but will try to use it..."          echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
669            exit 1
670      fi      fi
671    else
672        echo >> $SUMMARY
673        echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
674        echo "   so the genmake default will be used." >> $SUMMARY
675  fi  fi
676  echo  echo
 echo "OPTFILE=$OPTFILE" >> $SUMMARY  
677  echo >> $SUMMARY  echo >> $SUMMARY
678    if test "x$ADM" = x ; then
679        cat << EOF | tee -a $SUMMARY
680                    T           S           U           V
681    G D M    c        m  s        m  s        m  s        m  s
682    E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .
683    N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d
684    2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .
685    
686    EOF
687    else
688        echo "ADJOINT=true" >> $SUMMARY
689        echo >> $SUMMARY
690        cat << EOF | tee -a $SUMMARY
691    G D M    C  G
692    E p a R  o  r
693    N n k u  s  a
694    2 d e n  t  d
695    
696    EOF
697    fi
698    
699  #  ...and each test directory...  #  ...and each test directory...
700  for dir in $TESTDIRS ; do  for dir in $TESTDIRS ; do
# Line 621  for dir in $TESTDIRS ; do Line 712  for dir in $TESTDIRS ; do
712    
713      #  Verify that the testdir exists and contains previous      #  Verify that the testdir exists and contains previous
714      #  results in the correct location--or skip this directory!      #  results in the correct location--or skip this directory!
715      if test ! -r $dir"/results/output.txt" ; then      fout=
716          echo "can't read \"$dir/results/output.txt\" -- skipping $dir"      if test "x$ADM" = x ; then
717            fout=$dir"/results/output.txt"
718        else
719            fout=$dir"/results_ad/output.txt_adm"
720        fi
721        if test ! -r $fout ; then
722            echo "can't read \"$fout\" -- skipping $dir"
723          continue          continue
724      fi      fi
725    
# Line 633  for dir in $TESTDIRS ; do Line 730  for dir in $TESTDIRS ; do
730      unset genmake makedepend make run      unset genmake makedepend make run
731      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
732    
733      if [ -r $dir/build ]; then      builddir="input"
734          seperatebuilddir=1      rundir="input"
735          builddir=build      use_seperate_build=0
736          rundir=build      if test -d $dir/build -a -r $dir/build ; then
737          ( cd $dir/build; ln -sf ../input/* . )          builddir="build"
738      else          rundir="build"
739          seperatebuilddir=0          use_seperate_build=1
740          builddir=input          linkdata $use_seperate_build $dir/$rundir
         rundir=input  
741      fi      fi
742            
743      CODE_DIR=$dir/code      if test "x$ADM" = x ; then
744            CODE_DIR=$dir/code
745        else
746            CODE_DIR=$dir/code_ad
747        fi
748      BUILD_DIR=$dir/$builddir      BUILD_DIR=$dir/$builddir
749      MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"      MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
750      NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"      NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
# Line 685  for dir in $TESTDIRS ; do Line 785  for dir in $TESTDIRS ; do
785      fi      fi
786            
787      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir for each OPTFILE/tdir combination
788      CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR      rel_CDIR=$DRESULTS"/"$dir
789      mkdir $CDIR      mkdir $rel_CDIR
790      CDIR=`pwd`"/$CDIR"      CDIR=`pwd`"/$rel_CDIR"
791            
792      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
793          makeclean $dir/$builddir          makeclean $dir/$builddir
# Line 696  for dir in $TESTDIRS ; do Line 796  for dir in $TESTDIRS ; do
796              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
797              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
798              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
799              && linkdata $seperatebuilddir $dir/$rundir \              && linkdata $use_seperate_build $dir/$rundir \
800              && runmodel $dir/$builddir && run=Y \              && runmodel $dir/$rundir && run=Y \
801              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir`
802      fi      fi
803            
804      echo      echo
805      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      if test "x$ADM" = x ; then
806          ${run:-N} $results          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
807        else
808            fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
809            fres=$fres"$results   $dir"
810        fi
811      echo      echo
812      formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \      echo "$fres" >> $SUMMARY
813          ${run:-N} $results >> $SUMMARY      echo "fresults='$fres'" > $CDIR"/summary.txt"
     echo "fresults='" > $CDIR"/summary.txt"  
     formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \  
         ${run:-N} $results >> $CDIR"/summary.txt"  
     echo "'" >> $CDIR"/summary.txt"  
814      echo "MACH='$MACH'" >> $CDIR"/summary.txt"      echo "MACH='$MACH'" >> $CDIR"/summary.txt"
815      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"      echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
816      echo "DATE='$DATE'" >> $CDIR"/summary.txt"      echo "DATE='$DATE'" >> $CDIR"/summary.txt"
817      echo "tdir='$dir'" >> $CDIR"/summary.txt"      echo "tdir='$dir'" >> $CDIR"/summary.txt"
818            
819      (      echo "-------------------------------------------------------------------------------"
         cd $DRESULTS  
         tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1  
         gzip $NDIR".tar"  
     )  
820            
821      if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then  done
822          echo "No mail sent"  
823      else  echo -n "Start time:  " >> $SUMMARY
824          $MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES  echo $start_date >> $SUMMARY
825    echo -n "End time:    " >> $SUMMARY
826    date >> $SUMMARY
827    
828    #  If addresses were supplied and mpack built successfully, then try
829    #  to send email using mpack.
830    if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
831        echo "No results email was sent."
832    else
833        if test "x$HAVE_MPACK" = xt ; then
834            tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
835                && gzip $DRESULTS".tar" \
836                && $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES
837          RETVAL=$?          RETVAL=$?
838          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
839              echo "Warning: \"$MPACK\" failed -- please contact <edhill@mitgcm.org>"              echo
840                echo "Warning: The tar, gzip, & mpack step failed.  Please send email"
841                echo "  to <MITgcm-support@mitgcm.org> for help.  You may copy the "
842                echo "  summary of results from the directory \"$DRESULTS\"."
843                echo
844          else          else
845              rm -f $DRESULTS"/"$NDIR".tar*"              echo
846                echo "An email containing results was sent to the following addresses:"
847                echo "  \"$ADDRESSES\""
848                echo
849          fi          fi
850            test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
851            test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
852      fi      fi
853    fi
854    
855      echo "-------------------------------------------------------------------------------"  # rm -f tmp_cmpnum.f a.out
856        rm -f tmp_cmpnum.c tmp_cmpnum
     NDIR=$(( $NDIR + 1 ))  
       
 done  
   
 rm tmp_cmpnum.f a.out  
857    
858  cat $SUMMARY  if test "x$CLEANUP" != xt ; then
859        cat $SUMMARY
860        if test -e tr.out ; then
861            mv tr.out tr.out.old
862        fi
863        cat $SUMMARY > tr.out
864    fi
865    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.22