/[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.127 by jmc, Thu Jun 4 23:40:53 2009 UTC revision 1.164 by jmc, Mon Jun 27 18:45:16 2011 UTC
# Line 12  usage() Line 12  usage()
12      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
13      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
14      echo "  (-mth)                   run multi-threaded (using eedata.mth)"      echo "  (-mth)                   run multi-threaded (using eedata.mth)"
15      echo "  (-mpi)                   compile and run using MPI"      echo "  (-mpi)                   use MPI to compile and run on 2 processors"
16      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"      echo "  (-MPI)  NUMBER           use MPI to compile and run on max NUMBER procs"
17      echo "                             (DEF=\"-ieee\")"      echo "  (-mfile|-mf) STRING      MPI: file with list of possible machines to run on"
18        echo "  (-fast)                  use optfile default for compiler flags (no '-ieee')"
19        echo "                            DEF=off => use IEEE numerics option (if available)"
20        echo "  (-devel)                 use optfile developement flags (if available)"
21      echo "  (-gsl)                   compile with \"-gsl\" flag"      echo "  (-gsl)                   compile with \"-gsl\" flag"
22      echo "  (-of=|-optfile=)STRING   list of optfiles to use"      echo "  (-use_r4|-ur4)           if allowed, use real*4 type for '_RS' variable"
23      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-optfile|-of) STRING    list of optfiles to use"
24        echo "  (-addr|-a) STRING        list of email recipients"
25      echo "                             (DEF=\"\" no email is sent)"      echo "                             (DEF=\"\" no email is sent)"
26      echo "  (-mpd|-mpackdir) DIR     location of the mpack utility"      echo "  (-mpackdir|-mpd) DIR     location of the mpack utility"
27      echo "                             (DEF=\"../tools/mpack-1.6\")"      echo "                             (DEF=\"../tools/mpack-1.6\")"
28      echo "  (-t|-tdir) STRING        list of group and/or exp. dirs to test"      echo "  (-tdir|-t) STRING        list of group and/or exp. dirs to test"
29      echo "                             (recognized groups: basic, tutorials)"      echo "                             (recognized groups: basic, tutorials)"
30      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
31      echo "  (-skd|-skipdir) STRING   list of exp. dirs to skip"      echo "                             (if list= 'start_from THIS_EXP' then"
32        echo "                              test THIS_EXP + all the following)"
33        echo "  (-skipdir|-skd) STRING   list of exp. dirs to skip"
34      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
35      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"      echo "  (-bash|-b) STRING        preferred location of a \"bash\" or"
36      echo "                             Bourne-compatible \"sh\" shell"      echo "                             Bourne-compatible \"sh\" shell"
37      echo "                             (DEF=\"\" for \"bash\")"      echo "                             (DEF=\"\" for \"bash\")"
38      echo "  (-adm|-ad)               perform an adjoint run"      echo "  (-adm|-ad)               perform an adjoint run"
39      echo "  (-oad)                   perform an OpenAD adjoint run"      echo "  (-oad)                   perform an OpenAD adjoint run"
40      echo "  (-command) STRING        command to run"      echo "  (-command|-c) STRING     command to run"
41      echo "                             (DEF=\"make output.txt\")"      echo "  (-makedepend|-md) STRING command to use for \"makedepend\""
42      echo "  (-m|-make) STRING        command to use for \"make\""      echo "  (-make|-m) STRING        command to use for \"make\""
43      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
44      echo "  (-odir) STRING           used to build output directory name"      echo "  (-odir) STRING           used to build output directory name"
45      echo "                             (DEF=\"hostname\")"      echo "                             (DEF=\"hostname\")"
46      echo "  (-ptr|-ptracers) STRING  specify which ptracers to test"  #   echo "  (-ptracers|-ptr) STRING  specify which ptracers to test"
47      echo "                             (DEF=\"1 2 3 4 5\")"  #   echo "                             (DEF=\"1 2 3 4 5\")"
48      echo "  (-match) NUMBER          Matching Criteria (number of digits)"      echo "  (-match) NUMBER          Matching Criteria (number of digits)"
49      echo "                             (DEF=\"12\")"      echo "                             (DEF=\"$MATCH_CRIT\")"
50      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"
51      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\" & clean run-dir"
52        echo "  (-norun|-nr)             skip the \"runmodel\" stage (stop after make)"
53        echo "  (-runonly|-ro)           *ONLY* run stage (=\"-quick\" without make)"
54      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
55      echo "  (-nogenmake|-ng)         skip the genmake stage"      echo "  (-nogenmake|-ng)         skip the genmake stage"
56      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-noclean|-nc)           skip the \"make clean\" stage"
57      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
58        echo "  (-postclean|-pc)         after each exp. test, clean build-dir & run-dir"
59        echo "  (-deloutp|-do)           delete output files after successful run"
60      echo "  (-deldir|-dd)            on success, delete the output directory"      echo "  (-deldir|-dd)            on success, delete the output directory"
61      echo "  (-ts)                    provide timing information per timestep"      echo "  (-ts)                    provide timing information per timestep"
62      echo "  (-papis)                 provide MFlop/s per timestep using PAPI"      echo "  (-papis)                 provide MFlop/s per timestep using PAPI"
# Line 104  testoutput_var() Line 114  testoutput_var()
114  {  {
115      # testoutput_var dir s1 label subdir reference_output      # testoutput_var dir s1 label subdir reference_output
116      #      #
117      #  compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE      #  compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE
118      #     with same output from reference file $dir/results/$reference_output      #     with same output from reference file $dir/results/$reference_output
119      #  using search strings s1 and text label      #  using search strings s1 and text label
120    
# Line 176  testoutput_var() Line 186  testoutput_var()
186          fi          fi
187      fi      fi
188      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
189        
190      return $digits_of_similarity      return $digits_of_similarity
191  }  }
192    
# Line 229  testoutput_run() Line 239  testoutput_run()
239            listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`            listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`
240          fi          fi
241          if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(M)='$listVar'" 1>&2 ; fi          if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(M)='$listVar'" 1>&2 ; fi
242          echo "listVar='$listVar'" > $CDIR"/summary.txt"          echo "listVar='$listVar'" >> $locDIR"/summary.txt"
243            #---
244          allargs=""          allargs=""
245          for xx in $listVar          for xx in $listVar
246          do          do
# Line 264  testoutput_run() Line 275  testoutput_run()
275             testoutput_var $1 "trcstat_ptracer0"$ii"_mean" "p0"$ii"_mean" $2 $3; yy=$? ;;             testoutput_var $1 "trcstat_ptracer0"$ii"_mean" "p0"$ii"_mean" $2 $3; yy=$? ;;
276          'pt1sd'|'pt2sd'|'pt3sd'|'pt4sd'|'pt5sd') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`          'pt1sd'|'pt2sd'|'pt3sd'|'pt4sd'|'pt5sd') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`
277             testoutput_var $1 "trcstat_ptracer0"$ii"_sd"   "p0"$ii"_StDv"  $2 $3; yy=$? ;;             testoutput_var $1 "trcstat_ptracer0"$ii"_sd"   "p0"$ii"_StDv"  $2 $3; yy=$? ;;
278           'Qntmn') testoutput_var $1 "extforcing_qnet_min" "Qnet minimum"  $2 $3; yy=$? ;;           'Qntmn') testoutput_var $1 "forcing_qnet_min" "Qnet minimum"  $2 $3; yy=$? ;;
279           'Qntmx') testoutput_var $1 "extforcing_qnet_max" "Qnet maximum"  $2 $3; yy=$? ;;           'Qntmx') testoutput_var $1 "forcing_qnet_max" "Qnet maximum"  $2 $3; yy=$? ;;
280           'Qntav') testoutput_var $1 "extforcing_qnet_mean" "Qnet mean"    $2 $3; yy=$? ;;           'Qntav') testoutput_var $1 "forcing_qnet_mean" "Qnet mean"       $2 $3; yy=$? ;;
281           'Qntsd') testoutput_var $1 "extforcing_qnet_sd"  "Qnet Std.Dev"  $2 $3; yy=$? ;;           'Qntsd') testoutput_var $1 "forcing_qnet_sd"  "Qnet Std.Dev"  $2 $3; yy=$? ;;
282           'aSImn') testoutput_var $1 "seaice_area_min"   "SIce Area min"   $2 $3; yy=$? ;;           'aSImn') testoutput_var $1 "seaice_area_min"   "SIce Area min"   $2 $3; yy=$? ;;
283           'aSImx') testoutput_var $1 "seaice_area_max"   "SIce Area max"   $2 $3; yy=$? ;;           'aSImx') testoutput_var $1 "seaice_area_max"   "SIce Area max"   $2 $3; yy=$? ;;
284           'aSIav') testoutput_var $1 "seaice_area_mean"  "SIce Area mean"  $2 $3; yy=$? ;;           'aSIav') testoutput_var $1 "seaice_area_mean"  "SIce Area mean"  $2 $3; yy=$? ;;
# Line 291  testoutput_run() Line 302  testoutput_run()
302          done          done
303    
304          nbVar=`echo $listVar | awk '{print NF}'`          nbVar=`echo $listVar | awk '{print NF}'`
305          if [ $nbVar -lt $LEN_CHECK_LIST ] ; then          if [ $nbVar -lt $LEN_CHECK_LIST ] ; then
306          #-- fill line (up to standard length) with dot:          #-- fill line (up to standard length) with dot:
307            adNul=`expr $LEN_CHECK_LIST - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'`            adNul=`expr $LEN_CHECK_LIST - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'`
308            echo $allargs $adNul            echo $allargs $adNul
309          else          else
310            echo $allargs            echo $allargs
311          fi          fi
312  # <-- same processing for adjoint & forward test  # <-- same processing for adjoint & forward test
313  }  }
314    
# Line 315  genmakemodel() Line 326  genmakemodel()
326          (          (
327              cd $1;              cd $1;
328              command="$GENMAKE2  -ds -m $MAKE"              command="$GENMAKE2  -ds -m $MAKE"
329                if test "x$MKDEPEND" != x ; then
330                    command="$command -makedepend=$MKDEPEND"
331                fi
332              if test "x$ADM" = xt ; then              if test "x$ADM" = xt ; then
333                  command="$command --mods=../code_ad"                  command="$command --mods=../code_ad"
334              elif test "x$OADM" = xt ; then              elif test "x$OADM" = xt ; then
# Line 325  genmakemodel() Line 339  genmakemodel()
339              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
340                  command="$command -optfile=$OPTFILE"                  command="$command -optfile=$OPTFILE"
341              fi              fi
342              if test "x$IEEE" != x ; then              if test $OptLev = 1 ; then
343                  command="$command -ieee"                  command="$command -ieee"
344                fi
345                if test $OptLev = 0 ; then
346                    command="$command -devel"
347              fi              fi
348              if test "x$GSL" = xt ; then              if test "x$GSL" = xt ; then
349                  command="$command -gsl"                  command="$command -gsl"
350              fi              fi
351              if test "x$MPI" = xt ; then              if test "x$MPI" != x0 ; then
352                  command="$command -mpi"                  command="$command -mpi"
353              fi              fi
354              if test "x$MULTI_THREAD" = xt ; then              if test "x$MULTI_THREAD" = xt ; then
355              #- run multi-threaded using OpenMP:              #- run multi-threaded using OpenMP:
356                  command="$command -omp"                  command="$command -omp"
357              fi              fi
358                if test "x$USE_R4" = xt ; then
359                    command="$command -use_r4"
360                fi
361              if test "x$TS" = xt ; then              if test "x$TS" = xt ; then
362                  command="$command -ts"                  command="$command -ts"
363              fi              fi
364              if test "x$PAPIS" = xt ; then              if test "x$PAPIS" = xt ; then
365                  command="$command -papis"                  command="$command -papis"
366              else              else
367              if test "x$PCLS" = xt ; then              if test "x$PCLS" = xt ; then
368                  command="$command -pcls"                  command="$command -pcls"
369              fi              fi
370              fi              fi
371              printf 'genmake ... ' 1>&2              printf 'genmake ... '
372              # $command > make.log 2>&1              eval $command > genmake.tr_log 2>&1
             eval $command > make.log 2>&1  
373              RETVAL=$?              RETVAL=$?
374              #  Reduce the size of the testing emails!              #  Reduce the size of the testing emails!
375              head -100 Makefile > $CDIR/Makefile_head              head -100 Makefile > $CDIR/Makefile_head
376              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
377                  tail make.log                  tail genmake.tr_log
378                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed"
379                  cp genmake_* make.log $CDIR                  cp genmake.log genmake_* genmake.tr_log $CDIR
380                  return 1                  return 1
381              else              else
382                  echo "successful" 1>&2                  echo "successful"
383              fi              fi
384          )          )
385      fi      fi
# Line 369  genmakemodel() Line 388  genmakemodel()
388  makeclean()  makeclean()
389  {  {
390      # makeclean directory      # makeclean directory
391        if test "x$NODEPEND" = xf ; then rm -f $1/make.tr_log ; fi
392      if test "x$NOCLEAN" = xt ; then      if test "x$NOCLEAN" = xt ; then
393          echo "make Clean skipped!"          echo "make Clean skipped!"
394      else      else
# Line 376  makeclean() Line 396  makeclean()
396              cd $1;              cd $1;
397              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi
398              if test -r Makefile ; then              if test -r Makefile ; then
399                  printf 'clean build-dir: make Clean ... ' 2>&1                  printf 'clean build-dir: make Clean ... '
400                  $MAKE Clean >> make.log 2>&1                  $MAKE Clean >> make.tr_log 2>&1
401                  RETVAL=$?                  RETVAL=$?
402                  if test "x$RETVAL" != x0 ; then                  if test "x$RETVAL" != x0 ; then
403                      tail make.log                      tail make.tr_log
404                      echo "makeclean: \"make Clean\" failed" 1>&2                      echo "makeclean: \"make Clean\" failed"
405                      cp make.log $CDIR"/make.log"                      cp make.tr_log genmake.log genmake.tr_log $CDIR
406                      return 1                      return 1
407                  fi                  fi
408                  echo successful 1>&2                  echo successful
409              else              else
410                  echo ''                  echo ''
411              fi              fi
# Line 402  run_clean() Line 422  run_clean()
422      else      else
423          (          (
424              cd $1;              cd $1;
425              printf 'clean run-dir ... ' 2>&1              printf 'clean run-dir ... '
426              # part of what is done after "make clean" when doing "make CLEAN"              # part of what is done after "make clean" when doing "make CLEAN"
427              find . -name "*.meta" -exec rm {} \;              find . -name "*.meta" -exec rm {} \;
428              find . -name "*.data" -exec rm {} \;              find . -name "*.data" -exec rm {} \;
429              find . -name "fort.*" -exec rm {} \;              find . -name "fort.*" -exec rm {} \;
430              find . -type l -exec rm {} \;              find . -type l -exec rm {} \;
431              rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime              #- should remove executable only if sym-link (alredy done above)
432                rm -f $RUNLOG *.txt STD* *diagnostics.log datetime
433              rm -rf mnc_test_*              rm -rf mnc_test_*
434              rm -f *_MIT_CE_000.opt0000 costfunction*0000              rm -f *_MIT_CE_000.opt0000 costfunction*0000
435              echo successful 1>&2              echo successful
436              exit 0              exit 0
437          )          )
438      fi      fi
# Line 425  makedependmodel() Line 446  makedependmodel()
446      else      else
447          (          (
448              cd $1;              cd $1;
449              printf 'make depend ... ' 1>&2              printf 'make depend ... '
450              $MAKE depend >> make.log 2>&1              $MAKE depend >> make.tr_log 2>&1
451              RETVAL=$?              RETVAL=$?
452              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
453                  tail make.log                  tail make.tr_log
454                  echo "makedependmodel: make depend failed" 1>&2                  echo "makedependmodel: make depend failed"
455                  cp make.log $CDIR"/make.log"                  cp make.tr_log genmake.log genmake.tr_log $CDIR
456                  return 1                  return 1
457              else              else
458                  echo successful 1>&2                  echo successful
459              fi              fi
460          )          )
461      fi      fi
# Line 444  makemodel() Line 465  makemodel()
465  {  {
466      # makemodel directory      # makemodel directory
467      (      (
468        mk_fail=0
469        if test "x$NOMAKE" = xt ; then
470            cd $1;
471            if test -x $EXECUTABLE ; then
472                echo "make skipped!"
473            else
474                echo "no executable!"
475                mk_fail=3
476            fi
477        else
478          cd $1;          cd $1;
479          if test -r Makefile ; then          if test -r Makefile ; then
480              printf 'make ... ' 1>&2              printf 'make ... '
481              if test "x$ADM" = xt ; then              if test "x$ADM" = xt ; then
482                  $MAKE adall >> make.log 2>&1                  $MAKE adall >> make.tr_log 2>&1
483              elif test "x$OADM" = xt ; then              elif test "x$OADM" = xt ; then
484                  $MAKE adAll >> make.log 2>&1                  $MAKE adAll >> make.tr_log 2>&1
485              else              else
486                  if test "x$JOBS" = x ; then                  if test "x$JOBS" = x ; then
487                      $MAKE >> make.log 2>&1                      $MAKE >> make.tr_log 2>&1
488                  else                  else
489                      $MAKE -j $JOBS >> make.log 2>&1                      $MAKE -j $JOBS >> make.tr_log 2>&1
490                  fi                  fi
491              fi              fi
492              RETVAL=$?              RETVAL=$?
493              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
494                  tail make.log                  tail make.tr_log
495                  echo failed 1>&2                  echo failed
496                  cp make.log $CDIR"/make.log"                  cp genmake.log genmake.tr_log $CDIR
497                  return 1                  tail -$NBLINES_MKLOG make.tr_log > $CDIR"/make.tr_log_tail"
498                    rm -f $EXECUTABLE
499                    mk_fail=1
500              else              else
501                  echo successful 1>&2                  echo successful
502              fi              fi
503            else
504                echo "no Makefile !"
505                mk_fail=2
506          fi          fi
507        fi
508        if test "x$ADM" = xt -a -f taf_ad.log ; then
509                head -1 taf_ad.log >> $CDIR"/summary.txt"
510                nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log`
511                nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log`
512                echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \
513                                    >> $CDIR"/summary.txt"
514        fi
515        if test $mk_fail != 0 ; then return $mk_fail ; fi
516      )      )
517  }  }
518    
519    mk_mpi_size()
520    {
521        # mk_mpi_size input_file output_file proc_Nb prefer_to_split_X
522        #
523        # make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file)
524        #     for an MPI build with no more than proc_Nb processors ;
525        # return the effective number of processors.
526    
527        inp=$1
528        out=$2
529        np=$3
530        dirX=$4
531        tmp=TTT.$$
532    
533        px=`grep "^     & *nPx *=" $inp | sed "s/^     & *nPx *= *//" | sed 's/, *$//'`
534        py=`grep "^     & *nPy *=" $inp | sed "s/^     & *nPy *= *//" | sed 's/, *$//'`
535        sx=`grep "^     & *nSx *=" $inp | sed "s/^     & *nSx *= *//" | sed 's/, *$//'`
536        sy=`grep "^     & *nSy *=" $inp | sed "s/^     & *nSy *= *//" | sed 's/, *$//'`
537    
538        #- find the largest divisor of input_file proc Nb, but not larger than $np
539        pp=0
540        i=1
541        while [ $i -le $px ] ; do
542          if [ `expr $px % $i` -eq 0 ] ; then
543            j=1
544            while [ $j -le $py ] ; do
545              if [ `expr $py % $j` -eq 0 ] ; then
546                ij=`expr $i \* $j`
547                if [ $ij -gt $pp ] ; then
548                    flag=1
549                elif [ $ij -eq $pp ] ; then
550                    flag=$dirX
551                else
552                    flag=0
553                fi
554                if test $flag = 1 ; then
555                  if [ $ij -le $np ] ; then
556                    ix=$i ; jy=$j ; pp=$ij
557                    #echo "  ix,jy= $ix,$jy"
558                  fi
559                fi
560              fi
561              j=`expr $j + 1`
562            done
563          fi
564          i=`expr $i + 1`
565        done
566    
567        #- create new SIZE.h type file:
568        sx=`expr $sx \* $px / $ix`
569        sy=`expr $sy \* $py / $jy`
570        if [ $verbose -gt 1 ]; then
571            echo " px,py,np= $px,$py,$np : New MPI size: px,py= $ix,$jy : sx,sy= $sx,$sy"
572        fi
573        sed "/^     \& *nPx *=/s/[0-9]*,/$ix,/" $inp > $tmp
574        sed "/^     \& *nPy *=/s/[0-9]*,/$jy,/" $tmp > $out
575        sed "/^     \& *nSx *=/s/[0-9]*,/$sx,/" $out > $tmp
576        sed "/^     \& *nSy *=/s/[0-9]*,/$sy,/" $tmp > $out
577        rm -f $tmp
578        return $pp
579    }
580    
581  symlink_mpifiles()  symlink_mpifiles()
582  {  {
583      # Put special links so that MPI specific files are used      # Put special links so that MPI specific files are used
# Line 479  symlink_mpifiles() Line 586  symlink_mpifiles()
586    
587      dir=$1      dir=$1
588      code_dir=$2      code_dir=$2
589      BUILD_DIR=$dir/$3      build_dir=$dir/$3
590      CODE_DIR=$dir/$code_dir  
       
591      # These are files that should replace their counter-part when using -mpi      # These are files that should replace their counter-part when using -mpi
592      MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)`      MPI_FILES=`(cd $dir/$code_dir; find . -name "*_mpi" -print)`
593    
594      #  Is this an MPI run?      for ii in $MPI_FILES ; do
595      if test "x$MPI" = xt ; then          i=`echo $ii | sed 's:^\./::'`
596          # YES: We symbolically link these files to the build          name=`echo $i | sed 's:_mpi::'`
597          # dir so long as there is no real file in place          file="../$code_dir/$i"
598          for ii in $MPI_FILES ; do          if test $name = 'SIZE.h' ; then file="SIZE.h.mpi" ; fi
599              i=`echo $ii | sed 's:^\./::'`  
600              name=`echo $i | sed 's:_mpi::' `          #  Is this an MPI run?
601              cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1          if test "x$MPI" = x0 ; then
602              RETVAL=$?              # NO: We undo any _mpi symbolically linked files
603              if test "x$RETVAL" != x0 ; then              if test -L $build_dir/$name ; then
604                  if ! test -f $BUILD_DIR/$i ; then                  ( cd $build_dir ; cmp $name $file > /dev/null 2>&1 )
                     #echo Linking $name to $i  
                     (cd $BUILD_DIR; ln -sf ../$code_dir/$i $name)  
                 fi  
             fi  
         done  
     else  
         # NO: We undo any _mpi symbolically linked files  
         for ii in $MPI_FILES ; do  
             i=`echo $ii | sed 's:^\./::'`  
             name=`echo $i | sed 's:_mpi::' `  
             if test -L $BUILD_DIR/$name ; then  
                 cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1  
605                  RETVAL=$?                  RETVAL=$?
606                  if test "x$RETVAL" = x0 ; then                  if test "x$RETVAL" = x0 ; then
607                      #echo Un-linking $name from $linktarg                      if [ $verbose -gt 1 ]; then
608                      rm -f $BUILD_DIR/$name                          echo "  Un-linking $name from ../$code_dir" ; fi
609                        rm -f $build_dir/$name
610                  fi                  fi
611              fi              fi
612          done          else
613      fi              # YES: We symbolically link these files to the build
614                    # dir so long as there is no real file in place
615                ( cd $build_dir ; cmp $name $file > /dev/null 2>&1 )
616                RETVAL=$?
617                if [ $verbose -gt 1 ]; then echo "  cmp $name $file returns: $RETVAL" ; fi
618                if test "x$RETVAL" != x0 ; then
619                    if test -h $build_dir/$name ; then rm -f $build_dir/$name ; fi
620                    if test ! -r $build_dir/$name ; then
621                        if [ $verbose -gt 1 ]; then echo "  Linking $name to $file" ; fi
622                        (cd $build_dir; ln -sf $file $name)
623                    fi
624                fi
625            fi
626        done
627  }  }
628    
629  linkdata()  linkdata()
# Line 527  linkdata() Line 634  linkdata()
634      if test -d $1 ; then      if test -d $1 ; then
635          (          (
636              cd $1 ; shift              cd $1 ; shift
637                echo 'linkdata from dirs:' $*
638              inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')`              inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')`
639              for xx in $inpMPI ; do              for xx in $inpMPI ; do
640                if test -r "../"$1"/"$xx ; then                if test -r "../"$1"/"$xx ; then
641                  # found 1 _mpi sfx file in 1rst input dir and it is readable                  # found 1 _mpi sfx file in 1rst input dir and it is readable
642                  yy=`echo $xx | sed 's:\.mpi$::'`                  yy=`echo $xx | sed 's:\.mpi$::'`
643                  if test "x$MPI" = "xt" ; then                  if test "x$MPI" = "x0" ; then
644                  # mpi test: remove symbolic link & link _mpi sfx file                      # not mpi test: remove symbolic link
645                      if test -h $yy ; then rm -f $yy ; fi                      if test -h $yy ; then rm -f $yy ; fi
                     if test ! -r $yy ; then  
                         ln -sf "../"$1"/"$xx $yy ;  
                         printf "$xx " 1>&2  
                     fi  
646                  else                  else
647                  # not mpi test: remove symbolic link                      # mpi test: remove symbolic link & link .mpi sfx file
648                      if test -h $yy ; then rm -f $yy ; fi                      if test -h $yy ; then rm -f $yy ; fi
649                        if test ! -r $yy ; then
650                            ln -sf "../"$1"/"$xx $yy ;
651                            printf " $xx" 1>&2
652                        fi
653                  fi                  fi
654                fi                fi
655              done              done
# Line 550  linkdata() Line 658  linkdata()
658                  if test "x$MULTI_THREAD" = "xt" ; then                  if test "x$MULTI_THREAD" = "xt" ; then
659                  # multi-threaded test: remove symbolic link & link eedata.mth                  # multi-threaded test: remove symbolic link & link eedata.mth
660                      if test -h eedata ; then rm -f eedata ; fi                      if test -h eedata ; then rm -f eedata ; fi
661                      if test ! -r eedata ; then                      if test ! -r eedata ; then
662                          ln -sf "../"$1"/eedata.mth" eedata ;                          ln -sf "../"$1"/eedata.mth" eedata ;
663                          printf 'eedata.mth ' 1>&2                          printf ' eedata.mth' 1>&2
664                      fi                      fi
665                  else                  else
666                  # not multi-threaded test: remove eedata symbolic link                  # not multi-threaded test: remove eedata symbolic link
# Line 562  linkdata() Line 670  linkdata()
670              prevDir='NONE'              prevDir='NONE'
671              for ldir in $* ; do              for ldir in $* ; do
672                  if test -d "../"$ldir -a $ldir != $prevDir ; then                  if test -d "../"$ldir -a $ldir != $prevDir ; then
673                      printf 'ldir='${ldir} 1>&2                      printf " ldir=${ldir}:" 1>&2
674                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`
675                      for i in $files ; do                      for i in $files ; do
676                          if test ! -d "../"$ldir/$i ; then                          if test ! -d "../"$ldir/$i ; then
# Line 572  linkdata() Line 680  linkdata()
680                              fi                              fi
681                          fi                          fi
682                      done                      done
683                        printf ' ;' 1>&2
684                      if test -x "../"$ldir"/"prepare_run ; then                      if test -x "../"$ldir"/"prepare_run ; then
685                          "../"$ldir"/"prepare_run                          "../"$ldir"/"prepare_run 1>&2
686                        else
687                            echo '' 1>&2
688                      fi                      fi
                     printf ' ; ' 1>&2  
689                  fi                  fi
690                  prevDir=$ldir                  prevDir=$ldir
691              done              done
# Line 587  runmodel() Line 697  runmodel()
697  {  {
698      # runmodel directory      # runmodel directory
699      #      #
700      #  runs "$COMMAND in "directory"      #  runs $COMMAND in "directory"
701      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
702      (      (
703          cd $1          cd $1
704          printf 'runmodel in %s ...' $1 1>&2          printf 'runmodel in %s ... ' $1
705          # make output.txt          if test "x$MPI" != x0 ; then
706          echo              #- adjust the MPI run command with the right number of Procs
707          if test -L $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then              #echo '' ; echo "  COMMAND='$COMMAND'"
708              diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1              COMMAND=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"`
709              outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; fi              if test "x$MPI_MFILE" != x ; then
710                  COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"`
711                fi
712                #echo "  COMMAND='$COMMAND'"
713            fi
714            if test -L $EXECUTABLE ; then
715              if test -x "../"$builddir"/"$EXECUTABLE ; then
716                cmp $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1
717                outD=$? ; if test "x$outD" != x0 ; then rm -f $EXECUTABLE ; fi
718              else rm -f $EXECUTABLE
719              fi
720          fi          fi
721          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
722              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_tmp              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_tmp
723              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
724          fi          fi
725          if test ! -x $EXECUTABLE ; then          if test ! -x $EXECUTABLE ; then
726                  rm -f $RUNLOG ; touch $RUNLOG              rm -f $RUNLOG ; touch $RUNLOG
727                  if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi              if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
728                  echo " no executable:" $EXECUTABLE >> $RUNLOG              echo " no executable:" $EXECUTABLE >> $RUNLOG
729                  RETVAL=8              RETVAL=8
730                  ENDVAL=-1              ENDVAL=-1
731          else          else
732              if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then            if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then
733                # output do not exist or is older than executable:              # output do not exist or is older than executable:
734                  rm -f $RUNLOG ; touch $RUNLOG              rm -f $OUTPUTFILE $RUNLOG ; touch $RUNLOG
735                  if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi              if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
736                  ( eval $COMMAND ) >> $RUNLOG 2>&1              ( eval $COMMAND ) >> $RUNLOG 2>&1
737                  RETVAL=$?              RETVAL=$?
738              else              ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
739                  RETVAL=0              if [ $POSTCLEAN -eq 1 -a $ENDVAL -gt 0 ] ; then
740                  if test -f $RUNLOG ; then                  find . -name "*.meta" -exec rm {} \;
741                      if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi                  find . -name "*.data" -exec rm {} \;
742                      echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1                  rm -rf mnc_test_*
                 else  
                     touch $RUNLOG  
                     if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi  
                     echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1  
                     echo " no previous $RUNLOG: assume NORMAL END" >> $RUNLOG 2>&1  
                 fi  
743              fi              fi
744              ENDVAL=`cat $RUNLOG | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`            else
745                RETVAL=0
746                ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
747                touch $RUNLOG
748                if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
749                echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1
750              fi
751          fi          fi
752          rm -f run.log_tmp          rm -f run.log_tmp
753          #if test "x$RETVAL" = x0 ; then          #- in all cases where OutputFile exists, report SIZE (and AD time)
754            if test -f $OUTPUTFILE ; then
755              grep '(PID\.TID 0000\.0001)      n.. =' $OUTPUTFILE \
756                    | sed 's/(PID.TID 0000.0001)     //' >> $CDIR"/summary.txt"
757              if test "x$ADM" = xt ; then
758                grep -A3 'Seconds in section "ALL' $OUTPUTFILE >> $CDIR"/summary.txt"
759              fi
760            fi
761            if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
762          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
763              tail $RUNLOG              echo successful
764              echo successful 1>&2              printf '=> output from running in %s :\n' $1 1>&2
765              # === Reduce the size of the testing emails!              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
766              #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE              return 0
767              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi          elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then
768                #-- for some weird cases (run is finihed but with error code)
769                echo 'finished with error (run:' $RETVAL ' end:' $ENDVAL ')'
770                printf '=> output from running in %s :\n' $1 1>&2
771                tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
772              return 0              return 0
773          else          else
774              tail $RUNLOG              echo 'failed (run:' $RETVAL ' end:' $ENDVAL ')'
775              echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2              printf '=> output from running in %s :\n' $1 1>&2
776                tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
777              cp $RUNLOG $CDIR"/"$RUNLOG              cp $RUNLOG $CDIR"/"$RUNLOG
             if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi  
778              return 1              return 1
779          fi          fi
780      )      )
# Line 692  EOF Line 824  EOF
824          return 0          return 0
825      else      else
826          echo          echo
827          echo "ERROR: failed to compile comparison code -- please specify"          echo "ERROR: failed to compile comparison code -- please specify"
828          echo "  a C compiler using the CC environment variable."          echo "  a C compiler using the CC environment variable."
829          exit 1          exit 1
830      fi      fi
# Line 711  formatresults() Line 843  formatresults()
843      printf '%3s' $listPrt      printf '%3s' $listPrt
844  #   line below does not work on hp-ux_ia64 : do those substitutions later on  #   line below does not work on hp-ux_ia64 : do those substitutions later on
845  #   printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</'  #   printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</'
846        
847      if [ $xx = '..' ]; then      if [ $xx = '..' ]; then
848          printf ' N/O '          printf ' N/O '
849      elif [ $xx = '--' ]; then      elif [ $xx = '--' ]; then
# Line 727  formatresults() Line 859  formatresults()
859      fi      fi
860      printf '  %s' $nm      printf '  %s' $nm
861      printf '\n'      printf '\n'
862        
863  }  }
864    
865  scandirs()  scandirs()
# Line 744  scandirs() Line 876  scandirs()
876    
877  check_eedata()  check_eedata()
878  {  {
879      # check_eedata size.h eedata      # check_eedata eedata size.h
880      if [ $# -eq 2 ] ; then      if [ $# -eq 2 ] ; then
881        if test -f $1 -a -f $2 ; then       if test -f $1 -a -f $2 ; then
882        sx=`grep "^     & *nSx *=" $1 | sed "s/^     & *nSx *=//" | sed 's/, *$//'`        nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
883        nx=`grep "^ *nTx *=" $2 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`        sx=`grep "^     & *nSx *=" $2 | sed "s/^     & *nSx *=//" | sed 's/, *$//'`
884        if test "x$nx" = x ; then        if test "x$nx" = x ; then
885          rx=10          rx=10
886        else        else
887          rx=`expr $sx % $nx`          rx=`expr $sx % $nx`
888        fi        fi
889        sy=`grep "^     & *nSy *=" $1 | sed "s/^     & *nSy *=//" | sed 's/, *$//'`        ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
890        ny=`grep "^ *nTy *=" $2 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`        sy=`grep "^     & *nSy *=" $2 | sed "s/^     & *nSy *=//" | sed 's/, *$//'`
891        if test "x$ny" = x ; then        if test "x$ny" = x ; then
892          ry=20          ry=20
893        else        else
894          ry=`expr $sy % $ny`          ry=`expr $sy % $ny`
895        fi        fi
896        echo `expr $rx + $ry`        echo `expr $rx + $ry`
897      else       else
898        echo '-1'        echo '-1'
899        fi       fi
900        elif [ $# -eq 1 ] ; then
901         if test -f $1 ; then
902          nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
903          if test "x$nx" = x ; then nx=1 ; fi
904          ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
905          if test "x$ny" = x ; then ny=1 ; fi
906         #echo $nx $ny
907          echo $nx
908         else
909          echo '-1'
910         fi
911      else      else
912        echo '-2'        echo '-2'
913      fi      fi
# Line 777  check_eedata() Line 920  check_eedata()
920  #  Default properties  #  Default properties
921  debug=0  debug=0
922  verbose=1  verbose=1
923  clean=0  NBLINES_MKLOG=16000
924    
925  IEEE=true  IEEE=true
926  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
927      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
928  fi  fi
929    OptLev=1
930  GSL=f  GSL=f
931    
932  CLEANUP=f  CLEANUP=f
933    NORUN=f
934  QUICK=f  QUICK=f
935    NOMAKE=f
936  NOGENMAKE=f  NOGENMAKE=f
937  NOCLEAN=f  NOCLEAN=f
938  NODEPEND=f  NODEPEND=f
939  POSTCLEAN=f  POSTCLEAN=0
940    
941  BASH=  BASH=
942  OPTFILE=NONE  OPTFILE=NONE
# Line 801  MPACKDIR="../tools/mpack-1.6" Line 947  MPACKDIR="../tools/mpack-1.6"
947  HAVE_MPACK=  HAVE_MPACK=
948  MPACK=  MPACK=
949  COMMAND=  COMMAND=
950    MKDEPEND=
951  if test "x$MAKE" = x ; then  if test "x$MAKE" = x ; then
952      MAKE=make      MAKE=make
953  fi  fi
# Line 808  if test "x$CC" = x ; then Line 955  if test "x$CC" = x ; then
955      CC=cc      CC=cc
956  fi  fi
957  JOBS=  JOBS=
958  MPI=f  MPI=0
959    MPI_MFILE=
960  MULTI_THREAD=f  MULTI_THREAD=f
961  OUTDIR=  OUTDIR=
962  DELDIR=  DELDIR=
963    USE_R4=
964    
965  ADM=  ADM=
966  OADM=  OADM=
# Line 819  OADM= Line 968  OADM=
968  # list of pTracers to check for monitor output  # list of pTracers to check for monitor output
969  PTRACERS_NUM="1 2 3 4 5"  PTRACERS_NUM="1 2 3 4 5"
970    
971  MATCH_CRIT=13  MATCH_CRIT=10
972    
973  printf "parsing options...  "  printf "parsing options...  "
974    
# Line 834  for ac_option ; do Line 983  for ac_option ; do
983      fi      fi
984    
985      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
986        
987      case $ac_option in      case $ac_option in
988                    
989          -help | --help | -h | --h)          -help | --help | -h | --h) usage ;;
990              usage ;;  
991                    -optfile | --optfile | -of | --of) ac_prev=OPTFILE ;;
992          -optfile | --optfile | -of | --of)          -optfile=* | --optfile=* | -of=* | --of=*) OPTFILE=$ac_optarg ;;
993              ac_prev=OPTFILE ;;  
994          -optfile=* | --optfile=* | -of=* | --of=*)          -addr | --addr | -a | --a) ac_prev=ADDRESSES ;;
995              OPTFILE=$ac_optarg ;;          -addr=* | --addr=* | -a=* | --a=*) ADDRESSES=$ac_optarg ;;
996                    -mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;;
997          -addr | --addr | -a | --a)          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;;
998              ac_prev=ADDRESSES ;;  
999          -addr=* | --addr=*)          -tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;;
1000              ADDRESSES=$ac_optarg ;;          -tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;;
1001          -mpackdir | --mpackdir | -mpd | --mpd)          -skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;;
1002              ac_prev=MPACKDIR ;;          -skipdir=* | --skipdir=* | -skd=* | --skd=*) SKIPDIRS=$ac_optarg ;;
1003          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*)  
1004              MPACKDIR=$ac_optarg ;;          -bash | --bash | -b | --b) ac_prev=BASH ;;
1005            -bash=* | --bash=* | -b=* | --b=*) BASH=$ac_optarg ;;
1006          -tdir | --tdir | -t | --t)  
1007              ac_prev=TESTDIRS ;;          -command | --command | -c | --c) ac_prev=COMMAND ;;
1008          -tdir=* | --tdir=*)          -command=* | --command=* | -c=* | --c=*) COMMAND=$ac_optarg ;;
1009              TESTDIRS=$ac_optarg ;;  
1010            -makedepend | --makedepend | -md | --md) ac_prev=MKDEPEND ;;
1011          -skipdir | --skipdir | -skd | --skd)          -makedepend=* | --makedepend=* | -md=* | --md=*) MKDEPEND=$ac_optarg ;;
1012              ac_prev=SKIPDIRS ;;  
1013          -skipdir=* | --skipdir=*)          -make | --make | -m | --m) ac_prev=MAKE ;;
1014              SKIPDIRS=$ac_optarg ;;          -make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;;
1015    
1016          -bash | --bash | -b | --b)          -odir | --odir) ac_prev=OUTDIR ;;
1017              ac_prev=BASH ;;          -odir=* | --odir=*) OUTDIR=$ac_optarg ;;
1018          -bash=* | --bash=*)  
1019              BASH=$ac_optarg ;;          -ptracers | --ptracers | -ptr | --ptr) ac_prev=PTRACERS_NUM ;;
1020            -ptracers=* | --ptracers=* | -ptr=* | --ptr=*) PTRACERS_NUM=$ac_optarg ;;
         -command | --command | -c | --c)  
             ac_prev=COMMAND ;;  
         -command=* | --command=*)  
             COMMAND=$ac_optarg ;;  
   
         -make | --make | -m | --m)  
             ac_prev=MAKE ;;  
         -make=* | --make=*)  
             MAKE=$ac_optarg ;;  
   
         -odir | --odir)  
             ac_prev=OUTDIR ;;  
         -odir=* | --odir=*)  
             OUTDIR=$ac_optarg ;;  
   
         -ptracers | --ptracers | -ptr | --ptr)  
             ac_prev=PTRACERS_NUM ;;  
         -ptracers=* | --ptracers=* | -ptr=* | --ptr=*)  
             PTRACERS_NUM=$ac_optarg ;;  
1021    
1022          -match | --match ) ac_prev=MATCH_CRIT ;;          -match | --match ) ac_prev=MATCH_CRIT ;;
1023          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;
1024    
1025          -j) ac_prev=JOBS ;;          -j | --j) ac_prev=JOBS ;;
1026          -j=*) JOBS=$ac_optarg ;;          -j=* | --j=*) JOBS=$ac_optarg ;;
1027    
1028          -clean | --clean)          -clean | --clean) CLEANUP=t ; DELDIR=t ;;
             CLEANUP=t ; DELDIR=t ;;  
1029    
1030          -quick | --quick | -q | --q)          -norun | --norun | -nr | --nr) NORUN=t ;;
1031              QUICK=t ;;          -runonly | --runonly | -ro | --ro) QUICK=t ; NOMAKE=t ;;
1032          -nogenmake | --nogenmake | -ng | --ng)          -quick | --quick | -q | --q) QUICK=t ;;
1033              NOGENMAKE=t ;;          -nogenmake | --nogenmake | -ng | --ng) NOGENMAKE=t ;;
1034          -noclean | --noclean | -nc | --nc)          -noclean | --noclean | -nc | --nc) NOCLEAN=t ;;
1035              NOCLEAN=t ;;          -nodepend | --nodepend | -nd | --nd) NODEPEND=t ;;
1036          -nodepend | --nodepend | -nd | --nd)  
1037              NODEPEND=t ;;          -postclean | --postclean | -pc | --pc) POSTCLEAN=2 ;;
1038            -deloutp | --deloutp | -do | --do) POSTCLEAN=1 ;;
1039    
1040            -mpi | --mpi) MPI=2 ;;
1041            -MPI | --MPI) ac_prev=MPI ;;
1042            -MPI=* | --MPI=*) MPI=$ac_optarg ;;
1043    
1044          -postclean | --postclean | -pc | --pc)          -mfile | --mfile | -mf | --mf) ac_prev=MPI_MFILE ;;
1045              POSTCLEAN=t ;;          -mfile=* | --mfile=* | -mf=* | --mf=*) MPI_MFILE=$ac_optarg ;;
   
         -mpi) MPI=t ;;  
1046    
1047          -mth) MULTI_THREAD=t ;;          -mth) MULTI_THREAD=t ;;
1048    
1049          -adm | -ad) ADM=t ;;          -adm | -ad) ADM=t ;;
   
1050          -oad) OADM=t; NODEPEND=t ;;          -oad) OADM=t; NODEPEND=t ;;
1051    
1052          -ieee) IEEE=true ;;          -ieee)   echo "Warning: ignore option '-ieee' (already the default)"
1053          -noieee) IEEE= ;;                   printf " ... " ;;
1054          -gsl) GSL=t ;;          -noieee) echo "Warning: will use option '-fast' instead of '-noieee' (obsolete)"
1055                     printf " ... " ; OptLev=`expr $OptLev \* 2` ;;
1056            -fast)  OptLev=`expr $OptLev \* 2` ;;
1057            -devel) OptLev=0 ;;
1058            -gsl) GSL=t ;;
1059    
1060          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
1061          -debug) debug=1 ;;          -debug) debug=1 ;;
# Line 928  for ac_option ; do Line 1063  for ac_option ; do
1063    
1064          -deldir | -dd) DELDIR=t ;;          -deldir | -dd) DELDIR=t ;;
1065    
1066          -ts) TS=t;;          -use_r4|-ur4) USE_R4=t ;;
1067    
1068            -ts) TS=t;;
1069          -papis) PAPIS=t;;          -papis) PAPIS=t;;
   
1070          -pcls) PCL=t;;          -pcls) PCL=t;;
1071    
1072          -*)          -*) echo "Error: unrecognized option: "$ac_option
1073              echo "Error: unrecognized option: "$ac_option              usage ;;
1074              usage          *)  echo "Error: unrecognized argument: "$ac_option
1075              ;;              usage ;;
1076            
         *)  
             echo "Error: unrecognized argument: "$ac_option  
             usage  
             ;;  
           
1077       esac       esac
1078        
1079  done  done
1080    
1081  if test "x$QUICK" = xt ; then  if test "x$QUICK" = xt ; then
# Line 954  if test "x$QUICK" = xt ; then Line 1084  if test "x$QUICK" = xt ; then
1084      NODEPEND=t      NODEPEND=t
1085  fi  fi
1086    
1087    #- check length of MPI machine file:
1088    if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then
1089        if test -r $MPI_MFILE ; then
1090            nl=`wc -l $MPI_MFILE | awk '{print $1}'`
1091            if [ $nl -lt $MPI ] ; then
1092              echo "Error: need at least $MPI nodes (currently only $nl) in MPI_MFILE=$MPI_FILE"
1093              usage
1094            fi
1095            if [ $verbose -gt 1 ]; then
1096                echo " MPI_MFILE=$MPI_MFILE : $nl procs for MPI=$MPI run"
1097            fi
1098        else
1099              echo "Error: cannot access MPI_MFILE=$MPI_FILE"
1100              usage
1101        fi
1102    fi
1103    
1104  #- setting for forward or ADM testing  #- setting for forward or ADM testing
1105  if test "x$ADM" = xt ; then  if test "x$ADM" = xt ; then
1106      code_dir=code_ad      code_dir=code_ad
# Line 972  else Line 1119  else
1119      EXECUTABLE="mitgcmuv"      EXECUTABLE="mitgcmuv"
1120  fi  fi
1121    
1122    xx=`echo $TESTDIRS | awk '{print $1}'`
1123  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
1124      LIST=`scandirs results/$ref_outp`      LIST=`scandirs results/$ref_outp`
1125    elif test $xx = 'start_from' ; then
1126        xx=`echo $TESTDIRS | awk '{print $2}'`
1127        LIST=`scandirs results/$ref_outp | sed -n "/$xx/,$ p"`
1128  else  else
1129      #- expand group of experiments:      #- expand group of experiments:
1130      LIST=" "      LIST=" "
# Line 988  else Line 1139  else
1139                   LIST=${LIST}" "`ls | grep 'tutorial_'` ;;                   LIST=${LIST}" "`ls | grep 'tutorial_'` ;;
1140          *)       LIST=${LIST}" "$xx ;;          *)       LIST=${LIST}" "$xx ;;
1141        esac        esac
1142      done      done
1143  fi  fi
1144  #echo 'LIST='${LIST}'<'  #echo 'LIST='${LIST}'<'
1145  #- skip dirs, remove duplicate and non-directory:  #- skip dirs, remove duplicate and non-directory:
# Line 1009  do Line 1160  do
1160          else count=1 ; echo "" ;  echo -n " skip: \"$xx\""          else count=1 ; echo "" ;  echo -n " skip: \"$xx\""
1161          fi          fi
1162      fi      fi
1163  done  done
1164  if test $count = 1 ; then echo "" ; echo -n " ... " ; fi  if test $count = 1 ; then echo "" ; echo -n " ... " ; fi
1165  #echo 'TESTDIRS='${TESTDIRS}'<'  #echo 'TESTDIRS='${TESTDIRS}'<'
1166    
# Line 1017  if test "x$OPTFILE" = xNONE -a "x$MITGCM Line 1168  if test "x$OPTFILE" = xNONE -a "x$MITGCM
1168      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
1169  fi  fi
1170    
1171  RUNLOG="run.log"  LOC_MFILE='tr_mpi_mfile'
1172    RUNLOG="run.tr_log"
1173  OUTPUTFILE=$ref_outp  OUTPUTFILE=$ref_outp
1174  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
1175      COMMAND="./$EXECUTABLE > $OUTPUTFILE"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
1176  fi  fi
1177  if test "x$MPI" = xt ; then  if test "x$MPI" != x0 ; then
1178      OUTPUTFILE="STDOUT.0000"      OUTPUTFILE="STDOUT.0000"
1179  fi  fi
1180    
# Line 1045  else Line 1197  else
1197  fi  fi
1198    
1199  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
1200  createcodelet  if test -x tr_cmpnum ; then
1201        echo "skipping comparison code build"
1202    else
1203        createcodelet
1204    fi
1205    
1206  #  build the mpack utility (if ADDRESSES = NONE, do it to test the build)  #  build the mpack utility (if ADDRESSES = NONE, do it to test the build)
1207  if test "x$ADDRESSES" = x ; then  if test "x$ADDRESSES" = x ; then
# Line 1111  if test "x$OPTFILE" != xNONE ; then Line 1267  if test "x$OPTFILE" != xNONE ; then
1267      fi      fi
1268  else  else
1269      echo >> $SUMMARY      echo >> $SUMMARY
1270      echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY      echo "No \"OPTFILE\" was specified ; genmake2 found and uses:" >> $SUMMARY
1271      echo "   so the genmake default will be used." >> $SUMMARY      #-note: to be filled later after 1rst run
1272  fi  fi
1273  echo  echo
1274  echo >> $SUMMARY  echo >> $SUMMARY
1275  if test "x$ADM" = x -a "x$OADM" = x; then  if test "x$ADM" = x -a "x$OADM" = x; then
1276      if [ $MATCH_CRIT -lt 10 ] ;      if [ $MATCH_CRIT -lt 10 ] ;
1277      then line_0="default  "$MATCH_CRIT ;      then line_0="default  "$MATCH_CRIT ;
1278      else line_0="default "$MATCH_CRIT ; fi      else line_0="default "$MATCH_CRIT ; fi
1279         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"
 #   line_0="            ----T-----  ----S-----  ----U-----  ----V-----"  
1280      line_1="G D M    c        m  s        m  s        m  s        m  s"      line_1="G D M    c        m  s        m  s        m  s        m  s"
1281      line_2="E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  ."      line_2="E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  ."
1282      line_3="N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d"      line_3="N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d"
# Line 1142  if test "x$ADM" = x -a "x$OADM" = x; the Line 1297  if test "x$ADM" = x -a "x$OADM" = x; the
1297  else  else
1298      echo "ADJOINT=true" >> $SUMMARY      echo "ADJOINT=true" >> $SUMMARY
1299      echo >> $SUMMARY      echo >> $SUMMARY
1300      if [ $MATCH_CRIT -lt 10 ] ;      if [ $MATCH_CRIT -lt 10 ] ;
1301      then line_0="default     "$MATCH_CRIT ;      then line_0="default     "$MATCH_CRIT ;
1302      else line_0="default    "$MATCH_CRIT ; fi      else line_0="default    "$MATCH_CRIT ; fi
1303      echo "$line_0" | tee -a $SUMMARY      echo "$line_0" | tee -a $SUMMARY
1304      cat << EOF | tee -a $SUMMARY      cat << EOF | tee -a $SUMMARY
# Line 1154  N n k u  s  a Line 1309  N n k u  s  a
1309    
1310  EOF  EOF
1311  fi  fi
1312    echo "-------------------------------------------------------------------------------"
1313    
1314  #  ...and each test directory...  #  ...and each test directory...
1315  for dir in $TESTDIRS ; do  for dir in $TESTDIRS ; do
1316        
1317      # set builddir & rundir:      # set builddir & rundir:
1318      builddir="build"      builddir="build"
1319      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1320      rundir="run"      rundir="run"
1321        pfxdir="tr_$rundir"
1322      if test ! -d $dir/$rundir ; then      if test ! -d $dir/$rundir ; then
1323          rundir=$builddir          rundir=$builddir
1324      fi      fi
# Line 1172  for dir in $TESTDIRS ; do Line 1329  for dir in $TESTDIRS ; do
1329      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
1330          echo -n '  --- dir:' $BUILD_DIR ': '          echo -n '  --- dir:' $BUILD_DIR ': '
1331          makeclean $BUILD_DIR          makeclean $BUILD_DIR
1332            (   cd $BUILD_DIR
1333                rm -f $EXECUTABLE *.bak
1334                rm -f genmake_state genmake_*optfile genmake.log
1335                rm -f SIZE.h.mpi genmake.tr_log make.tr_log
1336            )
1337          if test -d $dir/$rundir/CVS ; then          if test -d $dir/$rundir/CVS ; then
1338              echo -n '  --- dir:' $dir/$rundir ': '              echo -n '  --- dir:' $dir/$rundir ': '
1339              run_clean $dir/$rundir              run_clean $dir/$rundir
1340          fi          fi
1341          trdir=`( cd $dir ; find . -type d -name "tr_run.*" -print | sed 's/^.\///')`          trdir=`( cd $dir ; find . -type d -name "$pfxdir.*" -print | sed 's/^.\///')`
1342          ttd=`echo $trdir | wc -w`          ttd=`echo $trdir | wc -w`
1343          if test $ttd != 0 ; then          if test $ttd != 0 ; then
1344              echo '  --- rm dir:' $trdir              echo '  --- rm dir:' $trdir
# Line 1185  for dir in $TESTDIRS ; do Line 1347  for dir in $TESTDIRS ; do
1347          continue          continue
1348      fi      fi
1349    
1350      #  Verify that the testdir exists and contains previous      #  Verify that the testdir exists and contains previous
1351      #  results in the correct location--or skip this directory!      #  results in the correct location--or skip this directory!
1352      fout=$dir"/results/"$ref_outp      fout=$dir"/results/"$ref_outp
1353      if test ! -r $fout ; then      if test ! -r $fout ; then
# Line 1195  for dir in $TESTDIRS ; do Line 1357  for dir in $TESTDIRS ; do
1357    
1358      # Check for specific files for particular type of run      # Check for specific files for particular type of run
1359    
1360      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then      if test ! -r $CODE_DIR"/SIZE.h_mpi"  -a "x$MPI" != "x0" ; then
1361          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1362          continue          continue
1363      fi      fi
# Line 1203  for dir in $TESTDIRS ; do Line 1365  for dir in $TESTDIRS ; do
1365          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"
1366          continue          continue
1367      fi      fi
1368      if test "x$MPI" = "xt" -a "x$MULTI_THREAD" = "xt" ; then  
1369        retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/input/eedata.mth"`      if test "x$MPI" != "x0" ; then
1370        if test $retv != 0 ; then          prefer_X=0
1371          echo "input/eedata.mth tiling misfit -- skipping $dir"          if test "x$MULTI_THREAD" = "xt" ; then
1372          continue              retv=`check_eedata $dir"/input/eedata.mth"`
1373        fi              if test $retv = 1 ; then prefer_X=1 ; fi
1374            fi
1375            #- create new SIZE.h with no more than '$MPI' Procs
1376            mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI $prefer_X
1377            LOC_NPROC=$?
1378            (   cd $BUILD_DIR
1379                if test -r SIZE.h.mpi ; then
1380                    cmp tr_size.mpi SIZE.h.mpi > /dev/null 2>&1 ; RETVAL=$?
1381                else RETVAL=1
1382                fi
1383                if test "x$RETVAL" = x0 ; then
1384                    rm -f tr_size.mpi
1385                else
1386                    rm -f SIZE.h.mpi ; mv tr_size.mpi SIZE.h.mpi
1387                fi
1388            )
1389            if test "x$MPI_MFILE" != x ; then
1390                #- create new MPI machine-file with the right number of Procs
1391                rm -f $LOC_MFILE
1392                cat $MPI_MFILE | sort | uniq | head -$LOC_NPROC > $LOC_MFILE
1393                nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1394                if [ $nl -lt $LOC_NPROC ] ; then
1395                    rm -f $LOC_MFILE
1396                    cat $MPI_MFILE | head -$LOC_NPROC > $LOC_MFILE
1397                    #sed -n "1,$LOC_NPROC p" $MPI_MFILE > $LOC_MFILE
1398                fi
1399                if [ $verbose -gt 1 ]; then
1400                    nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1401                    echo " new LOC_MFILE=$LOC_MFILE : $nl procs for LOC_NPROC=$LOC_NPROC"
1402                fi
1403            fi
1404            if test "x$MULTI_THREAD" = "xt" ; then
1405                retv=`check_eedata $dir"/input/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"`
1406                if test $retv != 0 ; then
1407                    echo "input/eedata.mth tiling misfit -- skipping $dir"
1408                    continue
1409                fi
1410            fi
1411      fi      fi
1412    
1413      #  Check whether there are "extra runs" for this testdir      #  Check whether there are "extra runs" for this testdir
1414      extra_runs=      extra_runs=
1415      ex_run_dirs=`( cd $dir ; echo $inputdir.* )`      if test "x$NORUN" = xf ; then
1416            ex_run_dirs=`( cd $dir ; echo $inputdir.* )`
1417        fi
1418      #echo "ex_run_dirs='$ex_run_dirs'"      #echo "ex_run_dirs='$ex_run_dirs'"
1419      for exd in $ex_run_dirs ; do      for exd in $ex_run_dirs ; do
1420          name=`echo $exd | sed -e "s/$inputdir\.//"`          name=`echo $exd | sed -e "s/$inputdir\.//"`
1421          refExOut=`echo $ref_outp | sed "s/\./.${name}./"`          refExOut=`echo $ref_outp | sed "s/\./.${name}./"`
1422          outf="$dir/results/$refExOut"          outf="$dir/results/$refExOut"
1423          if test -f $outf -a -r $outf ; then          if test -f $outf -a -r $outf ; then
1424            if test "x$MULTI_THREAD" = "xt" ; then            if test "x$MULTI_THREAD" = "xt" ; then
1425              if test -r $dir"/"$exd"/eedata.mth" ; then              if test -r $dir"/"$exd"/eedata.mth" ; then
1426                if test "x$MPI" = "xt" ; then                if test "x$MPI" = "x0" ; then
1427                  retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/"$exd"/eedata.mth"`                  extra_runs="$extra_runs $name"
1428                  else
1429                    retv=`check_eedata $dir"/"$exd"/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"`
1430                  if test $retv = 0 ; then                  if test $retv = 0 ; then
1431                      extra_runs="$extra_runs $name"                      extra_runs="$extra_runs $name"
1432                  else                  else
1433                      echo $exd"/eedata.mth tiling misfit -- skipping $dir"                      echo $exd"/eedata.mth tiling misfit -- skipping $dir"
1434                  fi                  fi
               else  
                 extra_runs="$extra_runs $name"  
1435                fi                fi
1436              #else echo $dir"/"$exd"/eedata.mth: not found"              #else echo $dir"/"$exd"/eedata.mth: not found"
1437              fi              fi
# Line 1240  for dir in $TESTDIRS ; do Line 1441  for dir in $TESTDIRS ; do
1441          fi          fi
1442      done      done
1443    
     echo "-------------------------------------------------------------------------------"  
1444      echo      echo
1445      if test "x$extra_runs" = "x" ; then      if test "x$extra_runs" = "x" ; then
1446         echo "Experiment:  $dir"         echo "Experiment:  $dir"
1447      else      else
1448         echo "Experiment:  $dir ; extra_runs=$extra_runs"         echo "Experiment:  $dir ; extra_runs=$extra_runs"
# Line 1251  for dir in $TESTDIRS ; do Line 1451  for dir in $TESTDIRS ; do
1451      unset genmake makedepend make run      unset genmake makedepend make run
1452      results=$EMPTY_RESULTS      results=$EMPTY_RESULTS
1453    
1454      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir & summary.txt file for each tested experiment (tdir)
1455      rel_CDIR=$DRESULTS"/"$dir      locDIR=$DRESULTS"/"$dir
1456      mkdir $rel_CDIR      mkdir $locDIR
1457      CDIR=`pwd`"/$rel_CDIR"      #- report to this experiment local summary file ---
1458            echo "DATE='$DATE' ; tdir='$dir'" > $locDIR"/summary.txt"
1459      if test "x$CLEANUP" = xt ; then      echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1460          echo '====>>> this is to check that we never go through this part <<< ==='      echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1461          makeclean $dir/$builddir \      CDIR=`pwd`"/$locDIR"
1462              && run_clean $dir/$rundir  
1463        if test "x$NORUN" = xt ; then
1464                run=N
1465            genmakemodel $dir/$builddir && genmake=Y \
1466                && makeclean $dir/$builddir \
1467                && symlink_mpifiles $dir $code_dir $builddir \
1468                && makedependmodel $dir/$builddir && makedepend=Y \
1469                && makemodel $dir/$builddir && make=Y
1470      else      else
1471          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
1472              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
             && run_clean $dir/$rundir \  
1473              && symlink_mpifiles $dir $code_dir $builddir \              && symlink_mpifiles $dir $code_dir $builddir \
1474              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
1475              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
1476              && linkdata $dir/$rundir $inputdir input \              && run_clean $dir/$rundir \
1477                && linkdata $dir/$rundir $inputdir \
1478              && runmodel $dir/$rundir && run=Y \              && runmodel $dir/$rundir && run=Y \
1479              && results=`testoutput_run $dir $rundir $ref_outp`              && results=`testoutput_run $dir $rundir $ref_outp`
1480      fi      fi
1481            #echo "results='$results'"
1482      echo  
1483          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1484          echo          echo 1>&2
1485          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
1486          touch $CDIR"/summary.txt"          echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
         echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $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"  
         if test "x$ADM" = xt ; then  
             head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt"  
             grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \  
                                 >> $CDIR"/summary.txt"  
         fi  
1487    
1488          for ex in $extra_runs ; do          for ex in $extra_runs ; do
1489              unset run              unset run
1490              results=$EMPTY_RESULTS              results=$EMPTY_RESULTS
1491              #  reference output file              #  reference output file
1492              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`
1493              #  Create an output dir for each OPTFILE/tdir.ex combination              #  Create an output dir & summary.txt file for each extra run (tdir.ex)
1494              rel_CDIR=$DRESULTS"/"$dir"."$ex              locDIR=$DRESULTS"/"$dir"."$ex
1495              mkdir $rel_CDIR              mkdir $locDIR
1496              CDIR=`pwd`"/$rel_CDIR"              #- report to this experiment local summary file ---
1497              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"              echo "DATE='$DATE' ; tdir='$dir.$ex'" > $locDIR"/summary.txt"
1498              run_clean $dir/tr_run.$ex              #echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1499              linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir input              #echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1500              runmodel $dir/tr_run.$ex && run=Y \              CDIR=`pwd`"/$locDIR"
1501              && results=`testoutput_run $dir tr_run.$ex $refExOut`              test ! -e "$dir/$pfxdir.$ex" && mkdir "$dir/$pfxdir.$ex"
1502                run_clean $dir/$pfxdir.$ex
1503                linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir
1504                runmodel $dir/$pfxdir.$ex && run=Y \
1505                && results=`testoutput_run $dir $pfxdir.$ex $refExOut`
1506              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1507              fres="$fres.$ex"              fres="$fres.$ex"
1508              echo              echo 1>&2
1509              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
1510              touch $CDIR"/summary.txt"              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
1511              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $CDIR"/summary.txt"              if test "x$POSTCLEAN" = x2 ; then
1512              echo "MACH='$MACH'" >> $CDIR"/summary.txt"                  run_clean $dir/$pfxdir.$ex
             echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
             echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
             echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt"  
             if test "x$ADM" = xt ; then  
                 head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt"  
                 grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \  
                                    >> $CDIR"/summary.txt"  
             fi  
             if test "x$POSTCLEAN" = xt ; then  
                 run_clean $dir/tr_run.$ex  
1513              fi              fi
1514          done          done
1515    
1516        if test -f $DRESULTS"/"genmake_state ; then : ; else
1517            if test -f $dir/$builddir/Makefile ; then
1518                mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
1519                echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state
1520                sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state
1521                echo " $mkOpt" >> $DRESULTS/genmake_state
1522                if test "x$OPTFILE" = xNONE ; then
1523                    eval $mkOpt
1524                    sed "/^No \"OPTFILE\" was specified ; genmake2/a\  OPTFILE=${OPTFILE}"\
1525                            $SUMMARY > tr_0.tmp_log
1526                    RETVAL=$?
1527                    if test "x$RETVAL" = x0 ; then rm -f $SUMMARY
1528                            cp tr_0.tmp_log $SUMMARY
1529                    else rm -f tr_0.tmp_log
1530                    fi
1531                fi
1532                gmkLog=$dir/$builddir/genmake.log
1533                grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1
1534                RETVAL=$?
1535                if test "x$RETVAL" = x0 ; then
1536                    echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state
1537                    sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \
1538                           | grep -v '^... compiler version ' > tr_1.tmp_log
1539                    sed -n '1,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \
1540                            >> $DRESULTS/genmake_state
1541                    rm -f tr_1.tmp_log
1542                fi
1543            fi
1544        fi
1545      #postclean $dir/$builddir      #postclean $dir/$builddir
1546      if test "x$POSTCLEAN" = xt ; then      if test "x$POSTCLEAN" = x2 ; then
1547          makeclean $dir/$builddir \          makeclean $dir/$builddir \
1548              && run_clean $dir/$rundir              && run_clean $dir/$rundir
1549      fi      fi
1550            if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then rm -f $LOC_MFILE ; fi
1551    
1552      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
1553        
1554  done  done
1555    
1556  printf "Start time:  " >> $SUMMARY  printf "Start time:  " >> $SUMMARY
# Line 1358  else Line 1579  else
1579              echo "An email containing results was sent to the following addresses:"              echo "An email containing results was sent to the following addresses:"
1580              echo "  \"$ADDRESSES\""              echo "  \"$ADDRESSES\""
1581              echo              echo
1582                test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
1583                test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
1584          fi          fi
         test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"  
         test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"  
1585      fi      fi
1586  fi  fi
1587    
1588  rm -f tr_cmpnum.c tr_cmpnum  if test "x$QUICK" = xf -a "x$NORUN" = xf ; then
1589        rm -f tr_cmpnum.c tr_cmpnum
1590    fi
1591    
1592  if test "x$CLEANUP" != xt ; then  if test "x$CLEANUP" != xt ; then
1593      cat $SUMMARY | sed 's/ \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \. //'      cat $SUMMARY | sed 's/ \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \. //'

Legend:
Removed from v.1.127  
changed lines
  Added in v.1.164

  ViewVC Help
Powered by ViewVC 1.1.22