/[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.117 by jmc, Tue Aug 19 18:29:12 2008 UTC revision 1.157 by jmc, Thu Jan 27 04:51:03 2011 UTC
# Line 11  usage() Line 11  usage()
11      echo      echo
12      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
13      echo "  (-help|-h)               print usage"      echo "  (-help|-h)               print usage"
14      echo "  (-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 "  (-mfile|-mf) STRING      MPI: file with list of possible machines to run on"
18        echo "  (-ieee/-noieee)          if possible, use IEEE compiler flags"
19      echo "                             (DEF=\"-ieee\")"      echo "                             (DEF=\"-ieee\")"
20      echo "  (-gsl)                   compile with \"-gsl\" flag"      echo "  (-gsl)                   compile with \"-gsl\" flag"
21      echo "  (-of=|-optfile=)STRING   list of optfiles to use"      echo "  (-use_r4|-ur4)           if allowed, use real*4 type for '_RS' variable"
22      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-optfile|-of) STRING    list of optfiles to use"
23        echo "  (-addr|-a) STRING        list of email recipients"
24      echo "                             (DEF=\"\" no email is sent)"      echo "                             (DEF=\"\" no email is sent)"
25      echo "  (-mpd|-mpackdir) DIR     location of the mpack utility"      echo "  (-mpackdir|-mpd) DIR     location of the mpack utility"
26      echo "                             (DEF=\"../tools/mpack-1.6\")"      echo "                             (DEF=\"../tools/mpack-1.6\")"
27      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"
28      echo "                             (recognized groups: basic, tutorials)"      echo "                             (recognized groups: basic, tutorials)"
29      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
30      echo "  (-skd|-skipdir) STRING   list of exp. dirs to skip"      echo "                             (if list= 'start_from THIS_EXP' then"
31        echo "                              test THIS_EXP + all the following)"
32        echo "  (-skipdir|-skd) STRING   list of exp. dirs to skip"
33      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
34      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"      echo "  (-bash|-b) STRING        preferred location of a \"bash\" or"
35      echo "                             Bourne-compatible \"sh\" shell"      echo "                             Bourne-compatible \"sh\" shell"
36      echo "                             (DEF=\"\" for \"bash\")"      echo "                             (DEF=\"\" for \"bash\")"
37      echo "  (-adm|-ad)               perform an adjoint run"      echo "  (-adm|-ad)               perform an adjoint run"
38      echo "  (-command) STRING        command to run"      echo "  (-oad)                   perform an OpenAD adjoint run"
39      echo "                             (DEF=\"make output.txt\")"      echo "  (-command|-c) STRING     command to run"
40      echo "  (-m|-make) STRING        command to use for \"make\""      echo "  (-makedepend|-md) STRING command to use for \"makedepend\""
41        echo "  (-make|-m) STRING        command to use for \"make\""
42      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
43      echo "  (-odir) STRING           used to build output directory name"      echo "  (-odir) STRING           used to build output directory name"
44      echo "                             (DEF=\"hostname\")"      echo "                             (DEF=\"hostname\")"
45      echo "  (-ptr|-ptracers) STRING  specify which ptracers to test"  #   echo "  (-ptracers|-ptr) STRING  specify which ptracers to test"
46      echo "                             (DEF=\"1 2 3 4 5\")"  #   echo "                             (DEF=\"1 2 3 4 5\")"
47      echo "  (-match) NUMBER          Matching Criteria (number of digits)"      echo "  (-match) NUMBER          Matching Criteria (number of digits)"
48      echo "                             (DEF=\"12\")"      echo "                             (DEF=\"$MATCH_CRIT\")"
49      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"
50      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\" & clean run-dir"
51        echo "  (-norun|-nr)             skip the \"runmodel\" stage (stop after make)"
52        echo "  (-runonly|-ro)           *ONLY* run stage (=\"-quick\" without make)"
53      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
54      echo "  (-nogenmake|-ng)         skip the genmake stage"      echo "  (-nogenmake|-ng)         skip the genmake stage"
55      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-noclean|-nc)           skip the \"make clean\" stage"
56      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
57        echo "  (-postclean|-pc)         after each exp. test, clean build-dir & run-dir"
58        echo "  (-deloutp|-do)           delete output files after successful run"
59      echo "  (-deldir|-dd)            on success, delete the output directory"      echo "  (-deldir|-dd)            on success, delete the output directory"
60      echo "  (-ts)                    provide timing information per timestep"      echo "  (-ts)                    provide timing information per timestep"
61      echo "  (-papis)                 provide MFlop/s per timestep using PAPI"      echo "  (-papis)                 provide MFlop/s per timestep using PAPI"
# Line 103  testoutput_var() Line 113  testoutput_var()
113  {  {
114      # testoutput_var dir s1 label subdir reference_output      # testoutput_var dir s1 label subdir reference_output
115      #      #
116      #  compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE      #  compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE
117      #     with same output from reference file $dir/results/$reference_output      #     with same output from reference file $dir/results/$reference_output
118      #  using search strings s1 and text label      #  using search strings s1 and text label
119    
# Line 175  testoutput_var() Line 185  testoutput_var()
185          fi          fi
186      fi      fi
187      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
188        
189      return $digits_of_similarity      return $digits_of_similarity
190  }  }
191    
# Line 211  testoutput_run() Line 221  testoutput_run()
221                  eval "HAVE_PTR0"$ii"=t"                  eval "HAVE_PTR0"$ii"=t"
222              else              else
223                  eval "HAVE_PTR0"$ii"=f"                  eval "HAVE_PTR0"$ii"=f"
224                if test "x$ADM" = x ; then                if test "x$ADM" = x -a "x$OADM" = x; then
225                # remove this ptr from the list of output variable to check                # remove this ptr from the list of output variable to check
226                # echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2                # echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2
227                  listVar=`echo "$listVar" | sed "s/ pt$ii..//g"`                  listVar=`echo "$listVar" | sed "s/ pt$ii..//g"`
# Line 228  testoutput_run() Line 238  testoutput_run()
238            listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`            listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`
239          fi          fi
240          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
241          echo "listVar='$listVar'" > $CDIR"/summary.txt"          #- report to this experiment local summary file ---
242            echo "MACH='$MACH'" > $locDIR"/summary.txt"
243            echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
244            echo "DATE='$DATE'" >> $locDIR"/summary.txt"
245            grep '(PID\.TID 0000\.0001)      n.. =' $1/$2/$OUTPUTFILE \
246             | sed 's/(PID.TID 0000.0001)     //' >> $locDIR"/summary.txt"
247            echo "listVar='$listVar'" >> $locDIR"/summary.txt"
248            #---
249          allargs=""          allargs=""
250          for xx in $listVar          for xx in $listVar
251          do          do
# Line 263  testoutput_run() Line 280  testoutput_run()
280             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=$? ;;
281          '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/..$//'`
282             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=$? ;;
283           'Qntmn') testoutput_var $1 "extforcing_qnet_min" "Qnet minimum"  $2 $3; yy=$? ;;           'Qntmn') testoutput_var $1 "forcing_qnet_min" "Qnet minimum"  $2 $3; yy=$? ;;
284           'Qntmx') testoutput_var $1 "extforcing_qnet_max" "Qnet maximum"  $2 $3; yy=$? ;;           'Qntmx') testoutput_var $1 "forcing_qnet_max" "Qnet maximum"  $2 $3; yy=$? ;;
285           'Qntav') testoutput_var $1 "extforcing_qnet_mean" "Qnet mean"    $2 $3; yy=$? ;;           'Qntav') testoutput_var $1 "forcing_qnet_mean" "Qnet mean"       $2 $3; yy=$? ;;
286           '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=$? ;;
287           '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=$? ;;
288           '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=$? ;;
289           '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=$? ;;
290           'aSIsd') testoutput_var $1 "seaice_area_sd"    "SIce Area StDv"  $2 $3; yy=$? ;;           'aSIsd') testoutput_var $1 "seaice_area_sd"    "SIce Area StDv"  $2 $3; yy=$? ;;
291           'hSImn') testoutput_var $1 "seaice_heff_min"   "SIce Heff min"   $2 $3; yy=$? ;;           'hSImn') testoutput_var $1 "seaice_heff_min"   "SIce Heff min"   $2 $3; yy=$? ;;
292           'hSImx') testoutput_var $1 "seaice_heff_max"   "SIce Hell max"   $2 $3; yy=$? ;;           'hSImx') testoutput_var $1 "seaice_heff_max"   "SIce Heff max"   $2 $3; yy=$? ;;
293           'hSIav') testoutput_var $1 "seaice_heff_mean"  "SIce Hell mean"  $2 $3; yy=$? ;;           'hSIav') testoutput_var $1 "seaice_heff_mean"  "SIce Heff mean"  $2 $3; yy=$? ;;
294           'hSIsd') testoutput_var $1 "seaice_heff_sd"    "SIce Hell StDv"  $2 $3; yy=$? ;;           'hSIsd') testoutput_var $1 "seaice_heff_sd"    "SIce Heff StDv"  $2 $3; yy=$? ;;
295          'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $3; yy=$? ;;          'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $3; yy=$? ;;
296          'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South"  $2 $3; yy=$? ;;          'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South"  $2 $3; yy=$? ;;
297          'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North"  $2 $3; yy=$? ;;          'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North"  $2 $3; yy=$? ;;
# Line 290  testoutput_run() Line 307  testoutput_run()
307          done          done
308    
309          nbVar=`echo $listVar | awk '{print NF}'`          nbVar=`echo $listVar | awk '{print NF}'`
310          if [ $nbVar -lt $LEN_CHECK_LIST ] ; then          if [ $nbVar -lt $LEN_CHECK_LIST ] ; then
311          #-- fill line (up to standard length) with dot:          #-- fill line (up to standard length) with dot:
312            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 "."}}'`
313            echo $allargs $adNul            echo $allargs $adNul
314          else          else
315            echo $allargs            echo $allargs
316          fi          fi
317  # <-- same processing for adjoint & forward test  # <-- same processing for adjoint & forward test
318  }  }
319    
# Line 314  genmakemodel() Line 331  genmakemodel()
331          (          (
332              cd $1;              cd $1;
333              command="$GENMAKE2  -ds -m $MAKE"              command="$GENMAKE2  -ds -m $MAKE"
334              if test "x$ADM" = x ; then              if test "x$MKDEPEND" != x ; then
335                  command="$command --mods=../code"                  command="$command -makedepend=$MKDEPEND"
336              else              fi
337                if test "x$ADM" = xt ; then
338                  command="$command --mods=../code_ad"                  command="$command --mods=../code_ad"
339                elif test "x$OADM" = xt ; then
340                    command="$command -adof ../../../tools/adjoint_options/adjoint_oad -mods '../code_oad ../../OpenAD/code_oad_all'"
341                else
342                    command="$command -mods=../code"
343              fi              fi
344              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
345                  command="$command --optfile=$OPTFILE"                  command="$command -optfile=$OPTFILE"
346              fi              fi
347              if test "x$IEEE" != x ; then              if test "x$IEEE" != x ; then
348                  command="$command -ieee"                  command="$command -ieee"
# Line 328  genmakemodel() Line 350  genmakemodel()
350              if test "x$GSL" = xt ; then              if test "x$GSL" = xt ; then
351                  command="$command -gsl"                  command="$command -gsl"
352              fi              fi
353              if test "x$MPI" = xt ; then              if test "x$MPI" != x0 ; then
354                  command="$command -mpi"                  command="$command -mpi"
355              fi              fi
356                if test "x$MULTI_THREAD" = xt ; then
357                #- run multi-threaded using OpenMP:
358                    command="$command -omp"
359                fi
360                if test "x$USE_R4" = xt ; then
361                    command="$command -use_r4"
362                fi
363              if test "x$TS" = xt ; then              if test "x$TS" = xt ; then
364                  command="$command -ts"                  command="$command -ts"
365              fi              fi
366              if test "x$PAPIS" = xt ; then              if test "x$PAPIS" = xt ; then
367                  command="$command -papis"                  command="$command -papis"
368              else              else
369              if test "x$PCLS" = xt ; then              if test "x$PCLS" = xt ; then
370                  command="$command -pcls"                  command="$command -pcls"
371              fi              fi
372              fi              fi
373              printf 'genmake ... ' 1>&2              printf 'genmake ... '
374              $command > make.log 2>&1              eval $command > genmake.tr_log 2>&1
375              RETVAL=$?              RETVAL=$?
376              #  Reduce the size of the testing emails!              #  Reduce the size of the testing emails!
377              head -100 Makefile > $CDIR/Makefile_head              head -100 Makefile > $CDIR/Makefile_head
378              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
379                  tail make.log                  tail genmake.tr_log
380                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed"
381                  cp genmake_* make.log $CDIR                  cp genmake.log genmake_* genmake.tr_log $CDIR
382                  return 1                  return 1
383              else              else
384                  echo "successful" 1>&2                  echo "successful"
385              fi              fi
386          )          )
387      fi      fi
# Line 361  genmakemodel() Line 390  genmakemodel()
390  makeclean()  makeclean()
391  {  {
392      # makeclean directory      # makeclean directory
393        if test "x$NODEPEND" = xf ; then rm -f $1/make.tr_log ; fi
394      if test "x$NOCLEAN" = xt ; then      if test "x$NOCLEAN" = xt ; then
395          echo "make Clean skipped!"          echo "make Clean skipped!"
396      else      else
# Line 368  makeclean() Line 398  makeclean()
398              cd $1;              cd $1;
399              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi
400              if test -r Makefile ; then              if test -r Makefile ; then
401                  printf 'clean build-dir: make Clean ... ' 2>&1                  printf 'clean build-dir: make Clean ... '
402                  $MAKE Clean >> make.log 2>&1                  $MAKE Clean >> make.tr_log 2>&1
403                  RETVAL=$?                  RETVAL=$?
404                  if test "x$RETVAL" != x0 ; then                  if test "x$RETVAL" != x0 ; then
405                      tail make.log                      tail make.tr_log
406                      echo "makeclean: \"make Clean\" failed" 1>&2                      echo "makeclean: \"make Clean\" failed"
407                      cp make.log $CDIR"/make.log"                      cp make.tr_log genmake.log genmake.tr_log $CDIR
408                      return 1                      return 1
409                  fi                  fi
410                    echo successful
411                else
412                    echo ''
413              fi              fi
             echo successful 1>&2  
414              exit 0              exit 0
415          )          )
416      fi      fi
# Line 392  run_clean() Line 424  run_clean()
424      else      else
425          (          (
426              cd $1;              cd $1;
427              printf 'clean run-dir ... ' 2>&1              printf 'clean run-dir ... '
428              # part of what is done after "make clean" when doing "make CLEAN"              # part of what is done after "make clean" when doing "make CLEAN"
429              find . -name "*.meta" -exec rm {} \;              find . -name "*.meta" -exec rm {} \;
430              find . -name "*.data" -exec rm {} \;              find . -name "*.data" -exec rm {} \;
431              find . -name "fort.*" -exec rm {} \;              find . -name "fort.*" -exec rm {} \;
432              find . -type l -exec rm {} \;              find . -type l -exec rm {} \;
433              rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime              rm -f $EXECUTABLE $RUNLOG *.txt STD* *diagnostics.log datetime
434              rm -rf mnc_test_*              rm -rf mnc_test_*
435              rm -f *_MIT_CE_000.opt0000 costfunction*0000              rm -f *_MIT_CE_000.opt0000 costfunction*0000
436              echo successful 1>&2              echo successful
437              exit 0              exit 0
438          )          )
439      fi      fi
# Line 415  makedependmodel() Line 447  makedependmodel()
447      else      else
448          (          (
449              cd $1;              cd $1;
450              printf 'make depend ... ' 1>&2              printf 'make depend ... '
451              $MAKE depend >> make.log 2>&1              $MAKE depend >> make.tr_log 2>&1
452              RETVAL=$?              RETVAL=$?
453              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
454                  tail make.log                  tail make.tr_log
455                  echo "makedependmodel: make depend failed" 1>&2                  echo "makedependmodel: make depend failed"
456                  cp make.log $CDIR"/make.log"                  cp make.tr_log genmake.log genmake.tr_log $CDIR
457                  return 1                  return 1
458              else              else
459                  echo successful 1>&2                  echo successful
460              fi              fi
461          )          )
462      fi      fi
# Line 434  makemodel() Line 466  makemodel()
466  {  {
467      # makemodel directory      # makemodel directory
468      (      (
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                return 2
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" = x ; then              if test "x$ADM" = xt ; then
482                    $MAKE adall >> make.tr_log 2>&1
483                elif test "x$OADM" = xt ; then
484                    $MAKE adAll >> make.tr_log 2>&1
485                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
             else  
                 $MAKE adall >> make.log 2>&1  
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 make.tr_log genmake.log genmake.tr_log $CDIR
497                    rm -f $EXECUTABLE
498                  return 1                  return 1
499              else              else
500                  echo successful 1>&2                  echo successful
501              fi              fi
502          fi          fi
503        fi
504      )      )
505  }  }
506    
507    mk_mpi_size()
508    {
509        # mk_mpi_size input_file output_file proc_Nb
510        #
511        # make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file)
512        #     for an MPI build with no more than proc_Nb processors ;
513        # return the effective number of processors.
514    
515        inp=$1
516        out=$2
517        np=$3
518        tmp=TTT.$$
519    
520        px=`grep "^     & *nPx *=" $inp | sed "s/^     & *nPx *= *//" | sed 's/, *$//'`
521        py=`grep "^     & *nPy *=" $inp | sed "s/^     & *nPy *= *//" | sed 's/, *$//'`
522        sx=`grep "^     & *nSx *=" $inp | sed "s/^     & *nSx *= *//" | sed 's/, *$//'`
523        sy=`grep "^     & *nSy *=" $inp | sed "s/^     & *nSy *= *//" | sed 's/, *$//'`
524    
525        #- find the largest divisor of input_file proc Nb, but not larger than $np
526        pp=0
527        i=1
528        while [ $i -le $px ] ; do
529          if [ `expr $px % $i` -eq 0 ] ; then
530            j=1
531            while [ $j -le $py ] ; do
532              if [ `expr $py % $j` -eq 0 ] ; then
533                ij=`expr $i \* $j`
534                if [ $ij -gt $pp ] ; then
535                  if [ $ij -le $np ] ; then
536                    ix=$i ; jy=$j ; pp=$ij
537                    #echo "  ix,jy= $ix,$jy"
538                  fi
539                fi
540              fi
541              j=`expr $j + 1`
542            done
543          fi
544          i=`expr $i + 1`
545        done
546    
547        #- create new SIZE.h type file:
548        sx=`expr $sx \* $px / $ix`
549        sy=`expr $sy \* $py / $jy`
550        if [ $verbose -gt 1 ]; then
551            echo " px,py,np= $px,$py,$np : New MPI size: px,py= $ix,$jy : sx,sy= $sx,$sy"
552        fi
553        sed "/^     \& *nPx *=/s/[0-9]*,/$ix,/" $inp > $tmp
554        sed "/^     \& *nPy *=/s/[0-9]*,/$jy,/" $tmp > $out
555        sed "/^     \& *nSx *=/s/[0-9]*,/$sx,/" $out > $tmp
556        sed "/^     \& *nSy *=/s/[0-9]*,/$sy,/" $tmp > $out
557        rm -f $tmp
558        return $pp
559    }
560    
561  symlink_mpifiles()  symlink_mpifiles()
562  {  {
563      # Put special links so that MPI specific files are used      # Put special links so that MPI specific files are used
# Line 467  symlink_mpifiles() Line 566  symlink_mpifiles()
566    
567      dir=$1      dir=$1
568      code_dir=$2      code_dir=$2
569      BUILD_DIR=$dir/$3      build_dir=$dir/$3
570      CODE_DIR=$dir/$code_dir  
       
571      # These are files that should replace their counter-part when using -mpi      # These are files that should replace their counter-part when using -mpi
572      MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)`      MPI_FILES=`(cd $dir/$code_dir; find . -name "*_mpi" -print)`
573    
574      #  Is this an MPI run?      for ii in $MPI_FILES ; do
575      if test "x$MPI" = xt ; then          i=`echo $ii | sed 's:^\./::'`
576          # YES: We symbolically link these files to the build          name=`echo $i | sed 's:_mpi::'`
577          # dir so long as there is no real file in place          file="../$code_dir/$i"
578          for ii in $MPI_FILES ; do          if test $name = 'SIZE.h' ; then file="SIZE.h.mpi" ; fi
579              i=`echo $ii | sed 's:^\./::'`  
580              name=`echo $i | sed 's:_mpi::' `          #  Is this an MPI run?
581              cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1          if test "x$MPI" = x0 ; then
582              RETVAL=$?              # NO: We undo any _mpi symbolically linked files
583              if test "x$RETVAL" != x0 ; then              if test -L $build_dir/$name ; then
584                  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  
585                  RETVAL=$?                  RETVAL=$?
586                  if test "x$RETVAL" = x0 ; then                  if test "x$RETVAL" = x0 ; then
587                      #echo Un-linking $name from $linktarg                      if [ $verbose -gt 1 ]; then
588                      rm -f $BUILD_DIR/$name                          echo "  Un-linking $name from ../$code_dir" ; fi
589                        rm -f $build_dir/$name
590                  fi                  fi
591              fi              fi
592          done          else
593      fi              # YES: We symbolically link these files to the build
594                    # dir so long as there is no real file in place
595                ( cd $build_dir ; cmp $name $file > /dev/null 2>&1 )
596                RETVAL=$?
597                if [ $verbose -gt 1 ]; then echo "  cmp $name $file returns: $RETVAL" ; fi
598                if test "x$RETVAL" != x0 ; then
599                    if test -h $build_dir/$name ; then rm -f $build_dir/$name ; fi
600                    if test ! -r $build_dir/$name ; then
601                        if [ $verbose -gt 1 ]; then echo "  Linking $name to $file" ; fi
602                        (cd $build_dir; ln -sf $file $name)
603                    fi
604                fi
605            fi
606        done
607  }  }
608    
609  linkdata()  linkdata()
# Line 515  linkdata() Line 614  linkdata()
614      if test -d $1 ; then      if test -d $1 ; then
615          (          (
616              cd $1 ; shift              cd $1 ; shift
617                echo 'linkdata from dirs:' $*
618                inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')`
619                for xx in $inpMPI ; do
620                  if test -r "../"$1"/"$xx ; then
621                    # found 1 _mpi sfx file in 1rst input dir and it is readable
622                    yy=`echo $xx | sed 's:\.mpi$::'`
623                    if test "x$MPI" = "x0" ; then
624                        # not mpi test: remove symbolic link
625                        if test -h $yy ; then rm -f $yy ; fi
626                    else
627                        # mpi test: remove symbolic link & link .mpi sfx file
628                        if test -h $yy ; then rm -f $yy ; fi
629                        if test ! -r $yy ; then
630                            ln -sf "../"$1"/"$xx $yy ;
631                            printf " $xx" 1>&2
632                        fi
633                    fi
634                  fi
635                done
636              if test -r "../"$1"/eedata.mth" ; then              if test -r "../"$1"/eedata.mth" ; then
637              # found eedata.mth in 1rst input dir and it is readable              # found eedata.mth in 1rst input dir and it is readable
638                  if test "x$MULTI_THREAD" = "xt" ; then                  if test "x$MULTI_THREAD" = "xt" ; then
639                  # multi-threaded test: remove symbolic link & link eedata.mth                  # multi-threaded test: remove symbolic link & link eedata.mth
640                      if test -h eedata ; then rm -f eedata ; fi                      if test -h eedata ; then rm -f eedata ; fi
641                      if test ! -r eedata ; then                      if test ! -r eedata ; then
642                          ln -sf "../"$1"/eedata.mth" eedata ;                          ln -sf "../"$1"/eedata.mth" eedata ;
643                          printf 'eedata.mth ' 1>&2                          printf ' eedata.mth' 1>&2
644                      fi                      fi
645                  else                  else
646                  # not multi-threaded test: remove eedata symbolic link                  # not multi-threaded test: remove eedata symbolic link
# Line 532  linkdata() Line 650  linkdata()
650              prevDir='NONE'              prevDir='NONE'
651              for ldir in $* ; do              for ldir in $* ; do
652                  if test -d "../"$ldir -a $ldir != $prevDir ; then                  if test -d "../"$ldir -a $ldir != $prevDir ; then
653                      printf 'ldir='${ldir} 1>&2                      printf " ldir=${ldir}:" 1>&2
654                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`
655                      for i in $files ; do                      for i in $files ; do
656                          if test ! -d "../"$ldir/$i ; then                          if test ! -d "../"$ldir/$i ; then
# Line 542  linkdata() Line 660  linkdata()
660                              fi                              fi
661                          fi                          fi
662                      done                      done
663                        printf ' ;' 1>&2
664                      if test -x "../"$ldir"/"prepare_run ; then                      if test -x "../"$ldir"/"prepare_run ; then
665                          "../"$ldir"/"prepare_run                          "../"$ldir"/"prepare_run 1>&2
666                        else
667                            echo '' 1>&2
668                      fi                      fi
                     printf ' ; ' 1>&2  
669                  fi                  fi
670                  prevDir=$ldir                  prevDir=$ldir
671              done              done
# Line 557  runmodel() Line 677  runmodel()
677  {  {
678      # runmodel directory      # runmodel directory
679      #      #
680      #  runs "$COMMAND in "directory"      #  runs $COMMAND in "directory"
681      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
682      (      (
683          cd $1          cd $1
684          printf 'runmodel in %s ...' $1 1>&2          printf 'runmodel in %s ... ' $1
685          # make output.txt          if test -L $EXECUTABLE ; then
686          echo            if test -x "../"$builddir"/"$EXECUTABLE ; then
687          if test -L $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then              cmp $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1
688              diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1              outD=$? ; if test "x$outD" != x0 ; then rm -f $EXECUTABLE ; fi
689              outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; rm -f run.log ; fi            else rm -f $EXECUTABLE
690              fi
691          fi          fi
692          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
693              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_tmp
694              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
695          fi          fi
696            if test "x$MPI" != x0 ; then
697                #- adjust the MPI run command with the right number of Procs
698                #echo '' ; echo "  COMMAND='$COMMAND'"
699                COMMAND=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"`
700                if test "x$MPI_MFILE" != x ; then
701                  COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"`
702                fi
703                #echo "  COMMAND='$COMMAND'"
704            fi
705          if test ! -x $EXECUTABLE ; then          if test ! -x $EXECUTABLE ; then
706                  rm -f run.log ; touch run.log              rm -f $RUNLOG ; touch $RUNLOG
707                  if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi              if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
708                  echo " no executable:" $EXECUTABLE >> run.log              echo " no executable:" $EXECUTABLE >> $RUNLOG
709                  RETVAL=8              RETVAL=8
710                  ENDVAL=-1              ENDVAL=-1
711          else          else
712              if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then            if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then
713                # output do not exist or is older than executable:              # output do not exist or is older than executable:
714                  rm -f run.log ; touch run.log              rm -f $RUNLOG ; touch $RUNLOG
715                  if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi              if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
716                  ( eval $COMMAND ) >> run.log 2>&1              ( eval $COMMAND ) >> $RUNLOG 2>&1
717                  RETVAL=$?              RETVAL=$?
718              else              ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
719                  RETVAL=0              if [ $POSTCLEAN -eq 1 -a $ENDVAL -gt 0 ] ; then
720                  if test -f run.log ; then                  find . -name "*.meta" -exec rm {} \;
721                      if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi                  find . -name "*.data" -exec rm {} \;
722                      echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1                  rm -rf mnc_test_*
723                  else              fi
724                      touch run.log            else
725                      if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi              RETVAL=0
726                      echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1              ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
727                      echo " no previous run.log: assume NORMAL END" >> run.log 2>&1              touch $RUNLOG
728                  fi              if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
729              fi              echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1
730              ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`            fi
731          fi          fi
732          rm -f run.log_00          rm -f run.log_tmp
         #if test "x$RETVAL" = x0 ; then  
733          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
734              tail run.log              echo successful
735              echo successful 1>&2              printf '=> output from running in %s :\n' $1 1>&2
736                tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
737              # === Reduce the size of the testing emails!              # === Reduce the size of the testing emails!
738              #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE              #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE
739              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
740              return 0              return 0
741            elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then
742                #-- for some weird cases (run is finihed but with error code)
743                echo 'finished with error (run:' $RETVAL ' end:' $ENDVAL ')'
744                printf '=> output from running in %s :\n' $1 1>&2
745                tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
746                return 0
747          else          else
748              tail run.log              echo 'failed (run:' $RETVAL ' end:' $ENDVAL ')'
749              echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2              printf '=> output from running in %s :\n' $1 1>&2
750              cp run.log $CDIR"/run.log"              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
751                cp $RUNLOG $CDIR"/"$RUNLOG
752              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
753              return 1              return 1
754          fi          fi
# Line 662  EOF Line 799  EOF
799          return 0          return 0
800      else      else
801          echo          echo
802          echo "ERROR: failed to compile comparison code -- please specify"          echo "ERROR: failed to compile comparison code -- please specify"
803          echo "  a C compiler using the CC environment variable."          echo "  a C compiler using the CC environment variable."
804          exit 1          exit 1
805      fi      fi
# Line 681  formatresults() Line 818  formatresults()
818      printf '%3s' $listPrt      printf '%3s' $listPrt
819  #   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
820  #   printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</'  #   printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</'
821        
822      if [ $xx = '..' ]; then      if [ $xx = '..' ]; then
823          printf ' N/O '          printf ' N/O '
824      elif [ $xx = '--' ]; then      elif [ $xx = '--' ]; then
# Line 697  formatresults() Line 834  formatresults()
834      fi      fi
835      printf '  %s' $nm      printf '  %s' $nm
836      printf '\n'      printf '\n'
837        
838  }  }
839    
840  scandirs()  scandirs()
# Line 712  scandirs() Line 849  scandirs()
849  }  }
850    
851    
852    check_eedata()
853    {
854        # check_eedata size.h eedata
855        if [ $# -eq 2 ] ; then
856          if test -f $1 -a -f $2 ; then
857          sx=`grep "^     & *nSx *=" $1 | sed "s/^     & *nSx *=//" | sed 's/, *$//'`
858          nx=`grep "^ *nTx *=" $2 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
859          if test "x$nx" = x ; then
860            rx=10
861          else
862            rx=`expr $sx % $nx`
863          fi
864          sy=`grep "^     & *nSy *=" $1 | sed "s/^     & *nSy *=//" | sed 's/, *$//'`
865          ny=`grep "^ *nTy *=" $2 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
866          if test "x$ny" = x ; then
867            ry=20
868          else
869            ry=`expr $sy % $ny`
870          fi
871          echo `expr $rx + $ry`
872        else
873          echo '-1'
874          fi
875        else
876          echo '-2'
877        fi
878    
879    }
880    
881  ###############################################################################  ###############################################################################
882    
883    
884  #  Default properties  #  Default properties
885  debug=0  debug=0
886  verbose=1  verbose=1
 clean=0  
887    
888  IEEE=true  IEEE=true
889  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
# Line 727  fi Line 892  fi
892  GSL=f  GSL=f
893    
894  CLEANUP=f  CLEANUP=f
895    NORUN=f
896  QUICK=f  QUICK=f
897    NOMAKE=f
898  NOGENMAKE=f  NOGENMAKE=f
899  NOCLEAN=f  NOCLEAN=f
900  NODEPEND=f  NODEPEND=f
901  POSTCLEAN=f  POSTCLEAN=0
902    
903  BASH=  BASH=
904  OPTFILE=NONE  OPTFILE=NONE
# Line 742  MPACKDIR="../tools/mpack-1.6" Line 909  MPACKDIR="../tools/mpack-1.6"
909  HAVE_MPACK=  HAVE_MPACK=
910  MPACK=  MPACK=
911  COMMAND=  COMMAND=
912    MKDEPEND=
913  if test "x$MAKE" = x ; then  if test "x$MAKE" = x ; then
914      MAKE=make      MAKE=make
915  fi  fi
# Line 749  if test "x$CC" = x ; then Line 917  if test "x$CC" = x ; then
917      CC=cc      CC=cc
918  fi  fi
919  JOBS=  JOBS=
920  MPI=f  MPI=0
921    MPI_MFILE=
922  MULTI_THREAD=f  MULTI_THREAD=f
923  OUTDIR=  OUTDIR=
924  DELDIR=  DELDIR=
925    USE_R4=
926    
927  ADM=  ADM=
928    OADM=
929    
930  # list of pTracers to check for monitor output  # list of pTracers to check for monitor output
931  PTRACERS_NUM="1 2 3 4 5"  PTRACERS_NUM="1 2 3 4 5"
932    
933  MATCH_CRIT=13  MATCH_CRIT=10
934    
935  printf "parsing options...  "  printf "parsing options...  "
936    
# Line 774  for ac_option ; do Line 945  for ac_option ; do
945      fi      fi
946    
947      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
948        
949      case $ac_option in      case $ac_option in
950                    
951          -help | --help | -h | --h)          -help | --help | -h | --h) usage ;;
952              usage ;;  
953                    -optfile | --optfile | -of | --of) ac_prev=OPTFILE ;;
954          -optfile | --optfile | -of | --of)          -optfile=* | --optfile=* | -of=* | --of=*) OPTFILE=$ac_optarg ;;
955              ac_prev=OPTFILE ;;  
956          -optfile=* | --optfile=* | -of=* | --of=*)          -addr | --addr | -a | --a) ac_prev=ADDRESSES ;;
957              OPTFILE=$ac_optarg ;;          -addr=* | --addr=* | -a=* | --a=*) ADDRESSES=$ac_optarg ;;
958                    -mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;;
959          -addr | --addr | -a | --a)          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;;
960              ac_prev=ADDRESSES ;;  
961          -addr=* | --addr=*)          -tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;;
962              ADDRESSES=$ac_optarg ;;          -tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;;
963          -mpackdir | --mpackdir | -mpd | --mpd)          -skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;;
964              ac_prev=MPACKDIR ;;          -skipdir=* | --skipdir=* | -skd=* | --skd=*) SKIPDIRS=$ac_optarg ;;
965          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*)  
966              MPACKDIR=$ac_optarg ;;          -bash | --bash | -b | --b) ac_prev=BASH ;;
967            -bash=* | --bash=* | -b=* | --b=*) BASH=$ac_optarg ;;
968          -tdir | --tdir | -t | --t)  
969              ac_prev=TESTDIRS ;;          -command | --command | -c | --c) ac_prev=COMMAND ;;
970          -tdir=* | --tdir=*)          -command=* | --command=* | -c=* | --c=*) COMMAND=$ac_optarg ;;
971              TESTDIRS=$ac_optarg ;;  
972            -makedepend | --makedepend | -md | --md) ac_prev=MKDEPEND ;;
973          -skipdir | --skipdir | -skd | --skd)          -makedepend=* | --makedepend=* | -md=* | --md=*) MKDEPEND=$ac_optarg ;;
974              ac_prev=SKIPDIRS ;;  
975          -skipdir=* | --skipdir=*)          -make | --make | -m | --m) ac_prev=MAKE ;;
976              SKIPDIRS=$ac_optarg ;;          -make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;;
977    
978          -bash | --bash | -b | --b)          -odir | --odir) ac_prev=OUTDIR ;;
979              ac_prev=BASH ;;          -odir=* | --odir=*) OUTDIR=$ac_optarg ;;
980          -bash=* | --bash=*)  
981              BASH=$ac_optarg ;;          -ptracers | --ptracers | -ptr | --ptr) ac_prev=PTRACERS_NUM ;;
982            -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 ;;  
983    
984          -match | --match ) ac_prev=MATCH_CRIT ;;          -match | --match ) ac_prev=MATCH_CRIT ;;
985          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;
986    
987          -j) ac_prev=JOBS ;;          -j | --j) ac_prev=JOBS ;;
988          -j=*) JOBS=$ac_optarg ;;          -j=* | --j=*) JOBS=$ac_optarg ;;
   
         -clean | --clean)  
             CLEANUP=t ; DELDIR=t ;;  
989    
990          -quick | --quick | -q | --q)          -clean | --clean) CLEANUP=t ; DELDIR=t ;;
             QUICK=t ;;  
         -nogenmake | --nogenmake | -ng | --ng)  
             NOGENMAKE=t ;;  
         -noclean | --noclean | -nc | --nc)  
             NOCLEAN=t ;;  
         -nodepend | --nodepend | -nd | --nd)  
             NODEPEND=t ;;  
991    
992          -postclean | --postclean | -pc | --pc)          -norun | --norun | -nr | --nr) NORUN=t ;;
993              POSTCLEAN=t ;;          -runonly | --runonly | -ro | --ro) QUICK=t ; NOMAKE=t ;;
994            -quick | --quick | -q | --q) QUICK=t ;;
995            -nogenmake | --nogenmake | -ng | --ng) NOGENMAKE=t ;;
996            -noclean | --noclean | -nc | --nc) NOCLEAN=t ;;
997            -nodepend | --nodepend | -nd | --nd) NODEPEND=t ;;
998    
999            -postclean | --postclean | -pc | --pc) POSTCLEAN=2 ;;
1000            -deloutp | --deloutp | -do | --do) POSTCLEAN=1 ;;
1001    
1002            -mpi | --mpi) MPI=2 ;;
1003            -MPI | --MPI) ac_prev=MPI ;;
1004            -MPI=* | --MPI=*) MPI=$ac_optarg ;;
1005    
1006          -mpi) MPI=t ;;          -mfile | --mfile | -mf | --mf) ac_prev=MPI_MFILE ;;
1007            -mfile=* | --mfile=* | -mf=* | --mf=*) MPI_MFILE=$ac_optarg ;;
1008    
1009          -mth) MULTI_THREAD=t ;;          -mth) MULTI_THREAD=t ;;
1010    
1011          -adm | -ad) ADM=t ;;          -adm | -ad) ADM=t ;;
1012            -oad) OADM=t; NODEPEND=t ;;
1013    
1014          -ieee) IEEE=true ;;          -ieee) IEEE=true ;;
1015          -noieee) IEEE= ;;          -noieee) IEEE= ;;
1016          -gsl) GSL=t ;;          -gsl) GSL=t ;;
1017    
1018          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
1019          -debug) debug=1 ;;          -debug) debug=1 ;;
# Line 866  for ac_option ; do Line 1021  for ac_option ; do
1021    
1022          -deldir | -dd) DELDIR=t ;;          -deldir | -dd) DELDIR=t ;;
1023    
1024          -ts) TS=t;;          -use_r4|-ur4) USE_R4=t ;;
1025    
1026            -ts) TS=t;;
1027          -papis) PAPIS=t;;          -papis) PAPIS=t;;
   
1028          -pcls) PCL=t;;          -pcls) PCL=t;;
1029    
1030          -*)          -*) echo "Error: unrecognized option: "$ac_option
1031              echo "Error: unrecognized option: "$ac_option              usage ;;
1032              usage          *)  echo "Error: unrecognized argument: "$ac_option
1033              ;;              usage ;;
1034            
         *)  
             echo "Error: unrecognized argument: "$ac_option  
             usage  
             ;;  
           
1035       esac       esac
1036        
1037  done  done
1038    
1039  if test "x$QUICK" = xt ; then  if test "x$QUICK" = xt ; then
# Line 892  if test "x$QUICK" = xt ; then Line 1042  if test "x$QUICK" = xt ; then
1042      NODEPEND=t      NODEPEND=t
1043  fi  fi
1044    
1045    #- check length of MPI machine file:
1046    if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then
1047        if test -r $MPI_MFILE ; then
1048            nl=`wc -l $MPI_MFILE | awk '{print $1}'`
1049            if [ $nl -lt $MPI ] ; then
1050              echo "Error: need at least $MPI nodes (currently only $nl) in MPI_MFILE=$MPI_FILE"
1051              usage
1052            fi
1053            if [ $verbose -gt 1 ]; then
1054                echo " MPI_MFILE=$MPI_MFILE : $nl procs for MPI=$MPI run"
1055            fi
1056        else
1057              echo "Error: cannot access MPI_MFILE=$MPI_FILE"
1058              usage
1059        fi
1060    fi
1061    
1062  #- setting for forward or ADM testing  #- setting for forward or ADM testing
1063  if test "x$ADM" = xt ; then  if test "x$ADM" = xt ; then
1064      code_dir=code_ad      code_dir=code_ad
1065      inputdir=input_ad      inputdir=input_ad
1066      ref_outp="output_adm.txt"      ref_outp="output_adm.txt"
1067      EXECUTABLE="mitgcmuv_ad"      EXECUTABLE="mitgcmuv_ad"
1068    elif test "x$OADM" = xt ; then
1069        code_dir=code_oad
1070        inputdir=input_oad
1071        ref_outp="output_oadm.txt"
1072        EXECUTABLE="mitgcmuv_ad"
1073  else  else
1074      code_dir=code      code_dir=code
1075      inputdir=input      inputdir=input
# Line 905  else Line 1077  else
1077      EXECUTABLE="mitgcmuv"      EXECUTABLE="mitgcmuv"
1078  fi  fi
1079    
1080    xx=`echo $TESTDIRS | awk '{print $1}'`
1081  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
1082      LIST=`scandirs results/$ref_outp`      LIST=`scandirs results/$ref_outp`
1083    elif test $xx = 'start_from' ; then
1084        xx=`echo $TESTDIRS | awk '{print $2}'`
1085        LIST=`scandirs results/$ref_outp | sed -n "/$xx/,$ p"`
1086  else  else
1087      #- expand group of experiments:      #- expand group of experiments:
1088      LIST=" "      LIST=" "
# Line 921  else Line 1097  else
1097                   LIST=${LIST}" "`ls | grep 'tutorial_'` ;;                   LIST=${LIST}" "`ls | grep 'tutorial_'` ;;
1098          *)       LIST=${LIST}" "$xx ;;          *)       LIST=${LIST}" "$xx ;;
1099        esac        esac
1100      done      done
1101  fi  fi
1102  #echo 'LIST='${LIST}'<'  #echo 'LIST='${LIST}'<'
1103  #- skip dirs, remove duplicate and non-directory:  #- skip dirs, remove duplicate and non-directory:
# Line 942  do Line 1118  do
1118          else count=1 ; echo "" ;  echo -n " skip: \"$xx\""          else count=1 ; echo "" ;  echo -n " skip: \"$xx\""
1119          fi          fi
1120      fi      fi
1121  done  done
1122  if test $count = 1 ; then echo "" ; echo -n " ... " ; fi  if test $count = 1 ; then echo "" ; echo -n " ... " ; fi
1123  #echo 'TESTDIRS='${TESTDIRS}'<'  #echo 'TESTDIRS='${TESTDIRS}'<'
1124    
# Line 950  if test "x$OPTFILE" = xNONE -a "x$MITGCM Line 1126  if test "x$OPTFILE" = xNONE -a "x$MITGCM
1126      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
1127  fi  fi
1128    
1129    LOC_MFILE='tr_mpi_mfile'
1130    RUNLOG="run.tr_log"
1131  OUTPUTFILE=$ref_outp  OUTPUTFILE=$ref_outp
1132  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
1133      COMMAND="./$EXECUTABLE > $OUTPUTFILE"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
1134  fi  fi
1135  if test "x$MPI" = xt ; then  if test "x$MPI" != x0 ; then
1136      OUTPUTFILE="STDOUT.0000"      OUTPUTFILE="STDOUT.0000"
1137  fi  fi
1138    
# Line 964  echo "OK (COMMAND= $COMMAND )" Line 1142  echo "OK (COMMAND= $COMMAND )"
1142  #  (use default or load experiment-specific list from file "tr_checklist")  #  (use default or load experiment-specific list from file "tr_checklist")
1143  # content : 1rst = main variable used to decide if it pass or FAIL  # content : 1rst = main variable used to decide if it pass or FAIL
1144  #         others = number of matching digits to be printed in summary.txt  #         others = number of matching digits to be printed in summary.txt
1145  if test "x$ADM" = x ; then  if test "x$ADM" = x -a "x$OADM" = x; then
1146      DEF_CHECK_LIST='PS PS T+ S+ U+ V+ pt1+ pt2+ pt3+ pt4+ pt5+'      DEF_CHECK_LIST='PS PS T+ S+ U+ V+ pt1+ pt2+ pt3+ pt4+ pt5+'
1147      EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..'      EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..'
1148      LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`      LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`
# Line 977  else Line 1155  else
1155  fi  fi
1156    
1157  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
1158  createcodelet  if test -x tr_cmpnum ; then
1159        echo "skipping comparison code build"
1160    else
1161        createcodelet
1162    fi
1163    
1164  #  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)
1165  if test "x$ADDRESSES" = x ; then  if test "x$ADDRESSES" = x ; then
# Line 988  fi Line 1170  fi
1170    
1171  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
1172  CMDLINE=$0  CMDLINE=$0
1173  for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done  for xx in "$@" ; do nw=`echo $xx | wc -w`
1174        if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"
1175                            else CMDLINE="$CMDLINE '$xx'" ; fi
1176    done
1177    #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done
1178  MACH=`hostname`  MACH=`hostname`
1179  UNAMEA=`uname -a`  UNAMEA=`uname -a`
1180  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
1181  BASE="tr_"$MACH"_"$DATE"_"  BASE="tr_"$MACH"_"$DATE"_"
1182  if test "x$OUTDIR" != x ; then  if test "x$OUTDIR" != x ; then
1183      BASE="tr_"$OUTDIR"_"$DATE"_"      BASE="tr_"$OUTDIR"_"$DATE"_"
1184    else
1185        short_name=`hostname | sed 's/\..*$//'`
1186        BASE="tr_"$short_name"_"$DATE"_"
1187  fi  fi
1188  DNUM=0  DNUM=0
1189  DRESULTS="$BASE$DNUM"  DRESULTS="$BASE$DNUM"
# Line 1036  if test "x$OPTFILE" != xNONE ; then Line 1225  if test "x$OPTFILE" != xNONE ; then
1225      fi      fi
1226  else  else
1227      echo >> $SUMMARY      echo >> $SUMMARY
1228      echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY      echo "No \"OPTFILE\" was specified ; genmake2 found and uses:" >> $SUMMARY
1229      echo "   so the genmake default will be used." >> $SUMMARY      #-note: to be filled later after 1rst run
1230  fi  fi
1231  echo  echo
1232  echo >> $SUMMARY  echo >> $SUMMARY
1233  if test "x$ADM" = x ; then  if test "x$ADM" = x -a "x$OADM" = x; then
1234      if [ $MATCH_CRIT -lt 10 ] ;      if [ $MATCH_CRIT -lt 10 ] ;
1235      then line_0="default  "$MATCH_CRIT ;      then line_0="default  "$MATCH_CRIT ;
1236      else line_0="default "$MATCH_CRIT ; fi      else line_0="default "$MATCH_CRIT ; fi
1237         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"
 #   line_0="            ----T-----  ----S-----  ----U-----  ----V-----"  
1238      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"
1239      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  ."
1240      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 1067  if test "x$ADM" = x ; then Line 1255  if test "x$ADM" = x ; then
1255  else  else
1256      echo "ADJOINT=true" >> $SUMMARY      echo "ADJOINT=true" >> $SUMMARY
1257      echo >> $SUMMARY      echo >> $SUMMARY
1258      if [ $MATCH_CRIT -lt 10 ] ;      if [ $MATCH_CRIT -lt 10 ] ;
1259      then line_0="default     "$MATCH_CRIT ;      then line_0="default     "$MATCH_CRIT ;
1260      else line_0="default    "$MATCH_CRIT ; fi      else line_0="default    "$MATCH_CRIT ; fi
1261      echo "$line_0" | tee -a $SUMMARY      echo "$line_0" | tee -a $SUMMARY
1262      cat << EOF | tee -a $SUMMARY      cat << EOF | tee -a $SUMMARY
# Line 1079  N n k u  s  a Line 1267  N n k u  s  a
1267    
1268  EOF  EOF
1269  fi  fi
1270    echo "-------------------------------------------------------------------------------"
1271    
1272  #  ...and each test directory...  #  ...and each test directory...
1273  for dir in $TESTDIRS ; do  for dir in $TESTDIRS ; do
1274        
1275      # set builddir & rundir:      # set builddir & rundir:
1276      builddir="build"      builddir="build"
1277      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1278      rundir="run"      rundir="run"
1279        pfxdir="tr_$rundir"
1280      if test ! -d $dir/$rundir ; then      if test ! -d $dir/$rundir ; then
1281          rundir=$builddir          rundir=$builddir
1282      fi      fi
# Line 1095  for dir in $TESTDIRS ; do Line 1285  for dir in $TESTDIRS ; do
1285    
1286      #  Cleanup only!      #  Cleanup only!
1287      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
1288          if test -r $BUILD_DIR/Makefile ; then          echo -n '  --- dir:' $BUILD_DIR ': '
1289              echo '  ------  clean dir:' $dir/$builddir          makeclean $BUILD_DIR
1290              ( cd $BUILD_DIR ; make CLEAN )          (   cd $BUILD_DIR
1291          fi              rm -f $EXECUTABLE *.bak
1292                rm -f genmake_state genmake_*optfile genmake.log
1293                rm -f SIZE.h.mpi genmake.tr_log make.tr_log
1294            )
1295          if test -d $dir/$rundir/CVS ; then          if test -d $dir/$rundir/CVS ; then
1296              echo '  ------  clean dir:' $dir/$rundir              echo -n '  --- dir:' $dir/$rundir ': '
1297              run_clean $dir/$rundir              run_clean $dir/$rundir
1298          fi          fi
1299          (          trdir=`( cd $dir ; find . -type d -name "$pfxdir.*" -print | sed 's/^.\///')`
1300              cd $dir          ttd=`echo $trdir | wc -w`
1301              rm -rf tr_run.*          if test $ttd != 0 ; then
1302          )              echo '  --- rm dir:' $trdir
1303                ( cd $dir ; rm -rf $trdir )
1304            fi
1305          continue          continue
1306      fi      fi
1307    
1308      #  Verify that the testdir exists and contains previous      #  Verify that the testdir exists and contains previous
1309      #  results in the correct location--or skip this directory!      #  results in the correct location--or skip this directory!
1310      fout=$dir"/results/"$ref_outp      fout=$dir"/results/"$ref_outp
1311      if test ! -r $fout ; then      if test ! -r $fout ; then
# Line 1120  for dir in $TESTDIRS ; do Line 1315  for dir in $TESTDIRS ; do
1315    
1316      # Check for specific files for particular type of run      # Check for specific files for particular type of run
1317    
1318      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then      if test "x$MPI" != "x0" ; then
1319          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"          if test -r $CODE_DIR"/SIZE.h_mpi" ; then
1320          continue              #- create new SIZE.h with no more than '$MPI' Procs
1321                mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI
1322                LOC_NPROC=$?
1323                (   cd $BUILD_DIR
1324                    if test -r SIZE.h.mpi ; then
1325                        cmp tr_size.mpi SIZE.h.mpi > /dev/null 2>&1 ; RETVAL=$?
1326                    else RETVAL=1
1327                    fi
1328                    if test "x$RETVAL" = x0 ; then
1329                        rm -f tr_size.mpi
1330                    else
1331                        rm -f SIZE.h.mpi ; mv tr_size.mpi SIZE.h.mpi
1332                    fi
1333                )
1334            else
1335                echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1336                continue
1337            fi
1338            if test "x$MPI_MFILE" != x ; then
1339                #- create new MPI machine-file with the right number of Procs
1340                rm -f $LOC_MFILE
1341                cat $MPI_MFILE | sort | uniq | head -$LOC_NPROC > $LOC_MFILE
1342                nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1343                if [ $nl -lt $LOC_NPROC ] ; then
1344                    rm -f $LOC_MFILE
1345                    cat $MPI_MFILE | head -$LOC_NPROC > $LOC_MFILE
1346                    #sed -n "1,$LOC_NPROC p" $MPI_MFILE > $LOC_MFILE
1347                fi
1348                if [ $verbose -gt 1 ]; then
1349                    nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1350                    echo " new LOC_MFILE=$LOC_MFILE : $nl procs for LOC_NPROC=$LOC_NPROC"
1351                fi
1352            fi
1353      fi      fi
1354      if test ! -r $dir"/input/eedata.mth" -a "x$MULTI_THREAD" = "xt" ; then      if test ! -r $dir"/input/eedata.mth" -a "x$MULTI_THREAD" = "xt" ; then
1355          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"
1356          continue          continue
1357      fi      fi
1358        if test "x$MPI" != "x0" -a "x$MULTI_THREAD" = "xt" ; then
1359            retv=`check_eedata $BUILD_DIR"/SIZE.h.mpi" $dir"/input/eedata.mth"`
1360            if test $retv != 0 ; then
1361                echo "input/eedata.mth tiling misfit -- skipping $dir"
1362                continue
1363            fi
1364        fi
1365    
1366      #  Check whether there are "extra runs" for this testdir      #  Check whether there are "extra runs" for this testdir
1367      extra_runs=      extra_runs=
1368      ex_run_dirs=`( cd $dir ; echo $inputdir.* )`      if test "x$NORUN" = xf ; then
1369            ex_run_dirs=`( cd $dir ; echo $inputdir.* )`
1370        fi
1371      #echo "ex_run_dirs='$ex_run_dirs'"      #echo "ex_run_dirs='$ex_run_dirs'"
1372      for exd in $ex_run_dirs ; do      for exd in $ex_run_dirs ; do
1373          name=`echo $exd | sed -e "s/$inputdir\.//"`          name=`echo $exd | sed -e "s/$inputdir\.//"`
1374          refExOut=`echo $ref_outp | sed "s/\./.${name}./"`          refExOut=`echo $ref_outp | sed "s/\./.${name}./"`
1375          outf="$dir/results/$refExOut"          outf="$dir/results/$refExOut"
1376          if test -f $outf -a -r $outf ; then          if test -f $outf -a -r $outf ; then
1377              if test "x$MULTI_THREAD" = "xt" ; then            if test "x$MULTI_THREAD" = "xt" ; then
1378                  if test -r $dir"/"$exd"/eedata.mth" ; then              if test -r $dir"/"$exd"/eedata.mth" ; then
1379                  if test "x$MPI" = "x0" ; then
1380                    extra_runs="$extra_runs $name"
1381                  else
1382                    retv=`check_eedata $BUILD_DIR"/SIZE.h.mpi" $dir"/"$exd"/eedata.mth"`
1383                    if test $retv = 0 ; then
1384                      extra_runs="$extra_runs $name"                      extra_runs="$extra_runs $name"
1385                  #else echo $dir"/"$exd"/eedata.mth: not found"                  else
1386                        echo $exd"/eedata.mth tiling misfit -- skipping $dir"
1387                  fi                  fi
1388              else                fi
1389                  extra_runs="$extra_runs $name"              #else echo $dir"/"$exd"/eedata.mth: not found"
1390              fi              fi
1391              else
1392                extra_runs="$extra_runs $name"
1393              fi
1394          fi          fi
1395      done      done
1396    
     echo "-------------------------------------------------------------------------------"  
1397      echo      echo
1398      if test "x$extra_runs" = "x" ; then      if test "x$extra_runs" = "x" ; then
1399         echo "Experiment:  $dir"         echo "Experiment:  $dir"
1400      else      else
1401         echo "Experiment:  $dir ; extra_runs=$extra_runs"         echo "Experiment:  $dir ; extra_runs=$extra_runs"
# Line 1161  for dir in $TESTDIRS ; do Line 1405  for dir in $TESTDIRS ; do
1405      results=$EMPTY_RESULTS      results=$EMPTY_RESULTS
1406    
1407      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir for each OPTFILE/tdir combination
1408      rel_CDIR=$DRESULTS"/"$dir      locDIR=$DRESULTS"/"$dir
1409      mkdir $rel_CDIR      mkdir $locDIR
1410      CDIR=`pwd`"/$rel_CDIR"      CDIR=`pwd`"/$locDIR"
1411        
1412      if test "x$CLEANUP" = xt ; then      if test "x$NORUN" = xt ; then
1413          echo '====>>> this is to check that we never go through this part <<< ==='              run=N
1414          makeclean $dir/$builddir \          genmakemodel $dir/$builddir && genmake=Y \
1415              && run_clean $dir/$rundir              && makeclean $dir/$builddir \
1416                && symlink_mpifiles $dir $code_dir $builddir \
1417                && makedependmodel $dir/$builddir && makedepend=Y \
1418                && makemodel $dir/$builddir && make=Y
1419      else      else
1420          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
1421              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
             && run_clean $dir/$rundir \  
1422              && symlink_mpifiles $dir $code_dir $builddir \              && symlink_mpifiles $dir $code_dir $builddir \
1423              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
1424              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
1425              && linkdata $dir/$rundir $inputdir input \              && run_clean $dir/$rundir \
1426                && linkdata $dir/$rundir $inputdir \
1427              && runmodel $dir/$rundir && run=Y \              && runmodel $dir/$rundir && run=Y \
1428              && results=`testoutput_run $dir $rundir $ref_outp`              && results=`testoutput_run $dir $rundir $ref_outp`
1429      fi      fi
1430            #echo "results='$results'"
1431      echo  
1432          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1433          echo          echo 1>&2
1434          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
1435          touch $CDIR"/summary.txt"          touch $locDIR"/summary.txt"
1436          echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $CDIR"/summary.txt"          echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
1437          echo "MACH='$MACH'" >> $CDIR"/summary.txt"          echo "tdir='$dir'" >> $locDIR"/summary.txt"
         echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
         echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
         echo "tdir='$dir'" >> $CDIR"/summary.txt"  
1438          if test "x$ADM" = xt ; then          if test "x$ADM" = xt ; then
1439              head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt"              head -1 $dir/$builddir/taf_ad.log >> $locDIR"/summary.txt"
1440                nerr=`grep -c 'TAF *.* ERROR ' $dir/$builddir/taf_ad.log`
1441                nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' $dir/$builddir/taf_ad.log`
1442                echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \
1443                                    >> $locDIR"/summary.txt"
1444              grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \              grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \
1445                                  >> $CDIR"/summary.txt"                                  >> $locDIR"/summary.txt"
1446          fi          fi
1447    
1448          for ex in $extra_runs ; do          for ex in $extra_runs ; do
# Line 1203  for dir in $TESTDIRS ; do Line 1451  for dir in $TESTDIRS ; do
1451              #  reference output file              #  reference output file
1452              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`
1453              #  Create an output dir for each OPTFILE/tdir.ex combination              #  Create an output dir for each OPTFILE/tdir.ex combination
1454              rel_CDIR=$DRESULTS"/"$dir"."$ex              locDIR=$DRESULTS"/"$dir"."$ex
1455              mkdir $rel_CDIR              mkdir $locDIR
1456              CDIR=`pwd`"/$rel_CDIR"              CDIR=`pwd`"/$locDIR"
1457              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"              test ! -e "$dir/$pfxdir.$ex" && mkdir "$dir/$pfxdir.$ex"
1458              run_clean $dir/tr_run.$ex              run_clean $dir/$pfxdir.$ex
1459              linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir input              linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir
1460              runmodel $dir/tr_run.$ex && run=Y \              runmodel $dir/$pfxdir.$ex && run=Y \
1461              && results=`testoutput_run $dir tr_run.$ex $refExOut`              && results=`testoutput_run $dir $pfxdir.$ex $refExOut`
1462              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1463              fres="$fres.$ex"              fres="$fres.$ex"
1464              echo              echo 1>&2
1465              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
1466              touch $CDIR"/summary.txt"              touch $locDIR"/summary.txt"
1467              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $CDIR"/summary.txt"              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
1468              echo "MACH='$MACH'" >> $CDIR"/summary.txt"              echo "tdir='$dir.$ex'" >> $locDIR"/summary.txt"
             echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
             echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
             echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt"  
1469              if test "x$ADM" = xt ; then              if test "x$ADM" = xt ; then
1470                  head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt"                  grep -A3 'Seconds in section "ALL' $dir/$pfxdir.$ex/$OUTPUTFILE \
1471                  grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \                                     >> $locDIR"/summary.txt"
                                    >> $CDIR"/summary.txt"  
1472              fi              fi
1473              if test "x$POSTCLEAN" = xt ; then              if test "x$POSTCLEAN" = x2 ; then
1474                  run_clean $dir/tr_run.$ex                  run_clean $dir/$pfxdir.$ex
1475              fi              fi
1476          done          done
1477    
1478        if test -f $DRESULTS"/"genmake_state ; then : ; else
1479            if test -f $dir/$builddir/Makefile ; then
1480                mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
1481                echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state
1482                sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state
1483                echo " $mkOpt" >> $DRESULTS/genmake_state
1484                if test "x$OPTFILE" = xNONE ; then
1485                    eval $mkOpt
1486                    sed "/^No \"OPTFILE\" was specified ; genmake2/a\  OPTFILE=${OPTFILE}"\
1487                            $SUMMARY > tr_0.tmp_log
1488                    RETVAL=$?
1489                    if test "x$RETVAL" = x0 ; then rm -f $SUMMARY
1490                            cp tr_0.tmp_log $SUMMARY
1491                    else rm -f tr_0.tmp_log
1492                    fi
1493                fi
1494                gmkLog=$dir/$builddir/genmake.log
1495                grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1
1496                RETVAL=$?
1497                if test "x$RETVAL" = x0 ; then
1498                    echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state
1499                    sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \
1500                           | grep -v '^... compiler version ' > tr_1.tmp_log
1501                    sed -n '1,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \
1502                            >> $DRESULTS/genmake_state
1503                    rm -f tr_1.tmp_log
1504                fi
1505            fi
1506        fi
1507      #postclean $dir/$builddir      #postclean $dir/$builddir
1508      if test "x$POSTCLEAN" = xt ; then      if test "x$POSTCLEAN" = x2 ; then
1509          makeclean $dir/$builddir \          makeclean $dir/$builddir \
1510              && run_clean $dir/$rundir              && run_clean $dir/$rundir
1511      fi      fi
1512            if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then rm -f $LOC_MFILE ; fi
1513    
1514      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
1515        
1516  done  done
1517    
1518  printf "Start time:  " >> $SUMMARY  printf "Start time:  " >> $SUMMARY
# Line 1267  else Line 1541  else
1541              echo "An email containing results was sent to the following addresses:"              echo "An email containing results was sent to the following addresses:"
1542              echo "  \"$ADDRESSES\""              echo "  \"$ADDRESSES\""
1543              echo              echo
1544                test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
1545                test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
1546          fi          fi
         test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"  
         test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"  
1547      fi      fi
1548  fi  fi
1549    
1550  rm -f tr_cmpnum.c tr_cmpnum  if test "x$QUICK" = xf -a "x$NORUN" = xf ; then
1551        rm -f tr_cmpnum.c tr_cmpnum
1552    fi
1553    
1554  if test "x$CLEANUP" != xt ; then  if test "x$CLEANUP" != xt ; then
1555      cat $SUMMARY | sed 's/ \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \. //'      cat $SUMMARY | sed 's/ \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \. //'

Legend:
Removed from v.1.117  
changed lines
  Added in v.1.157

  ViewVC Help
Powered by ViewVC 1.1.22