/[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.140 by jmc, Fri Apr 30 13:07:19 2010 UTC revision 1.170 by mlosch, Thu Dec 22 12:55:05 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 "  (-use_r4|-ur4)           if allowed, use real*4 type for '_RS' variable"      echo "  (-use_r4|-ur4)           if allowed, use real*4 type for '_RS' variable"
23      echo "  (-optfile|-of) STRING    list of optfiles to use"      echo "  (-optfile|-of) STRING    list of optfiles to use"
# Line 25  usage() Line 28  usage()
28      echo "  (-tdir|-t) 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 "                             (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"      echo "  (-skipdir|-skd) STRING   list of exp. dirs to skip"
34      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
35      echo "  (-bash|-b) STRING        preferred location of a \"bash\" or"      echo "  (-bash|-b) STRING        preferred location of a \"bash\" or"
# Line 33  usage() Line 38  usage()
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|-c) STRING     command to run"      echo "  (-command|-c) STRING     command to run"
41        echo "  (-makedepend|-md) STRING command to use for \"makedepend\""
42      echo "  (-make|-m) 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 "  (-ptracers|-ptr) 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 "  (-ef) STRING             used as genmake2 \"-extra_flag\" argument"
52        echo "  (-clean)                 *ONLY* run \"make CLEAN\" & clean run-dir"
53      echo "  (-norun|-nr)             skip the \"runmodel\" stage (stop after make)"      echo "  (-norun|-nr)             skip the \"runmodel\" stage (stop after make)"
54        echo "  (-obj)                   only produces objects (=norun & no executable)"
55      echo "  (-runonly|-ro)           *ONLY* run stage (=\"-quick\" without make)"      echo "  (-runonly|-ro)           *ONLY* run stage (=\"-quick\" without make)"
56      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
57      echo "  (-nogenmake|-ng)         skip the genmake stage"      echo "  (-nogenmake|-ng)         skip the genmake stage"
58      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-noclean|-nc)           skip the \"make clean\" stage"
59      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
60        echo "  (-postclean|-pc)         after each exp. test, clean build-dir & run-dir"
61        echo "  (-deloutp|-do)           delete output files after successful run"
62      echo "  (-deldir|-dd)            on success, delete the output directory"      echo "  (-deldir|-dd)            on success, delete the output directory"
63      echo "  (-ts)                    provide timing information per timestep"      echo "  (-ts)                    provide timing information per timestep"
64      echo "  (-papis)                 provide MFlop/s per timestep using PAPI"      echo "  (-papis)                 provide MFlop/s per timestep using PAPI"
# Line 231  testoutput_run() Line 241  testoutput_run()
241            listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`            listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`
242          fi          fi
243          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
244          echo "listVar='$listVar'" > $locDIR"/summary.txt"          echo "listVar='$listVar'" >> $locDIR"/summary.txt"
245            #---
246          allargs=""          allargs=""
247          for xx in $listVar          for xx in $listVar
248          do          do
# Line 240  testoutput_run() Line 251  testoutput_run()
251                    then echo testoutput_run: testoutput_var $1 cg2d_init_res 1>&2 ; fi                    then echo testoutput_run: testoutput_var $1 cg2d_init_res 1>&2 ; fi
252                    testoutput_var $1 "cg2d_init_res" "Press. Solver (cg2d)" $2 $3; yy=$?                    testoutput_var $1 "cg2d_init_res" "Press. Solver (cg2d)" $2 $3; yy=$?
253                    if [ $debug -gt 0 ] ; then echo testoutput_run: cg2dres=$yy 1>&2 ; fi ;;                    if [ $debug -gt 0 ] ; then echo testoutput_run: cg2dres=$yy 1>&2 ; fi ;;
254            'Cost') testoutput_var $1 "ADM  precision_derivative_cost" "ADM Cost" $2 $3; yy=$? ;;            'Cost') testoutput_var $1 "ADM  ref_cost_function" "ADM CostFct" $2 $3; yy=$? ;;
255            'Grad') testoutput_var $1 "ADM  precision_derivative_grad" "ADM Grad" $2 $3; yy=$? ;;           'AdGrd') testoutput_var $1 "ADM  adjoint_gradient"  "ADM Ad Grad" $2 $3; yy=$? ;;
256             'FDGrd') testoutput_var $1 "ADM  finite-diff_grad"  "ADM FD Grad" $2 $3; yy=$? ;;
257             'Tmn') testoutput_var $1 "dynstat_theta_min"  "Theta minimum"  $2 $3; yy=$? ;;             'Tmn') testoutput_var $1 "dynstat_theta_min"  "Theta minimum"  $2 $3; yy=$? ;;
258             'Tmx') testoutput_var $1 "dynstat_theta_max"  "Theta maximum"  $2 $3; yy=$? ;;             'Tmx') testoutput_var $1 "dynstat_theta_max"  "Theta maximum"  $2 $3; yy=$? ;;
259             'Tav') testoutput_var $1 "dynstat_theta_mean" "Theta mean"     $2 $3; yy=$? ;;             'Tav') testoutput_var $1 "dynstat_theta_mean" "Theta mean"     $2 $3; yy=$? ;;
# Line 278  testoutput_run() Line 290  testoutput_run()
290           'hSImx') testoutput_var $1 "seaice_heff_max"   "SIce Heff max"   $2 $3; yy=$? ;;           'hSImx') testoutput_var $1 "seaice_heff_max"   "SIce Heff max"   $2 $3; yy=$? ;;
291           'hSIav') testoutput_var $1 "seaice_heff_mean"  "SIce Heff mean"  $2 $3; yy=$? ;;           'hSIav') testoutput_var $1 "seaice_heff_mean"  "SIce Heff mean"  $2 $3; yy=$? ;;
292           'hSIsd') testoutput_var $1 "seaice_heff_sd"    "SIce Heff StDv"  $2 $3; yy=$? ;;           'hSIsd') testoutput_var $1 "seaice_heff_sd"    "SIce Heff StDv"  $2 $3; yy=$? ;;
293             'uSImn') testoutput_var $1 "seaice_uice_min"   "SIce Uice min"   $2 $3; yy=$? ;;
294             'uSImx') testoutput_var $1 "seaice_uice_max"   "SIce Uice max"   $2 $3; yy=$? ;;
295             'uSIav') testoutput_var $1 "seaice_uice_mean"  "SIce Uice mean"  $2 $3; yy=$? ;;
296             'uSIsd') testoutput_var $1 "seaice_uice_sd"    "SIce Uice StDv"  $2 $3; yy=$? ;;
297             'vSImn') testoutput_var $1 "seaice_vice_min"   "SIce Vice min"   $2 $3; yy=$? ;;
298             'vSImx') testoutput_var $1 "seaice_vice_max"   "SIce Vice max"   $2 $3; yy=$? ;;
299             'vSIav') testoutput_var $1 "seaice_vice_mean"  "SIce Vice mean"  $2 $3; yy=$? ;;
300             'vSIsd') testoutput_var $1 "seaice_vice_sd"    "SIce Vice StDv"  $2 $3; yy=$? ;;
301          '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=$? ;;
302          '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=$? ;;
303          '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 317  genmakemodel() Line 337  genmakemodel()
337          (          (
338              cd $1;              cd $1;
339              command="$GENMAKE2  -ds -m $MAKE"              command="$GENMAKE2  -ds -m $MAKE"
340                if test "x$MKDEPEND" != x ; then
341                    command="$command -makedepend=$MKDEPEND"
342                fi
343              if test "x$ADM" = xt ; then              if test "x$ADM" = xt ; then
344                  command="$command --mods=../code_ad"                  command="$command --mods=../code_ad"
345              elif test "x$OADM" = xt ; then              elif test "x$OADM" = xt ; then
# Line 327  genmakemodel() Line 350  genmakemodel()
350              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
351                  command="$command -optfile=$OPTFILE"                  command="$command -optfile=$OPTFILE"
352              fi              fi
353              if test "x$IEEE" != x ; then              if test $OptLev = 1 ; then
354                  command="$command -ieee"                  command="$command -ieee"
355                fi
356                if test $OptLev = 0 ; then
357                    command="$command -devel"
358              fi              fi
359              if test "x$GSL" = xt ; then              if test "x$GSL" = xt ; then
360                  command="$command -gsl"                  command="$command -gsl"
361              fi              fi
362              if test "x$MPI" = xt ; then              if test "x$MPI" != x0 ; then
363                  command="$command -mpi"                  command="$command -mpi"
364              fi              fi
365              if test "x$MULTI_THREAD" = xt ; then              if test "x$MULTI_THREAD" = xt ; then
# Line 343  genmakemodel() Line 369  genmakemodel()
369              if test "x$USE_R4" = xt ; then              if test "x$USE_R4" = xt ; then
370                  command="$command -use_r4"                  command="$command -use_r4"
371              fi              fi
372                if test "x$EXTRFLG" != x ; then
373                    command="$command -extra_flag $EXTRFLG"
374                fi
375              if test "x$TS" = xt ; then              if test "x$TS" = xt ; then
376                  command="$command -ts"                  command="$command -ts"
377              fi              fi
# Line 354  genmakemodel() Line 383  genmakemodel()
383              fi              fi
384              fi              fi
385              printf 'genmake ... '              printf 'genmake ... '
386              eval $command > make.log 2>&1              eval $command > genmake.tr_log 2>&1
387              RETVAL=$?              RETVAL=$?
388              #  Reduce the size of the testing emails!              #  Reduce the size of the testing emails!
389              head -100 Makefile > $CDIR/Makefile_head              head -100 Makefile > $CDIR/Makefile_head
390              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
391                  tail make.log                  tail genmake.tr_log
392                  echo "genmakemodel: genmake failed"                  echo "genmakemodel: genmake failed"
393                  cp genmake_* make.log $CDIR                  cp genmake.log genmake_* genmake.tr_log $CDIR
394                  return 1                  return 1
395              else              else
396                  echo "successful"                  echo "successful"
# Line 373  genmakemodel() Line 402  genmakemodel()
402  makeclean()  makeclean()
403  {  {
404      # makeclean directory      # makeclean directory
405        if test "x$NODEPEND" = xf ; then rm -f $1/make.tr_log ; fi
406      if test "x$NOCLEAN" = xt ; then      if test "x$NOCLEAN" = xt ; then
407          echo "make Clean skipped!"          echo "make Clean skipped!"
408      else      else
# Line 381  makeclean() Line 411  makeclean()
411              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi
412              if test -r Makefile ; then              if test -r Makefile ; then
413                  printf 'clean build-dir: make Clean ... '                  printf 'clean build-dir: make Clean ... '
414                  $MAKE Clean >> make.log 2>&1                  $MAKE Clean >> make.tr_log 2>&1
415                  RETVAL=$?                  RETVAL=$?
416                  if test "x$RETVAL" != x0 ; then                  if test "x$RETVAL" != x0 ; then
417                      tail make.log                      tail make.tr_log
418                      echo "makeclean: \"make Clean\" failed"                      echo "makeclean: \"make Clean\" failed"
419                      cp make.log $CDIR"/make.log"                      cp make.tr_log genmake.log genmake.tr_log $CDIR
420                      return 1                      return 1
421                  fi                  fi
422                  echo successful                  echo successful
# Line 412  run_clean() Line 442  run_clean()
442              find . -name "*.data" -exec rm {} \;              find . -name "*.data" -exec rm {} \;
443              find . -name "fort.*" -exec rm {} \;              find . -name "fort.*" -exec rm {} \;
444              find . -type l -exec rm {} \;              find . -type l -exec rm {} \;
445              rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime              #- should remove executable only if sym-link (alredy done above)
446                rm -f $RUNLOG *.txt STD* *diagnostics.log datetime
447              rm -rf mnc_test_*              rm -rf mnc_test_*
448              rm -f *_MIT_CE_000.opt0000 costfunction*0000              rm -f *_MIT_CE_000.opt0000 costfunction*0000
449              echo successful              echo successful
# Line 430  makedependmodel() Line 461  makedependmodel()
461          (          (
462              cd $1;              cd $1;
463              printf 'make depend ... '              printf 'make depend ... '
464              $MAKE depend >> make.log 2>&1              $MAKE depend >> make.tr_log 2>&1
465              RETVAL=$?              RETVAL=$?
466              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
467                  tail make.log                  tail make.tr_log
468                  echo "makedependmodel: make depend failed"                  echo "makedependmodel: make depend failed"
469                  cp make.log $CDIR"/make.log"                  cp make.tr_log genmake.log genmake.tr_log $CDIR
470                  return 1                  return 1
471              else              else
472                  echo successful                  echo successful
# Line 448  makemodel() Line 479  makemodel()
479  {  {
480      # makemodel directory      # makemodel directory
481      (      (
482        mk_fail=0
483      if test "x$NOMAKE" = xt ; then      if test "x$NOMAKE" = xt ; then
484          cd $1;          cd $1;
485          if test -x $EXECUTABLE ; then          if test -x $EXECUTABLE ; then
486              echo "make skipped!"              echo "make skipped!"
487          else          else
488              echo "no executable!"              echo "no executable!"
489              return 2              mk_fail=3
490          fi          fi
491      else      else
492          cd $1;          cd $1;
493          if test -r Makefile ; then          if test -r Makefile ; then
494              printf 'make ... '              printf 'make ... '
495              if test "x$ADM" = xt ; then              $MAKE $TARG >> make.tr_log 2>&1
                 $MAKE adall >> make.log 2>&1  
             elif test "x$OADM" = xt ; then  
                 $MAKE adAll >> make.log 2>&1  
             else  
                 if test "x$JOBS" = x ; then  
                     $MAKE >> make.log 2>&1  
                 else  
                     $MAKE -j $JOBS >> make.log 2>&1  
                 fi  
             fi  
496              RETVAL=$?              RETVAL=$?
497              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
498                  tail make.log                  tail make.tr_log
499                  echo failed                  echo failed
500                  cp make.log $CDIR"/make.log"                  cp genmake.log genmake.tr_log $CDIR
501                    tail -$NBLINES_MKLOG make.tr_log > $CDIR"/make.tr_log_tail"
502                  rm -f $EXECUTABLE                  rm -f $EXECUTABLE
503                  return 1                  mk_fail=1
504              else              else
505                  echo successful                  echo successful
506              fi              fi
507            else
508                echo "no Makefile !"
509                mk_fail=2
510          fi          fi
511      fi      fi
512        if test "x$ADM" = xt -a -f taf_ad.log ; then
513                head -1 taf_ad.log >> $CDIR"/summary.txt"
514                nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log`
515                nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log`
516                echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \
517                                    >> $CDIR"/summary.txt"
518        fi
519        if test $mk_fail != 0 ; then return $mk_fail ; fi
520      )      )
521  }  }
522    
523    mk_mpi_size()
524    {
525        # mk_mpi_size input_file output_file proc_Nb prefer_to_split_X
526        #
527        # make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file)
528        #     for an MPI build with no more than proc_Nb processors ;
529        # return the effective number of processors.
530    
531        inp=$1
532        out=$2
533        np=$3
534        dirX=$4
535        tmp=TTT.$$
536    
537        px=`grep "^     & *nPx *=" $inp | sed "s/^     & *nPx *= *//" | sed 's/, *$//'`
538        py=`grep "^     & *nPy *=" $inp | sed "s/^     & *nPy *= *//" | sed 's/, *$//'`
539        sx=`grep "^     & *nSx *=" $inp | sed "s/^     & *nSx *= *//" | sed 's/, *$//'`
540        sy=`grep "^     & *nSy *=" $inp | sed "s/^     & *nSy *= *//" | sed 's/, *$//'`
541    
542        #- find the largest divisor of input_file proc Nb, but not larger than $np
543        pp=0
544        i=1
545        while [ $i -le $px ] ; do
546          if [ `expr $px % $i` -eq 0 ] ; then
547            j=1
548            while [ $j -le $py ] ; do
549              if [ `expr $py % $j` -eq 0 ] ; then
550                ij=`expr $i \* $j`
551                if [ $ij -gt $pp ] ; then
552                    flag=1
553                elif [ $ij -eq $pp ] ; then
554                    flag=$dirX
555                else
556                    flag=0
557                fi
558                if test $flag = 1 ; then
559                  if [ $ij -le $np ] ; then
560                    ix=$i ; jy=$j ; pp=$ij
561                    #echo "  ix,jy= $ix,$jy"
562                  fi
563                fi
564              fi
565              j=`expr $j + 1`
566            done
567          fi
568          i=`expr $i + 1`
569        done
570    
571        #- create new SIZE.h type file:
572        sx=`expr $sx \* $px / $ix`
573        sy=`expr $sy \* $py / $jy`
574        if [ $verbose -gt 1 ]; then
575            echo " px,py,np= $px,$py,$np : New MPI size: px,py= $ix,$jy : sx,sy= $sx,$sy"
576        fi
577        sed "/^     \& *nPx *=/s/[0-9]*,/$ix,/" $inp > $tmp
578        sed "/^     \& *nPy *=/s/[0-9]*,/$jy,/" $tmp > $out
579        sed "/^     \& *nSx *=/s/[0-9]*,/$sx,/" $out > $tmp
580        sed "/^     \& *nSy *=/s/[0-9]*,/$sy,/" $tmp > $out
581        rm -f $tmp
582        return $pp
583    }
584    
585  symlink_mpifiles()  symlink_mpifiles()
586  {  {
587      # Put special links so that MPI specific files are used      # Put special links so that MPI specific files are used
# Line 494  symlink_mpifiles() Line 590  symlink_mpifiles()
590    
591      dir=$1      dir=$1
592      code_dir=$2      code_dir=$2
593      BUILD_DIR=$dir/$3      build_dir=$dir/$3
     CODE_DIR=$dir/$code_dir  
594    
595      # These are files that should replace their counter-part when using -mpi      # These are files that should replace their counter-part when using -mpi
596      MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)`      MPI_FILES=`(cd $dir/$code_dir; find . -name "*_mpi" -print)`
597    
598      #  Is this an MPI run?      for ii in $MPI_FILES ; do
599      if test "x$MPI" = xt ; then          i=`echo $ii | sed 's:^\./::'`
600          # YES: We symbolically link these files to the build          name=`echo $i | sed 's:_mpi::'`
601          # dir so long as there is no real file in place          file="../$code_dir/$i"
602          for ii in $MPI_FILES ; do          if test $name = 'SIZE.h' ; then file="SIZE.h.mpi" ; fi
603              i=`echo $ii | sed 's:^\./::'`  
604              name=`echo $i | sed 's:_mpi::' `          #  Is this an MPI run?
605              cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1          if test "x$MPI" = x0 ; then
606              RETVAL=$?              # NO: We undo any _mpi symbolically linked files
607              if test "x$RETVAL" != x0 ; then              if test -L $build_dir/$name ; then
608                  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  
609                  RETVAL=$?                  RETVAL=$?
610                  if test "x$RETVAL" = x0 ; then                  if test "x$RETVAL" = x0 ; then
611                      #echo Un-linking $name from $linktarg                      if [ $verbose -gt 1 ]; then
612                      rm -f $BUILD_DIR/$name                          echo "  Un-linking $name from ../$code_dir" ; fi
613                        rm -f $build_dir/$name
614                  fi                  fi
615              fi              fi
616          done          else
617      fi              # YES: We symbolically link these files to the build
618                # dir so long as there is no real file in place
619                ( cd $build_dir ; cmp $name $file > /dev/null 2>&1 )
620                RETVAL=$?
621                if [ $verbose -gt 1 ]; then echo "  cmp $name $file returns: $RETVAL" ; fi
622                if test "x$RETVAL" != x0 ; then
623                    if test -h $build_dir/$name ; then rm -f $build_dir/$name ; fi
624                    if test ! -r $build_dir/$name ; then
625                        if [ $verbose -gt 1 ]; then echo "  Linking $name to $file" ; fi
626                        (cd $build_dir; ln -sf $file $name)
627                    fi
628                fi
629            fi
630        done
631  }  }
632    
633  linkdata()  linkdata()
# Line 548  linkdata() Line 644  linkdata()
644                if test -r "../"$1"/"$xx ; then                if test -r "../"$1"/"$xx ; then
645                  # 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
646                  yy=`echo $xx | sed 's:\.mpi$::'`                  yy=`echo $xx | sed 's:\.mpi$::'`
647                  if test "x$MPI" = "xt" ; then                  if test "x$MPI" = "x0" ; then
648                  # mpi test: remove symbolic link & link _mpi sfx file                      # not mpi test: remove symbolic link
649                        if test -h $yy ; then rm -f $yy ; fi
650                    else
651                        # mpi test: remove symbolic link & link .mpi sfx file
652                      if test -h $yy ; then rm -f $yy ; fi                      if test -h $yy ; then rm -f $yy ; fi
653                      if test ! -r $yy ; then                      if test ! -r $yy ; then
654                          ln -sf "../"$1"/"$xx $yy ;                          ln -sf "../"$1"/"$xx $yy ;
655                          printf " $xx" 1>&2                          printf " $xx" 1>&2
656                      fi                      fi
                 else  
                 # not mpi test: remove symbolic link  
                     if test -h $yy ; then rm -f $yy ; fi  
657                  fi                  fi
658                fi                fi
659              done              done
# Line 605  runmodel() Line 701  runmodel()
701  {  {
702      # runmodel directory      # runmodel directory
703      #      #
704      #  runs "$COMMAND in "directory"      #  runs $COMMAND in "directory"
705      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
706      (      (
707          cd $1          cd $1
708          printf 'runmodel in %s ... ' $1          printf 'runmodel in %s ... ' $1
709            if test "x$MPI" != x0 ; then
710                #- adjust the MPI run command with the right number of Procs
711                #echo '' ; echo "  COMMAND='$COMMAND'"
712                COMMAND=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"`
713                if test "x$MPI_MFILE" != x ; then
714                  COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"`
715                fi
716                #echo "  COMMAND='$COMMAND'"
717            fi
718          if test -L $EXECUTABLE ; then          if test -L $EXECUTABLE ; then
719            if test -x "../"$builddir"/"$EXECUTABLE ; then            if test -x "../"$builddir"/"$EXECUTABLE ; then
720              diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1              cmp $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1
721              outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; fi              outD=$? ; if test "x$outD" != x0 ; then rm -f $EXECUTABLE ; fi
722            else rm -f $EXECUTABLE            else rm -f $EXECUTABLE
723            fi            fi
724          fi          fi
# Line 622  runmodel() Line 727  runmodel()
727              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
728          fi          fi
729          if test ! -x $EXECUTABLE ; then          if test ! -x $EXECUTABLE ; then
730                  rm -f $RUNLOG ; touch $RUNLOG              rm -f $RUNLOG ; touch $RUNLOG
731                  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
732                  echo " no executable:" $EXECUTABLE >> $RUNLOG              echo " no executable:" $EXECUTABLE >> $RUNLOG
733                  RETVAL=8              RETVAL=8
734                  ENDVAL=-1              ENDVAL=-1
735          else          else
736              if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then            if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then
737                # output do not exist or is older than executable:              # output do not exist or is older than executable:
738                  rm -f $RUNLOG ; touch $RUNLOG              rm -f $OUTPUTFILE $RUNLOG ; touch $RUNLOG
739                  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
740                  ( eval $COMMAND ) >> $RUNLOG 2>&1              ( eval $COMMAND ) >> $RUNLOG 2>&1
741                  RETVAL=$?              RETVAL=$?
742              else              ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
743                  RETVAL=0              if [ $POSTCLEAN -eq 1 -a $ENDVAL -gt 0 ] ; then
744                  if test -f $RUNLOG ; then                  find . -name "*.meta" -exec rm {} \;
745                      if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi                  find . -name "*.data" -exec rm {} \;
746                      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  
747              fi              fi
748              ENDVAL=`cat $RUNLOG | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`            else
749                RETVAL=0
750                ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
751                touch $RUNLOG
752                if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
753                echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1
754              fi
755          fi          fi
756          rm -f run.log_tmp          rm -f run.log_tmp
757            #- in all cases where OutputFile exists, report SIZE (and AD time)
758            if test -f $OUTPUTFILE ; then
759              grep '(PID\.TID 0000\.0001)      n.. =' $OUTPUTFILE \
760                    | sed 's/(PID.TID 0000.0001)     //' >> $CDIR"/summary.txt"
761              if test "x$ADM" = xt ; then
762                grep -A3 'Seconds in section "ALL' $OUTPUTFILE >> $CDIR"/summary.txt"
763              fi
764            fi
765            if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
766          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
767              echo successful              echo successful
768              printf '=> output from running in %s :\n' $1 1>&2              printf '=> output from running in %s :\n' $1 1>&2
769              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
             # === Reduce the size of the testing emails!  
             #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE  
             if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi  
770              return 0              return 0
771          elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then          elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then
772              #-- for some weird cases (run is finihed but with error code)              #-- for some weird cases (run is finihed but with error code)
# Line 668  runmodel() Line 779  runmodel()
779              printf '=> output from running in %s :\n' $1 1>&2              printf '=> output from running in %s :\n' $1 1>&2
780              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
781              cp $RUNLOG $CDIR"/"$RUNLOG              cp $RUNLOG $CDIR"/"$RUNLOG
             if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi  
782              return 1              return 1
783          fi          fi
784      )      )
# Line 770  scandirs() Line 880  scandirs()
880    
881  check_eedata()  check_eedata()
882  {  {
883      # check_eedata size.h eedata      # check_eedata eedata size.h
884      if [ $# -eq 2 ] ; then      if [ $# -eq 2 ] ; then
885        if test -f $1 -a -f $2 ; then       if test -f $1 -a -f $2 ; then
886        sx=`grep "^     & *nSx *=" $1 | sed "s/^     & *nSx *=//" | sed 's/, *$//'`        nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
887        nx=`grep "^ *nTx *=" $2 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`        sx=`grep "^     & *nSx *=" $2 | sed "s/^     & *nSx *=//" | sed 's/, *$//'`
888        if test "x$nx" = x ; then        if test "x$nx" = x ; then
889          rx=10          rx=10
890        else        else
891          rx=`expr $sx % $nx`          rx=`expr $sx % $nx`
892        fi        fi
893        sy=`grep "^     & *nSy *=" $1 | sed "s/^     & *nSy *=//" | sed 's/, *$//'`        ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
894        ny=`grep "^ *nTy *=" $2 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`        sy=`grep "^     & *nSy *=" $2 | sed "s/^     & *nSy *=//" | sed 's/, *$//'`
895        if test "x$ny" = x ; then        if test "x$ny" = x ; then
896          ry=20          ry=20
897        else        else
898          ry=`expr $sy % $ny`          ry=`expr $sy % $ny`
899        fi        fi
900        echo `expr $rx + $ry`        echo `expr $rx + $ry`
901      else       else
902        echo '-1'        echo '-1'
903        fi       fi
904        elif [ $# -eq 1 ] ; then
905         if test -f $1 ; then
906          nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
907          if test "x$nx" = x ; then nx=1 ; fi
908          ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
909          if test "x$ny" = x ; then ny=1 ; fi
910         #echo $nx $ny
911          echo $nx
912         else
913          echo '-1'
914         fi
915      else      else
916        echo '-2'        echo '-2'
917      fi      fi
# Line 803  check_eedata() Line 924  check_eedata()
924  #  Default properties  #  Default properties
925  debug=0  debug=0
926  verbose=1  verbose=1
927  clean=0  NBLINES_MKLOG=16000
928    
929  IEEE=true  IEEE=true
930  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
931      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
932  fi  fi
933    OptLev=1
934  GSL=f  GSL=f
935    
936  CLEANUP=f  CLEANUP=f
# Line 818  NOMAKE=f Line 940  NOMAKE=f
940  NOGENMAKE=f  NOGENMAKE=f
941  NOCLEAN=f  NOCLEAN=f
942  NODEPEND=f  NODEPEND=f
943  POSTCLEAN=f  POSTCLEAN=0
944    
945  BASH=  BASH=
946  OPTFILE=NONE  OPTFILE=NONE
# Line 829  MPACKDIR="../tools/mpack-1.6" Line 951  MPACKDIR="../tools/mpack-1.6"
951  HAVE_MPACK=  HAVE_MPACK=
952  MPACK=  MPACK=
953  COMMAND=  COMMAND=
954    MKDEPEND=
955  if test "x$MAKE" = x ; then  if test "x$MAKE" = x ; then
956      MAKE=make      MAKE=make
957  fi  fi
# Line 836  if test "x$CC" = x ; then Line 959  if test "x$CC" = x ; then
959      CC=cc      CC=cc
960  fi  fi
961  JOBS=  JOBS=
962  MPI=f  TARG=
963    MPI=0
964    MPI_MFILE=
965  MULTI_THREAD=f  MULTI_THREAD=f
966  OUTDIR=  OUTDIR=
967  DELDIR=  DELDIR=
968  USE_R4=  USE_R4=
969    EXTRFLG=
970    
971  ADM=  ADM=
972  OADM=  OADM=
# Line 848  OADM= Line 974  OADM=
974  # list of pTracers to check for monitor output  # list of pTracers to check for monitor output
975  PTRACERS_NUM="1 2 3 4 5"  PTRACERS_NUM="1 2 3 4 5"
976    
977  MATCH_CRIT=13  MATCH_CRIT=10
978    
979  printf "parsing options...  "  printf "parsing options...  "
980    
# Line 866  for ac_option ; do Line 992  for ac_option ; do
992    
993      case $ac_option in      case $ac_option in
994                    
995          -help | --help | -h | --h)          -help | --help | -h | --h) usage ;;
996              usage ;;  
997                    -optfile | --optfile | -of | --of) ac_prev=OPTFILE ;;
998          -optfile | --optfile | -of | --of)          -optfile=* | --optfile=* | -of=* | --of=*) OPTFILE=$ac_optarg ;;
999              ac_prev=OPTFILE ;;  
1000          -optfile=* | --optfile=* | -of=* | --of=*)          -addr | --addr | -a | --a) ac_prev=ADDRESSES ;;
1001              OPTFILE=$ac_optarg ;;          -addr=* | --addr=* | -a=* | --a=*) ADDRESSES=$ac_optarg ;;
1002                    -mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;;
1003          -addr | --addr | -a | --a)          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;;
1004              ac_prev=ADDRESSES ;;  
1005          -addr=* | --addr=* | -a=* | --a=*)          -tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;;
1006              ADDRESSES=$ac_optarg ;;          -tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;;
1007          -mpackdir | --mpackdir | -mpd | --mpd)          -skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;;
1008              ac_prev=MPACKDIR ;;          -skipdir=* | --skipdir=* | -skd=* | --skd=*) SKIPDIRS=$ac_optarg ;;
1009          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*)  
1010              MPACKDIR=$ac_optarg ;;          -bash | --bash | -b | --b) ac_prev=BASH ;;
1011            -bash=* | --bash=* | -b=* | --b=*) BASH=$ac_optarg ;;
1012          -tdir | --tdir | -t | --t)  
1013              ac_prev=TESTDIRS ;;          -command | --command | -c | --c) ac_prev=COMMAND ;;
1014          -tdir=* | --tdir=* | -t=* | --t=*)          -command=* | --command=* | -c=* | --c=*) COMMAND=$ac_optarg ;;
1015              TESTDIRS=$ac_optarg ;;  
1016            -makedepend | --makedepend | -md | --md) ac_prev=MKDEPEND ;;
1017          -skipdir | --skipdir | -skd | --skd)          -makedepend=* | --makedepend=* | -md=* | --md=*) MKDEPEND=$ac_optarg ;;
1018              ac_prev=SKIPDIRS ;;  
1019          -skipdir=* | --skipdir=* | -skd=* | --skd=*)          -make | --make | -m | --m) ac_prev=MAKE ;;
1020              SKIPDIRS=$ac_optarg ;;          -make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;;
1021    
1022          -bash | --bash | -b | --b)          -odir | --odir) ac_prev=OUTDIR ;;
1023              ac_prev=BASH ;;          -odir=* | --odir=*) OUTDIR=$ac_optarg ;;
1024          -bash=* | --bash=* | -b=* | --b=*)  
1025              BASH=$ac_optarg ;;          -ptracers | --ptracers | -ptr | --ptr) ac_prev=PTRACERS_NUM ;;
1026            -ptracers=* | --ptracers=* | -ptr=* | --ptr=*) PTRACERS_NUM=$ac_optarg ;;
         -command | --command | -c | --c)  
             ac_prev=COMMAND ;;  
         -command=* | --command=* | -c=* | --c=*)  
             COMMAND=$ac_optarg ;;  
   
         -make | --make | -m | --m)  
             ac_prev=MAKE ;;  
         -make=* | --make=* | -m=* | --m=*)  
             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 ;;  
1027    
1028          -match | --match ) ac_prev=MATCH_CRIT ;;          -match | --match ) ac_prev=MATCH_CRIT ;;
1029          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;
# Line 924  for ac_option ; do Line 1031  for ac_option ; do
1031          -j | --j) ac_prev=JOBS ;;          -j | --j) ac_prev=JOBS ;;
1032          -j=* | --j=*) JOBS=$ac_optarg ;;          -j=* | --j=*) JOBS=$ac_optarg ;;
1033    
1034          -clean | --clean)          -ef | --ef) ac_prev=EXTRFLG ;;
1035              CLEANUP=t ; DELDIR=t ;;          -ef=* | --ef=*) EXTRFLG=$ac_optarg ;;
1036    
1037          -norun | --norun | -nr | --nr)          -clean | --clean) CLEANUP=t ; DELDIR=t ;;
             NORUN=t ;;  
         -runonly | --runonly | -ro | --ro)  
             QUICK=t ; NOMAKE=t ;;  
         -quick | --quick | -q | --q)  
             QUICK=t ;;  
         -nogenmake | --nogenmake | -ng | --ng)  
             NOGENMAKE=t ;;  
         -noclean | --noclean | -nc | --nc)  
             NOCLEAN=t ;;  
         -nodepend | --nodepend | -nd | --nd)  
             NODEPEND=t ;;  
1038    
1039          -postclean | --postclean | -pc | --pc)          -norun | --norun | -nr | --nr) NORUN=t ;;
1040              POSTCLEAN=t ;;          -obj | --obj ) TARG='obj' ; NORUN=t ;;
1041            -runonly | --runonly | -ro | --ro) QUICK=t ; NOMAKE=t ;;
1042            -quick | --quick | -q | --q) QUICK=t ;;
1043            -nogenmake | --nogenmake | -ng | --ng) NOGENMAKE=t ;;
1044            -noclean | --noclean | -nc | --nc) NOCLEAN=t ;;
1045            -nodepend | --nodepend | -nd | --nd) NODEPEND=t ;;
1046    
1047            -postclean | --postclean | -pc | --pc) POSTCLEAN=2 ;;
1048            -deloutp | --deloutp | -do | --do) POSTCLEAN=1 ;;
1049    
1050            -mpi | --mpi) MPI=2 ;;
1051            -MPI | --MPI) ac_prev=MPI ;;
1052            -MPI=* | --MPI=*) MPI=$ac_optarg ;;
1053    
1054          -mpi) MPI=t ;;          -mfile | --mfile | -mf | --mf) ac_prev=MPI_MFILE ;;
1055            -mfile=* | --mfile=* | -mf=* | --mf=*) MPI_MFILE=$ac_optarg ;;
1056    
1057          -mth) MULTI_THREAD=t ;;          -mth) MULTI_THREAD=t ;;
1058    
1059          -adm | -ad) ADM=t ;;          -adm | -ad) ADM=t ;;
   
1060          -oad) OADM=t; NODEPEND=t ;;          -oad) OADM=t; NODEPEND=t ;;
1061    
1062          -ieee) IEEE=true ;;          -ieee)   echo "Warning: ignore option '-ieee' (already the default)"
1063          -noieee) IEEE= ;;                   printf " ... " ;;
1064          -gsl) GSL=t ;;          -noieee) echo "Warning: will use option '-fast' instead of '-noieee' (obsolete)"
1065                     printf " ... " ; OptLev=`expr $OptLev \* 2` ;;
1066            -fast)  OptLev=`expr $OptLev \* 2` ;;
1067            -devel) OptLev=0 ;;
1068            -gsl) GSL=t ;;
1069    
1070          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
1071          -debug) debug=1 ;;          -debug) debug=1 ;;
# Line 967  for ac_option ; do Line 1079  for ac_option ; do
1079          -papis) PAPIS=t;;          -papis) PAPIS=t;;
1080          -pcls) PCL=t;;          -pcls) PCL=t;;
1081    
1082          -*)          -*) echo "Error: unrecognized option: "$ac_option
1083              echo "Error: unrecognized option: "$ac_option              usage ;;
1084              usage          *)  echo "Error: unrecognized argument: "$ac_option
1085              ;;              usage ;;
   
         *)  
             echo "Error: unrecognized argument: "$ac_option  
             usage  
             ;;  
1086    
1087       esac       esac
1088    
# Line 987  if test "x$QUICK" = xt ; then Line 1094  if test "x$QUICK" = xt ; then
1094      NODEPEND=t      NODEPEND=t
1095  fi  fi
1096    
1097    #- check length of MPI machine file:
1098    if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then
1099        if test -r $MPI_MFILE ; then
1100            nl=`wc -l $MPI_MFILE | awk '{print $1}'`
1101            if [ $nl -lt $MPI ] ; then
1102              echo "Error: need at least $MPI nodes (currently only $nl) in MPI_MFILE=$MPI_FILE"
1103              usage
1104            fi
1105            if [ $verbose -gt 1 ]; then
1106                echo " MPI_MFILE=$MPI_MFILE : $nl procs for MPI=$MPI run"
1107            fi
1108        else
1109              echo "Error: cannot access MPI_MFILE=$MPI_FILE"
1110              usage
1111        fi
1112    fi
1113    
1114  #- setting for forward or ADM testing  #- setting for forward or ADM testing
1115  if test "x$ADM" = xt ; then  if test "x$ADM" = xt ; then
1116        if test "x$TARG" = xobj ; then TARG=adobj ; else TARG=adall ; fi
1117      code_dir=code_ad      code_dir=code_ad
1118      inputdir=input_ad      inputdir=input_ad
1119      ref_outp="output_adm.txt"      ref_outp="output_adm.txt"
1120      EXECUTABLE="mitgcmuv_ad"      EXECUTABLE="mitgcmuv_ad"
1121  elif test "x$OADM" = xt ; then  elif test "x$OADM" = xt ; then
1122        TARG=adAll
1123      code_dir=code_oad      code_dir=code_oad
1124      inputdir=input_oad      inputdir=input_oad
1125      ref_outp="output_oadm.txt"      ref_outp="output_oadm.txt"
1126      EXECUTABLE="mitgcmuv_ad"      EXECUTABLE="mitgcmuv_ad"
1127  else  else
1128        if test "x$JOBS" != x ; then TARG="-j $JOBS $TARG" ; fi
1129      code_dir=code      code_dir=code
1130      inputdir=input      inputdir=input
1131      ref_outp="output.txt"      ref_outp="output.txt"
1132      EXECUTABLE="mitgcmuv"      EXECUTABLE="mitgcmuv"
1133  fi  fi
1134    
1135    xx=`echo $TESTDIRS | awk '{print $1}'`
1136  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
1137      LIST=`scandirs results/$ref_outp`      LIST=`scandirs results/$ref_outp`
1138    elif test $xx = 'start_from' ; then
1139        xx=`echo $TESTDIRS | awk '{print $2}'`
1140        LIST=`scandirs results/$ref_outp | sed -n "/$xx/,$ p"`
1141  else  else
1142      #- expand group of experiments:      #- expand group of experiments:
1143      LIST=" "      LIST=" "
# Line 1050  if test "x$OPTFILE" = xNONE -a "x$MITGCM Line 1181  if test "x$OPTFILE" = xNONE -a "x$MITGCM
1181      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
1182  fi  fi
1183    
1184  RUNLOG="run.log"  LOC_MFILE='tr_mpi_mfile'
1185    RUNLOG="run.tr_log"
1186  OUTPUTFILE=$ref_outp  OUTPUTFILE=$ref_outp
1187  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
1188      COMMAND="./$EXECUTABLE > $OUTPUTFILE"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
1189  fi  fi
1190  if test "x$MPI" = xt ; then  if test "x$MPI" != x0 ; then
1191      OUTPUTFILE="STDOUT.0000"      OUTPUTFILE="STDOUT.0000"
1192  fi  fi
1193    
# Line 1072  if test "x$ADM" = x -a "x$OADM" = x; the Line 1204  if test "x$ADM" = x -a "x$OADM" = x; the
1204      ii=`echo $EMPTY_RESULTS | awk '{print NF}'`      ii=`echo $EMPTY_RESULTS | awk '{print NF}'`
1205      EMPTY_RESULTS=$EMPTY_RESULTS`expr $LEN_CHECK_LIST - $ii | awk 'BEGIN{FS=":"}{for(i=1;i<=$1;i++){printf "  ."}}'`      EMPTY_RESULTS=$EMPTY_RESULTS`expr $LEN_CHECK_LIST - $ii | awk 'BEGIN{FS=":"}{for(i=1;i<=$1;i++){printf "  ."}}'`
1206  else  else
1207      DEF_CHECK_LIST='Grad Cost Grad'      DEF_CHECK_LIST='AdGrd Cost AdGrd FDGrd'
1208      EMPTY_RESULTS='.. ..'      EMPTY_RESULTS='.. .. ..'
1209      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}'`
1210  fi  fi
1211    
# Line 1148  if test "x$OPTFILE" != xNONE ; then Line 1280  if test "x$OPTFILE" != xNONE ; then
1280      fi      fi
1281  else  else
1282      echo >> $SUMMARY      echo >> $SUMMARY
1283      echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY      echo "No \"OPTFILE\" was specified ; genmake2 found and uses:" >> $SUMMARY
1284      echo "   so the genmake default will be used." >> $SUMMARY      #-note: to be filled later after 1rst run
1285  fi  fi
1286  echo  echo
1287  echo >> $SUMMARY  echo >> $SUMMARY
# Line 1159  if test "x$ADM" = x -a "x$OADM" = x; the Line 1291  if test "x$ADM" = x -a "x$OADM" = x; the
1291      else line_0="default "$MATCH_CRIT ; fi      else line_0="default "$MATCH_CRIT ; fi
1292         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"
1293      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"
1294      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  ."
1295      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"
1296      line_4="2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  ."      line_4="2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  ."
1297      for ii in $PTRACERS_NUM ; do      for ii in $PTRACERS_NUM ; do
1298          line_0="$line_0  --PTR 0"$ii"--"          line_0="$line_0  --PTR 0"$ii"--"
# Line 1183  else Line 1315  else
1315      else line_0="default    "$MATCH_CRIT ; fi      else line_0="default    "$MATCH_CRIT ; fi
1316      echo "$line_0" | tee -a $SUMMARY      echo "$line_0" | tee -a $SUMMARY
1317      cat << EOF | tee -a $SUMMARY      cat << EOF | tee -a $SUMMARY
1318  G D M    C  G  G D M    C  A  F
1319  E p a R  o  r  e p a R  o  d  D
1320  N n k u  s  a  n n k u  s  G  G
1321  2 d e n  t  d  2 d e n  t  r  r
1322    
1323  EOF  EOF
1324  fi  fi
# Line 1199  for dir in $TESTDIRS ; do Line 1331  for dir in $TESTDIRS ; do
1331      builddir="build"      builddir="build"
1332      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1333      rundir="run"      rundir="run"
1334        pfxdir="tr_$rundir"
1335      if test ! -d $dir/$rundir ; then      if test ! -d $dir/$rundir ; then
1336          rundir=$builddir          rundir=$builddir
1337      fi      fi
# Line 1209  for dir in $TESTDIRS ; do Line 1342  for dir in $TESTDIRS ; do
1342      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
1343          echo -n '  --- dir:' $BUILD_DIR ': '          echo -n '  --- dir:' $BUILD_DIR ': '
1344          makeclean $BUILD_DIR          makeclean $BUILD_DIR
1345          rm -f $BUILD_DIR/$EXECUTABLE          (   cd $BUILD_DIR
1346                rm -f $EXECUTABLE *.bak
1347                rm -f genmake_state genmake_*optfile genmake.log
1348                rm -f SIZE.h.mpi genmake.tr_log make.tr_log
1349            )
1350          if test -d $dir/$rundir/CVS ; then          if test -d $dir/$rundir/CVS ; then
1351              echo -n '  --- dir:' $dir/$rundir ': '              echo -n '  --- dir:' $dir/$rundir ': '
1352              run_clean $dir/$rundir              run_clean $dir/$rundir
1353          fi          fi
1354          trdir=`( cd $dir ; find . -type d -name "tr_run.*" -print | sed 's/^.\///')`          trdir=`( cd $dir ; find . -type d -name "$pfxdir.*" -print | sed 's/^.\///')`
1355          ttd=`echo $trdir | wc -w`          ttd=`echo $trdir | wc -w`
1356          if test $ttd != 0 ; then          if test $ttd != 0 ; then
1357              echo '  --- rm dir:' $trdir              echo '  --- rm dir:' $trdir
# Line 1233  for dir in $TESTDIRS ; do Line 1370  for dir in $TESTDIRS ; do
1370    
1371      # Check for specific files for particular type of run      # Check for specific files for particular type of run
1372    
1373      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
1374          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1375          continue          continue
1376      fi      fi
# Line 1241  for dir in $TESTDIRS ; do Line 1378  for dir in $TESTDIRS ; do
1378          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"
1379          continue          continue
1380      fi      fi
1381      if test "x$MPI" = "xt" -a "x$MULTI_THREAD" = "xt" ; then  
1382        retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/input/eedata.mth"`      if test "x$MPI" != "x0" ; then
1383        if test $retv != 0 ; then          prefer_X=0
1384          echo "input/eedata.mth tiling misfit -- skipping $dir"          if test "x$MULTI_THREAD" = "xt" ; then
1385          continue              retv=`check_eedata $dir"/input/eedata.mth"`
1386        fi              if test $retv = 1 ; then prefer_X=1 ; fi
1387            fi
1388            #- create new SIZE.h with no more than '$MPI' Procs
1389            mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI $prefer_X
1390            LOC_NPROC=$?
1391            (   cd $BUILD_DIR
1392                if test -r SIZE.h.mpi ; then
1393                    cmp tr_size.mpi SIZE.h.mpi > /dev/null 2>&1 ; RETVAL=$?
1394                else RETVAL=1
1395                fi
1396                if test "x$RETVAL" = x0 ; then
1397                    rm -f tr_size.mpi
1398                else
1399                    rm -f SIZE.h.mpi ; mv tr_size.mpi SIZE.h.mpi
1400                fi
1401            )
1402            if test "x$MPI_MFILE" != x ; then
1403                #- create new MPI machine-file with the right number of Procs
1404                rm -f $LOC_MFILE
1405                cat $MPI_MFILE | sort | uniq | head -$LOC_NPROC > $LOC_MFILE
1406                nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1407                if [ $nl -lt $LOC_NPROC ] ; then
1408                    rm -f $LOC_MFILE
1409                    cat $MPI_MFILE | head -$LOC_NPROC > $LOC_MFILE
1410                    #sed -n "1,$LOC_NPROC p" $MPI_MFILE > $LOC_MFILE
1411                fi
1412                if [ $verbose -gt 1 ]; then
1413                    nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1414                    echo " new LOC_MFILE=$LOC_MFILE : $nl procs for LOC_NPROC=$LOC_NPROC"
1415                fi
1416            fi
1417            if test "x$MULTI_THREAD" = "xt" ; then
1418                retv=`check_eedata $dir"/input/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"`
1419                if test $retv != 0 ; then
1420                    echo "input/eedata.mth tiling misfit -- skipping $dir"
1421                    continue
1422                fi
1423            fi
1424      fi      fi
1425    
1426      #  Check whether there are "extra runs" for this testdir      #  Check whether there are "extra runs" for this testdir
# Line 1262  for dir in $TESTDIRS ; do Line 1436  for dir in $TESTDIRS ; do
1436          if test -f $outf -a -r $outf ; then          if test -f $outf -a -r $outf ; then
1437            if test "x$MULTI_THREAD" = "xt" ; then            if test "x$MULTI_THREAD" = "xt" ; then
1438              if test -r $dir"/"$exd"/eedata.mth" ; then              if test -r $dir"/"$exd"/eedata.mth" ; then
1439                if test "x$MPI" = "xt" ; then                if test "x$MPI" = "x0" ; then
1440                  retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/"$exd"/eedata.mth"`                  extra_runs="$extra_runs $name"
1441                  else
1442                    retv=`check_eedata $dir"/"$exd"/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"`
1443                  if test $retv = 0 ; then                  if test $retv = 0 ; then
1444                      extra_runs="$extra_runs $name"                      extra_runs="$extra_runs $name"
1445                  else                  else
1446                      echo $exd"/eedata.mth tiling misfit -- skipping $dir"                      echo $exd"/eedata.mth tiling misfit -- skipping $dir"
1447                  fi                  fi
               else  
                 extra_runs="$extra_runs $name"  
1448                fi                fi
1449              #else echo $dir"/"$exd"/eedata.mth: not found"              #else echo $dir"/"$exd"/eedata.mth: not found"
1450              fi              fi
# Line 1290  for dir in $TESTDIRS ; do Line 1464  for dir in $TESTDIRS ; do
1464      unset genmake makedepend make run      unset genmake makedepend make run
1465      results=$EMPTY_RESULTS      results=$EMPTY_RESULTS
1466    
1467      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir & summary.txt file for each tested experiment (tdir)
1468      locDIR=$DRESULTS"/"$dir      locDIR=$DRESULTS"/"$dir
1469      mkdir $locDIR      mkdir $locDIR
1470        #- report to this experiment local summary file ---
1471        echo "DATE='$DATE' ; tdir='$dir'" > $locDIR"/summary.txt"
1472        echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1473        echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1474      CDIR=`pwd`"/$locDIR"      CDIR=`pwd`"/$locDIR"
1475    
1476      if test "x$NORUN" = xt ; then      if test "x$NORUN" = xt ; then
# Line 1318  for dir in $TESTDIRS ; do Line 1496  for dir in $TESTDIRS ; do
1496          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1497          echo 1>&2          echo 1>&2
1498          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
         touch $locDIR"/summary.txt"  
1499          echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"          echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
         echo "MACH='$MACH'" >> $locDIR"/summary.txt"  
         echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"  
         echo "DATE='$DATE'" >> $locDIR"/summary.txt"  
         echo "tdir='$dir'" >> $locDIR"/summary.txt"  
         if test "x$ADM" = xt ; then  
             head -1 $dir/$builddir/taf_ad.log >> $locDIR"/summary.txt"  
             grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \  
                                 >> $locDIR"/summary.txt"  
         fi  
1500    
1501          for ex in $extra_runs ; do          for ex in $extra_runs ; do
1502              unset run              unset run
1503              results=$EMPTY_RESULTS              results=$EMPTY_RESULTS
1504              #  reference output file              #  reference output file
1505              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`
1506              #  Create an output dir for each OPTFILE/tdir.ex combination              #  Create an output dir & summary.txt file for each extra run (tdir.ex)
1507              locDIR=$DRESULTS"/"$dir"."$ex              locDIR=$DRESULTS"/"$dir"."$ex
1508              mkdir $locDIR              mkdir $locDIR
1509                #- report to this experiment local summary file ---
1510                echo "DATE='$DATE' ; tdir='$dir.$ex'" > $locDIR"/summary.txt"
1511                #echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1512                #echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1513              CDIR=`pwd`"/$locDIR"              CDIR=`pwd`"/$locDIR"
1514              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"              test ! -e "$dir/$pfxdir.$ex" && mkdir "$dir/$pfxdir.$ex"
1515              run_clean $dir/tr_run.$ex              run_clean $dir/$pfxdir.$ex
1516              linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir              linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir
1517              runmodel $dir/tr_run.$ex && run=Y \              runmodel $dir/$pfxdir.$ex && run=Y \
1518              && results=`testoutput_run $dir tr_run.$ex $refExOut`              && results=`testoutput_run $dir $pfxdir.$ex $refExOut`
1519              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1520              fres="$fres.$ex"              fres="$fres.$ex"
1521              echo 1>&2              echo 1>&2
1522              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
             touch $locDIR"/summary.txt"  
1523              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
1524              echo "MACH='$MACH'" >> $locDIR"/summary.txt"              if test "x$POSTCLEAN" = x2 ; then
1525              echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"                  run_clean $dir/$pfxdir.$ex
             echo "DATE='$DATE'" >> $locDIR"/summary.txt"  
             echo "tdir='$dir.$ex'" >> $locDIR"/summary.txt"  
             if test "x$ADM" = xt ; then  
                 head -1 $dir/$builddir/taf_ad.log >> $locDIR"/summary.txt"  
                 grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \  
                                    >> $locDIR"/summary.txt"  
             fi  
             if test "x$POSTCLEAN" = xt ; then  
                 run_clean $dir/tr_run.$ex  
1526              fi              fi
1527          done          done
1528    
# Line 1369  for dir in $TESTDIRS ; do Line 1531  for dir in $TESTDIRS ; do
1531              mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'`              mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
1532              echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state              echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state
1533              sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state              sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state
1534              echo $mkOpt >> $DRESULTS/genmake_state              echo " $mkOpt" >> $DRESULTS/genmake_state
1535                if test "x$OPTFILE" = xNONE ; then
1536                    eval $mkOpt
1537                    sed "/^No \"OPTFILE\" was specified ; genmake2/a\  OPTFILE=${OPTFILE}"\
1538                            $SUMMARY > tr_0.tmp_log
1539                    RETVAL=$?
1540                    if test "x$RETVAL" = x0 ; then rm -f $SUMMARY
1541                            cp tr_0.tmp_log $SUMMARY
1542                    else rm -f tr_0.tmp_log
1543                    fi
1544                fi
1545                gmkLog=$dir/$builddir/genmake.log
1546                grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1
1547                RETVAL=$?
1548                if test "x$RETVAL" = x0 ; then
1549                    echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state
1550                    sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \
1551                            | grep -v '^... compiler version ' > tr_1.tmp_log
1552                    sed -n '1p' tr_1.tmp_log >> $DRESULTS/genmake_state
1553                    sed -n '2,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \
1554                            >> $DRESULTS/genmake_state
1555                    rm -f tr_1.tmp_log
1556                fi
1557          fi          fi
1558      fi      fi
1559      #postclean $dir/$builddir      #postclean $dir/$builddir
1560      if test "x$POSTCLEAN" = xt ; then      if test "x$POSTCLEAN" = x2 ; then
1561          makeclean $dir/$builddir \          makeclean $dir/$builddir \
1562              && run_clean $dir/$rundir              && run_clean $dir/$rundir
1563      fi      fi
1564        if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then rm -f $LOC_MFILE ; fi
1565    
1566      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
1567    

Legend:
Removed from v.1.140  
changed lines
  Added in v.1.170

  ViewVC Help
Powered by ViewVC 1.1.22