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

Diff of /MITgcm/verification/testreport

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

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

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

  ViewVC Help
Powered by ViewVC 1.1.22