/[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.24 by edhill, Sun Nov 30 01:28:51 2003 UTC revision 1.66 by edhill, Fri Feb 4 16:41:42 2005 UTC
# 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\")"      echo "                             (DEF=\"-ieee\")"
17      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-optfile=|-of=)STRING   list of optfiles to use"
18      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-a|-addr) STRING        list of email recipients"
19      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"edhill@mitgcm.org\")"
# Line 27  usage() Line 27  usage()
27      echo "                             (DEF=\"make output.txt\")"      echo "                             (DEF=\"make output.txt\")"
28      echo "  (-m|-make) STRING        command to use for \"make\""      echo "  (-m|-make) STRING        command to use for \"make\""
29      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
30        echo "  (-ptracers|-ptr) STRING  specify which ptracers to test"
31        echo "                             (DEF=\"1 2 3 4 5\")"
32        echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"
33      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\""
34      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
35      echo "  (-nogenmake|-ng)         skip the genmake stage"      echo "  (-nogenmake|-ng)         skip the genmake stage"
36      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-noclean|-nc)           skip the \"make clean\" stage"
37      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
38        echo "  (-deldir|-dd)            on success, delete the output directory"
39      echo      echo
40      echo "and where STRING follows a whitespace-delimited format"      echo "and where STRING can be a whitespace-delimited list"
41      echo "such as:"      echo "such as:"
42        echo
43      echo "  -t 'exp0 exp2 exp3' "      echo "  -t 'exp0 exp2 exp3' "
44      echo "  -addr='abc@123.com testing@home.org'"      echo "  -addr='abc@123.com testing@home.org'"
45      echo      echo
46        echo "provided that the expression is properly quoted within the current"
47        echo "shell (note the use of single quotes to protect white space)."
48        echo
49      exit 1      exit 1
50  }  }
51    
52  #  build the mpack utility  #  build the mpack utility
53  build_mpack()  build_mpack()
54  {  {
55      echo -n "building the mpack utility...  "      printf "building the mpack utility...  "
56      if test ! -x "$MPACKDIR/mpack" ; then      if test ! -x "$MPACKDIR/mpack" ; then
57          if test ! -d $MPACKDIR ; then          if test ! -d $MPACKDIR ; then
58              echo              echo
# Line 54  build_mpack() Line 62  build_mpack()
62              echo              echo
63              HAVE_MPACK=f              HAVE_MPACK=f
64          fi          fi
65          echo -n "building mpack...  "          printf "building mpack...  "
66          ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1          if test "x$CC" = x ; then
67                export CC=cc
68            fi
69            ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1
70          RETVAL=$?          RETVAL=$?
71          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
72              echo              echo
# Line 63  build_mpack() Line 74  build_mpack()
74              echo              echo
75              HAVE_MPACK=f              HAVE_MPACK=f
76          else          else
77                rm -f tr_build_mpack.out
78              HAVE_MPACK=t              HAVE_MPACK=t
79          fi          fi
80      else      else
# Line 73  build_mpack() Line 85  build_mpack()
85    
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 95  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/.*=//' | cat -n > 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 165  testoutput_ad() Line 177  testoutput_ad()
177      rm -f t[01][56].txt t[56].txt      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 directory subdir      # testoutput directory subdir extension
208      #      #
209      #  test output in "directory"      #  test output in "directory"
210      if test "x$ADM" = x ; then      if test "x$ADM" = x ; then
211          if [ $debug -gt 0 ]; then          if [ $debug -gt 0 ]; then
212              echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2              echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2
213          fi          fi
214          testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$?          testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$?
215          if [ $debug -gt 0 ]; then          if [ $debug -gt 0 ]; then
216              echo testoutput: cg2dres=$cg2dres 1>&2              echo testoutput: cg2dres=$cg2dres 1>&2
217          fi          fi
218          testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?          testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2 $3; tmin=$?
219          testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?          testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2 $3; tmax=$?
220          testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?          testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2 $3; tmean=$?
221          testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$?          testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2 $3; tsd=$?
222          testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$?          testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2 $3; smin=$?
223          testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$?          testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2 $3; smax=$?
224          testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$?          testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2 $3; smean=$?
225          testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$?          testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2 $3; ssd=$?
226          testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$?          testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2 $3; umin=$?
227          testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$?          testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2 $3; umax=$?
228          testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$?          testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2 $3; umean=$?
229          testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$?          testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2 $3; usd=$?
230          testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$?          testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2 $3; vmin=$?
231          testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$?          testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$?
232          testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$?          testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$?
233          testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$?          testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$?
234          dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \  
235              $umin $umax $umean $usd $vmin $vmax $vmean $vsd          #  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            allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd"
257            allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd"
258            allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd"
259            allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd"
260            allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd"
261            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      else
267          testoutput_ad $1 $2 "precision_grdchk_result"          testoutput_ad $1 $2 "precision_grdchk_result"
268      fi      fi
# Line 207  genmakemodel() Line 274  genmakemodel()
274      if test "x$NOGENMAKE" = xt ; then      if test "x$NOGENMAKE" = xt ; then
275          echo "genmake skipped!"          echo "genmake skipped!"
276      else      else
277          GENMAKE2="$BASH ../../../tools/genmake2"          if test "x$BASH" = x ; then
278                GENMAKE2="../../../tools/genmake2"
279            else
280                GENMAKE2="$BASH ../../../tools/genmake2 -bash $BASH"
281            fi
282          (          (
283              cd $1;              cd $1;
284              command="$GENMAKE2  -ds -m $MAKE"              command="$GENMAKE2  -ds -m $MAKE"
# Line 223  genmakemodel() Line 294  genmakemodel()
294              if test "x$IEEE" != x ; then              if test "x$IEEE" != x ; then
295                  command="$command -ieee"                  command="$command -ieee"
296              fi              fi
297                if test "x$MPI" = xt ; then
298                    command="$command -mpi"
299                fi
300              printf 'genmake ... ' 1>&2              printf 'genmake ... ' 1>&2
301              $command > make.log 2>&1              $command > make.log 2>&1
302              RETVAL=$?              RETVAL=$?
303              cp Makefile $CDIR              #  Reduce the size of the testing emails!
304                head -100 Makefile > $CDIR/Makefile_head
305              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
306                  tail make.log                  tail make.log
307                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed" 1>&2
# Line 298  makemodel() Line 373  makemodel()
373          if test -r Makefile ; then          if test -r Makefile ; then
374              printf 'make ... ' 1>&2              printf 'make ... ' 1>&2
375              if test "x$ADM" = x ; then              if test "x$ADM" = x ; then
376                  $MAKE >> make.log 2>&1                  if test "x$JOBS" = x ; then
377                        $MAKE >> make.log 2>&1
378                    else
379                        $MAKE -j $JOBS >> make.log 2>&1
380                    fi
381              else              else
382                  $MAKE adall >> make.log 2>&1                  $MAKE adall >> make.log 2>&1
383              fi              fi
# Line 315  makemodel() Line 394  makemodel()
394      )      )
395  }  }
396    
397    symlink_mpifiles()
398    {
399        # Put special links so that MPI specific files are used
400        # This MUST be invoked between makeclean and makelinks because
401        # the Makefile will link to non-mpi files by default
402    
403        dir=$1
404        code_dir=$2
405        BUILD_DIR=$dir/$3
406        CODE_DIR=$dir/$code_dir
407        
408        # These are files that should replace their counter-part when using -mpi
409        MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")`
410    
411        #  Is this an MPI run?
412        if test "x$MPI" = xt ; then
413            # YES: We symbolically link these files to the build
414            # dir so long as there is no real file in place
415            for ii in $MPI_FILES ; do
416                i=`echo $ii | sed 's:^\./::'`
417                name=`echo $i | sed 's:_mpi::' `
418                cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
419                RETVAL=$?
420                if test "x$RETVAL" != x0 ; then
421                    if ! test -f $BUILD_DIR/$i ; then
422                        #echo Linking $name to $i
423                        (cd $BUILD_DIR; ln -sf ../$code_dir/$i $name)
424                    fi
425                fi
426            done
427        else
428            # NO: We undo any _mpi symbolically linked files
429            for ii in $MPI_FILES ; do
430                i=`echo $ii | sed 's:^\./::'`
431                name=`echo $i | sed 's:_mpi::' `
432                if test -L $BUILD_DIR/$name ; then
433                    cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1
434                    RETVAL=$?
435                    if test "x$RETVAL" = x0 ; then
436                        #echo Un-linking $name from $linktarg
437                        rm -f $BUILD_DIR/$name
438                    fi
439                fi
440            done
441        fi
442        
443    }
444    
445  linkdata()  linkdata()
446  {  {
447      # linkdata flag      # linkdata flag
# Line 326  linkdata() Line 453  linkdata()
453              if test "x$ADM" = x ; then              if test "x$ADM" = x ; then
454                  files=`( cd ../input ; ls -1 | grep -v CVS )`                  files=`( cd ../input ; ls -1 | grep -v CVS )`
455                  for i in $files ; do                  for i in $files ; do
456                      if test ! -d "../input/"$i ; then                      if test ! -d "../input/"$i -a ! -f $i ; then
457                          ln -sf "../input/"$i $i                          ln -sf "../input/"$i $i
458                      fi                      fi
459                  done                  done
# Line 358  runmodel() Line 485  runmodel()
485          cd $1          cd $1
486          printf 'runmodel ... ' 1>&2          printf 'runmodel ... ' 1>&2
487          # make output.txt          # make output.txt
488          $COMMAND >> run.log 2>&1          echo
489            rm -f run.log
490            # echo "COMMAND='$COMMAND'"
491            # echo "pwd='"`pwd`"'"
492            ( eval $COMMAND ) > run.log 2>&1
493          RETVAL=$?          RETVAL=$?
494          if test "x$RETVAL" = x0 ; then          if test "x$RETVAL" = x0 ; then
495                tail run.log
496              echo successful 1>&2              echo successful 1>&2
497              if test "x$ADM" = x ; then              # === Reduce the size of the testing emails!
498                  cp output.txt $CDIR"/output.txt"              # if test "x$ADM" = x ; then
499              else              #   cp output.txt $CDIR"/output.txt"
500                  cp output.txt_adm $CDIR"/output.txt_adm"              # else
501              fi              #   cp output.txt_adm $CDIR"/output.txt_adm"
502                # fi
503                if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
504              return 0              return 0
505          else          else
506              tail run.log              tail run.log
507              echo failed 1>&2              echo failed 1>&2
508              cp run.log $CDIR"/run.log"              cp run.log $CDIR"/run.log"
509                if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
510              return 1              return 1
511          fi          fi
512      )      )
# Line 381  createcodelet() Line 516  createcodelet()
516  {  {
517      # create codelet for comparing model output      # create codelet for comparing model output
518    
519      echo -n "creating the comparison code...  "      printf "creating the comparison code...  "
520      cat > tmp_cmpnum.c <<EOF      cat > tmp_cmpnum.c <<EOF
521  #include <stdio.h>  #include <stdio.h>
522  #include <math.h>  #include <math.h>
523  int main( int argc, char** argv )  {  int main( int argc, char** argv )  {
524    int linnum,best;    int linnum,best,lncnt;
525    double a,b,diff;    double a,b,abave,relerr;
526    best = -16;    best = -22;
527    while( 1 )  {    lncnt = 0;
528      while( 1 & (lncnt+=1) < 999 )  {
529      scanf("%d", &linnum);      scanf("%d", &linnum);
530      if (linnum == -1)  break;      if (linnum == -1)  break;
531      scanf("%lf", &a);  scanf("%lf", &b);      scanf("%lf", &a);  scanf("%lf", &b);
532      diff = 0.5*(fabs(a)+fabs(b));      abave = 0.5*(fabs(a)+fabs(b));
533      if (diff > 1.e-12) {      if (abave > 0.0) {
534        diff=fabs(a-b)/diff;        relerr=fabs(a-b)/abave;
535        if (diff > 0.0) {        if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); }
536          linnum = (int)log10(diff);        else { linnum = -16 ; }
537          best = (best > linnum) ? best : linnum;        best = (best > linnum) ? best : linnum;
       }  
       else {  
         if (best == -16 && diff != 0)  best = -22;  
       }  
538      }      }
539    }    }
540      if (lncnt == 999) best=-29;
541    printf("%d\n", -best);    printf("%d\n", -best);
542    return 0;    return 0;
543  }  }
544  EOF  EOF
545      cc -o tmp_cmpnum tmp_cmpnum.c -lm      $CC -o tmp_cmpnum tmp_cmpnum.c -lm
546    
547      if [ -x ./tmp_cmpnum ]; then      if [ -x ./tmp_cmpnum ]; then
548          echo "OK"          echo "OK"
549          return 0          return 0
550      else      else
551          echo          echo
552          echo "ERROR: failed to compile comparison code"          echo "ERROR: failed to compile comparison code -- please specify"
553            echo "  a C compiler using the CC environment variable."
554          exit 1          exit 1
555      fi      fi
556  }  }
# Line 485  clean=0 Line 619  clean=0
619  expts=''  expts=''
620  # ieee=1  # ieee=1
621    
622  IEEE=  IEEE=true
623  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
624      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
625  fi  fi
# Line 505  MPACKDIR="../tools/mpack-1.6" Line 639  MPACKDIR="../tools/mpack-1.6"
639  HAVE_MPACK=  HAVE_MPACK=
640  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
641  COMMAND=  COMMAND=
642  MAKE=make  if test "x$MAKE" = x ; then
643        MAKE=make
644    fi
645    if test "x$CC" = x ; then
646        CC=cc
647    fi
648    JOBS=
649  MPI=f  MPI=f
650    DELDIR=
651    
652  ADM=  ADM=
653    
654  echo -n "parsing options...  "  # Additional monitor types
655    PTRACERS_NUM="1 2 3 4 5"
656    
657    printf "parsing options...  "
658    
659  ac_prev=  ac_prev=
660  for ac_option ; do  for ac_option ; do
# Line 559  for ac_option ; do Line 703  for ac_option ; do
703          -make=* | --make=*)          -make=* | --make=*)
704              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
705    
706            -ptracers | --ptracers | -ptr | --ptr)
707                ac_prev=PTRACERS_NUM ;;
708            -ptracers=* | --ptracers=* | -ptr=* | --ptr=*)
709                PTRACERS_NUM=$ac_optarg ;;
710    
711            -j) ac_prev=JOBS ;;
712            -j=*) JOBS=$ac_optarg ;;
713    
714          -clean | --clean)          -clean | --clean)
715              CLEANUP=t ;;              CLEANUP=t ;;
716    
# Line 582  for ac_option ; do Line 734  for ac_option ; do
734          -debug) debug=1 ;;          -debug) debug=1 ;;
735          -quiet) verbose=0 ;;          -quiet) verbose=0 ;;
736    
737            -deldir | -dd) DELDIR=t ;;
738    
739          -*)          -*)
740              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
741              usage              usage
# Line 615  if test "x$ADM" = xt -a "x$COMMAND" = x Line 769  if test "x$ADM" = xt -a "x$COMMAND" = x
769  fi  fi
770    
771  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
772      COMMAND="make output.txt"      COMMAND="$MAKE output.txt"
773  fi  fi
774    
775  echo "OK"  echo "OK"
# Line 624  echo "OK" Line 778  echo "OK"
778  createcodelet  createcodelet
779    
780  #  build the mpack utility  #  build the mpack utility
781  build_mpack  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
782        echo "skipping mpack build"
783    else
784        build_mpack
785    fi
786    
787  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
788  MACH=`hostname`  MACH=`hostname`
789  UNAMEA=`uname -a`  UNAMEA=`uname -a`
790  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
791  BASE=$MACH"_"$DATE"_"  BASE="tr_"$MACH"_"$DATE"_"
792  DNUM=0  DNUM=0
793  DRESULTS="$BASE$DNUM"  DRESULTS="$BASE$DNUM"
794  while test -e $DRESULTS ; do  while test -e $DRESULTS ; do
# Line 644  if test "x$RETVAL" != x0 ; then Line 802  if test "x$RETVAL" != x0 ; then
802      exit 1      exit 1
803  fi  fi
804  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
805  echo -n "Start time:  " >> $SUMMARY  printf "Start time:  " >> $SUMMARY
806  start_date=`date`  start_date=`date`
807  echo $start_date > $SUMMARY  echo $start_date > $SUMMARY
808    
# Line 676  fi Line 834  fi
834  echo  echo
835  echo >> $SUMMARY  echo >> $SUMMARY
836  if test "x$ADM" = x ; then  if test "x$ADM" = x ; then
837      cat << EOF | tee -a $SUMMARY      line_0="            ----T-----  ----S-----  ----U-----  ----V-----"
838                  T           S           U           V      line_1="G D M    c        m  s        m  s        m  s        m  s"
839  G D M    c        m  s        m  s        m  s        m  s      line_2="E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  ."
840  E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .      line_3="N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d"
841  N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d      line_4="2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  ."
842  2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .      for ii in $PTRACERS_NUM ; do
843            #  tst=`eval 'echo $HAVE_PTR0'$ii`
844  EOF          #  if test "x$tst" = xt ; then
845            line_0="$line_0  --PTR 0"$ii"--"
846            line_1="$line_1        m  s"
847            line_2="$line_2  m  m  e  ."
848            line_3="$line_3  i  a  a  d"
849            line_4="$line_4  n  x  n  ."
850            #  fi
851        done
852        echo "$line_0" | tee -a $SUMMARY
853        echo "$line_1" | tee -a $SUMMARY
854        echo "$line_2" | tee -a $SUMMARY
855        echo "$line_3" | tee -a $SUMMARY
856        echo "$line_4" | tee -a $SUMMARY
857        echo " "       | tee -a $SUMMARY
858  else  else
859      echo "ADJOINT=true" >> $SUMMARY      echo "ADJOINT=true" >> $SUMMARY
860      echo >> $SUMMARY      echo >> $SUMMARY
# Line 707  for dir in $TESTDIRS ; do Line 878  for dir in $TESTDIRS ; do
878          if test -r $dir/input/Makefile ; then          if test -r $dir/input/Makefile ; then
879              ( cd $dir/input ; make CLEAN )              ( cd $dir/input ; make CLEAN )
880          fi          fi
881            (
882                cd $dir
883                rm -rf tr_run.*
884            )
885          continue          continue
886      fi      fi
887    
# Line 722  for dir in $TESTDIRS ; do Line 897  for dir in $TESTDIRS ; do
897          echo "can't read \"$fout\" -- skipping $dir"          echo "can't read \"$fout\" -- skipping $dir"
898          continue          continue
899      fi      fi
900        if test "x$ADM" = x ; then
901            check_for_add_mon_output  $fout
902        fi
903    
904      echo "-------------------------------------------------------------------------------"      # Check for additional types of monitor output
     echo  
     echo "Experiment:  $dir"  
     echo  
     unset genmake makedepend make run  
     results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'  
905    
906      builddir="input"      builddir="input"
907      rundir="input"      rundir="input"
# Line 740  for dir in $TESTDIRS ; do Line 913  for dir in $TESTDIRS ; do
913          linkdata $use_seperate_build $dir/$rundir          linkdata $use_seperate_build $dir/$rundir
914      fi      fi
915            
916        #  Check whether there are "extra runs" for this testdir
917        extra_runs=
918        if test "x$ADM" = x -a "x$use_seperate_build" = x1 ; then
919            ex_run_dirs=`( cd $dir ; echo input.* )`
920            echo "ex_run_dirs='$ex_run_dirs'"
921            for exd in $ex_run_dirs ; do
922                name=`echo $exd | sed -e 's/input.//g'`
923                outf="$dir/results/output.txt.$name"
924                if test -f $outf -a -r $outf ; then
925                    extra_runs="$extra_runs $name"
926                fi
927            done
928        fi
929    
930      if test "x$ADM" = x ; then      if test "x$ADM" = x ; then
931            code_dir=code
932          CODE_DIR=$dir/code          CODE_DIR=$dir/code
933      else      else
934            code_dir=code_ad
935          CODE_DIR=$dir/code_ad          CODE_DIR=$dir/code_ad
936      fi      fi
937      BUILD_DIR=$dir/$builddir      BUILD_DIR=$dir/$builddir
     MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"  
     NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"  
938    
939      #  Is this an MPI run?      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then
940      if test "x$MPI" = xt ; then          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
         FILES=$MPI_FILES  
         endings="_mpi"  
     else  
         FILES=$NOMPI_FILES  
         endings="_nompi"  
     fi  
       
     #  Check to see that we have the files  
     have_files=t  
     for i in $FILES ; do  
         if test ! -r $CODE_DIR/$i ; then  
             echo "Warning: can't read file $CODE_DIR/$i"  
             have_files=f  
         fi  
     done  
     if test "x$have_files" != xt -a "x$MPI" = xt ; then  
         echo "Skipping $dir due to lack of input files (see above warning)"  
941          continue          continue
942      fi      fi
943        
944      #  If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR      echo "-------------------------------------------------------------------------------"
945      if test "x$have_files" = xt ; then      echo
946          for i in $FILES ; do      echo "Experiment:  $dir"
947              sstr="s|$endings||"      echo
948              name=`echo $i | sed -e $sstr `      unset genmake makedepend make run
949              cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
950              RETVAL=$?  
             if test "x$RETVAL" != x0 ; then  
                 cp $CODE_DIR/$i $BUILD_DIR/$name  
             fi  
         done  
     fi  
       
951      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir for each OPTFILE/tdir combination
952      rel_CDIR=$DRESULTS"/"$dir      rel_CDIR=$DRESULTS"/"$dir
953      mkdir $rel_CDIR      mkdir $rel_CDIR
# Line 794  for dir in $TESTDIRS ; do Line 958  for dir in $TESTDIRS ; do
958      else      else
959          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
960              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
961                && symlink_mpifiles $dir $code_dir $builddir \
962              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
963              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
964              && linkdata $use_seperate_build $dir/$rundir \              && linkdata $use_seperate_build $dir/$rundir \
# Line 804  for dir in $TESTDIRS ; do Line 969  for dir in $TESTDIRS ; do
969      echo      echo
970      if test "x$ADM" = x ; then      if test "x$ADM" = x ; then
971          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
972            echo
973            echo "$fres" >> $SUMMARY
974            echo "fresults='$fres'" > $CDIR"/summary.txt"
975            echo "MACH='$MACH'" >> $CDIR"/summary.txt"
976            echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
977            echo "DATE='$DATE'" >> $CDIR"/summary.txt"
978            echo "tdir='$dir'" >> $CDIR"/summary.txt"
979    
980            for ex in $extra_runs ; do
981                test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"
982                for ldir in input.$ex input ; do
983                    (
984                        cd "$dir/$ldir" > /dev/null 2>&1
985                        ls -1 2>/dev/null \
986                            | sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g'
987                    ) > tr_exrun_links
988                    (
989                        cd "$dir/tr_run.$ex"
990                        cat ../../tr_exrun_links | while read i ; do
991                            if test ! "x$i" = x ; then
992                                test ! -r $i  &&  ln -s "../"$ldir"/"$i $i
993                            fi
994                        done
995                    )
996                    test -e tr_exrun_links  &&  rm -f tr_exrun_links
997                done
998                ldir=build
999                (
1000                    cd "$dir/$ldir" > /dev/null 2>&1
1001                    ls -1 Makefile *.[fFhco] mitgcmuv  2>/dev/null \
1002                        | sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g'
1003                ) > tr_exrun_links
1004                (
1005                    cd "$dir/tr_run.$ex"
1006                        cat ../../tr_exrun_links | while read i ; do
1007                            if test ! "x$i" = x ; then
1008                                test ! -r $i  &&  ln -s "../"$ldir"/"$i $i
1009                            fi
1010                        done
1011                )
1012                test -e tr_exrun_links  &&  rm -f tr_exrun_links
1013                runmodel $dir/tr_run.$ex && run=Y \
1014                    && results=`testoutput $dir tr_run.$ex "."$ex`
1015                fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1016                fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1017                fres="$fres.$ex"
1018                echo
1019                echo "$fres" >> $SUMMARY
1020                echo "fresults='$fres'" > $CDIR"/summary.txt"
1021                echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1022                echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1023                echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1024                echo "tdir='$dir'" >> $CDIR"/summary.txt"
1025            done
1026      else      else
1027          fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`          fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1028          fres=$fres"$results   $dir"          fres=$fres"$results   $dir"
1029            echo
1030            echo "$fres" >> $SUMMARY
1031            echo "fresults='$fres'" > $CDIR"/summary.txt"
1032            echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1033            echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1034            echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1035            echo "tdir='$dir'" >> $CDIR"/summary.txt"
1036      fi      fi
     echo  
     echo "$fres" >> $SUMMARY  
     echo "fresults='$fres'" > $CDIR"/summary.txt"  
     echo "MACH='$MACH'" >> $CDIR"/summary.txt"  
     echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
     echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
     echo "tdir='$dir'" >> $CDIR"/summary.txt"  
1037            
1038      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
1039            
1040  done  done
1041    
1042  echo -n "Start time:  " >> $SUMMARY  printf "Start time:  " >> $SUMMARY
1043  echo $start_date >> $SUMMARY  echo $start_date >> $SUMMARY
1044  echo -n "End time:    " >> $SUMMARY  printf "End time:    " >> $SUMMARY
1045  date >> $SUMMARY  date >> $SUMMARY
1046    
1047  #  If addresses were supplied and mpack built successfully, then try  #  If addresses were supplied and mpack built successfully, then try
# Line 833  else Line 1052  else
1052      if test "x$HAVE_MPACK" = xt ; then      if test "x$HAVE_MPACK" = xt ; then
1053          tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \          tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
1054              && gzip $DRESULTS".tar" \              && gzip $DRESULTS".tar" \
1055              && $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES              && $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES
1056          RETVAL=$?          RETVAL=$?
1057          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
1058              echo              echo
# Line 856  fi Line 1075  fi
1075  rm -f tmp_cmpnum.c tmp_cmpnum  rm -f tmp_cmpnum.c tmp_cmpnum
1076    
1077  if test "x$CLEANUP" != xt ; then  if test "x$CLEANUP" != xt ; then
1078      cat $SUMMARY      cat $SUMMARY | sed 's/ -- -- -- --//g'
1079      if test -e tr.out ; then      if test -e tr_out.txt ; then
1080          mv tr.out tr.out.old          mv tr_out.txt tr_out.txt.old
1081      fi      fi
1082      cat $SUMMARY > tr.out      cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt
1083    fi
1084    
1085    if test "x$DELDIR" = xt ; then
1086        rm -rf $DRESULTS
1087  fi  fi
1088    

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

  ViewVC Help
Powered by ViewVC 1.1.22