/[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.94 by jmc, Thu Sep 6 22:31:45 2007 UTC revision 1.160 by jmc, Tue Mar 29 11:51:20 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 "  (-of=|-optfile=)STRING   list of optfiles to use"      echo "  (-gsl)                   compile with \"-gsl\" flag"
21      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-use_r4|-ur4)           if allowed, use real*4 type for '_RS' variable"
22      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "  (-optfile|-of) STRING    list of optfiles to use"
23      echo "  (-t|-tdir) STRING        list of group and/or exp. dirs to test"      echo "  (-addr|-a) STRING        list of email recipients"
24        echo "                             (DEF=\"\" no email is sent)"
25        echo "  (-mpackdir|-mpd) DIR     location of the mpack utility"
26        echo "                             (DEF=\"../tools/mpack-1.6\")"
27        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 64  usage() Line 77  usage()
77  build_mpack()  build_mpack()
78  {  {
79      printf "building the mpack utility...  "      printf "building the mpack utility...  "
80      if test ! -x "$MPACKDIR/mpack" ; then      MPACK="$MPACKDIR/mpack"
81        if test ! -x $MPACK ; then
82          if test ! -d $MPACKDIR ; then          if test ! -d $MPACKDIR ; then
83              echo              echo
84              echo "Error: can't find \"$MPACKDIR\""              echo "Error: can't find \"$MPACKDIR\""
# Line 73  build_mpack() Line 87  build_mpack()
87              echo              echo
88              HAVE_MPACK=f              HAVE_MPACK=f
89          fi          fi
         printf "building mpack...  "  
90          if test "x$CC" = x ; then          if test "x$CC" = x ; then
91              export CC=cc              export CC=cc
92          fi          fi
93            printf "building mpack (using CC=$CC)...  "
94          ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1          ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1
95          RETVAL=$?          RETVAL=$?
96          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
# Line 87  build_mpack() Line 101  build_mpack()
101          else          else
102              rm -f tr_build_mpack.out              rm -f tr_build_mpack.out
103              HAVE_MPACK=t              HAVE_MPACK=t
104                echo "done"
105          fi          fi
106      else      else
107          HAVE_MPACK=t          HAVE_MPACK=t
108            echo "already exist"
109      fi      fi
     echo "OK"  
110  }  }
111    
112  testoutput_var()  testoutput_var()
113  {  {
114      # testoutput_var dir s1 label subdir extension      # 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/output.$extension      #     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    
120      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
# Line 108  testoutput_var() Line 123  testoutput_var()
123      if [ -r $1/$4/$OUTPUTFILE ]; then      if [ -r $1/$4/$OUTPUTFILE ]; then
124          grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt          grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt
125          lncntA=`wc -l tmp1.txt | awk '{print $1}' `          lncntA=`wc -l tmp1.txt | awk '{print $1}' `
126          if [ $lncntA -lt 3 ]; then          if [ $lncntA -lt 2 ]; then
127              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
128                  echo Not enough lines of output when searching for "$2" 1>&2                  echo Not enough lines of output when searching for "$2" 1>&2
129              fi              fi
# Line 119  testoutput_var() Line 134  testoutput_var()
134          return 99          return 99
135      fi      fi
136      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
137          echo testoutput_var: grep "$2" $1/results/output.$5 1>&2          echo testoutput_var: grep "$2" $1/results/$5 1>&2
138      fi      fi
139      grep "$2" $1/results/output.$5 | sed 's/.*=//' | cat -n > tmp2.txt      grep "$2" $1/results/$5 | sed 's/.*=//' | cat -n > tmp2.txt
140      lncntB=`wc -l tmp2.txt | awk '{print $1}' `      lncntB=`wc -l tmp2.txt | awk '{print $1}' `
141      if [ $lncntB -lt 3 ]; then      if [ $lncntB -lt 2 ]; then
142          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
143              echo Not enough lines of output when searching for "$2" 1>&2              echo Not enough lines of output when searching for "$2" 1>&2
144          fi          fi
# Line 161  testoutput_var() Line 176  testoutput_var()
176      digits_of_similarity=`./tr_cmpnum < tmp4.txt`      digits_of_similarity=`./tr_cmpnum < tmp4.txt`
177      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
178          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
179              echo testoutput_var: No comparison was available for \"$2\" 1>&2              echo testoutput_var: No comparison was available for \"$3\" 1>&2
180          fi          fi
181          digits_of_similarity=99          digits_of_similarity=99
182      else      else
183          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
184              echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2              echo There were $digits_of_similarity decimal places of similarity for \"$3\" 1>&2
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
       
     return $digits_of_similarity  
 }  
   
 dashnum()  
 {  
     # dashnum n1 n2 n3 ...  
     #  
     #  print numbers using %3i format or "--" if number = 99  
188    
189      for num in $@ ; do      return $digits_of_similarity
         if [ $num = 99 ]; then  
             printf ' --'  
         else  
             printf '%3i' $num  
         fi  
     done  
 }  
   
 testoutput_ad()  
 {  
     grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt  
     grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt  
     grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt  
     grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt  
     join t05.txt t15.txt > t5.txt  
     join t06.txt t16.txt > t6.txt  
     echo "-1" >> t5.txt  
     echo "-1" >> t6.txt  
     digits_5=`./tr_cmpnum < t5.txt`  
     digits_6=`./tr_cmpnum < t6.txt`  
     dashnum $digits_5 $digits_6  
     rm -f t[01][56].txt t[56].txt  
 }  
   
 check_for_add_mon_output()  
 {  
     # Check for additional types of monitor output  
     if test "x$1" = x ; then  
         return  
     fi  
   
     for ii in $PTRACERS_NUM ; do  
         eval "HAVE_PTR0"$ii"=f"  
     done  
   
     ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max"  
     ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd"  
     for ii in $PTRACERS_NUM ; do  
         for jj in $ptr_add ; do  
             name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`  
             tst=`grep $name $1 | wc -l | awk '{print $1}'`  
             if test ! "x$tst" = x0 ; then  
                 eval "HAVE_PTR0"$ii"=t"  
             fi  
         done  
         #  eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"'  
     done  
190  }  }
191    
192  testoutput_run()  testoutput_run()
193  {  {
194      # testoutput_run directory subdir extension      # testoutput_run directory subdir reference_output
195      #      #
196      #  test output from 1 run in "directory"      #  test output from 1 run in "directory"
197      if test "x$ADM" = x ; then  # --> same processing for adjoint & forward test
198          # default list of output variables to be checked:          # default list of output variables to be checked:
199          #  1rst : main variable used to decide if it pass or FAIL          #  1rst : main variable used to decide if it pass or FAIL
200          #  others : number of matching digits to be printed in summary.txt          #  others : number of matching digits to be printed in summary.txt
201          listChk=$DEF_CHECK_LIST          listChk=$DEF_CHECK_LIST
         nbDef=`echo $listChk | awk '{print NF-1+3*gsub("+","E")}'`  
202          #  load experiment-specific list from file "tr_checklist" (if it exist)          #  load experiment-specific list from file "tr_checklist" (if it exist)
203          if test -r $1/$2/tr_checklist ; then listChk=`cat $1/$2/tr_checklist` ; fi          if test -r $1/$2/tr_checklist ; then listChk=`cat $1/$2/tr_checklist` ; fi
204          sVar=`echo $listChk | awk '{print $1}'`          sVar=`echo $listChk | awk '{print $1}'`
205          # remove 1rst var and expand the list: + => min max mean s.d          # remove 1rst var and expand the list: + => min max mean s.d
206          listVar=`echo $listChk | awk '{ for(i=2;i<=NF;i++){if (sub("+","",$i)) \          listVar=`echo $listChk | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' \
207              {printf " %s %s %s %s",$i"mn",$i"mx",$i"av",$i"sd"} else {printf " %s",$i} }}'`                                 | sed 's/+//g' | sed "s/^$sVar//"`
208          if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(I)='$listVar'" 1>&2 ; fi          if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(I)='$listVar'" 1>&2 ; fi
209          for ii in 1 2 3 4 5 6 7 8 9 ; do          # check for ptracer output in reference_output file :
210            tst=`eval 'echo "$HAVE_PTR0'$ii'"'`          outpref=$1/results/$3
211           #echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2          ptr_mon="trcstat_ptracerXX_min trcstat_ptracerXX_max"
212            if test "x$tst" != xt ; then listVar=`echo "$listVar" | sed "s/ pt$ii..//g"` ; fi          ptr_mon="$ptr_mon trcstat_ptracerXX_mean trcstat_ptracerXX_sd"
213          done          for ii in $PTRACERS_NUM ; do
214          tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){t+=($i==$1)}; print t }'`              ptrfound=0
215                for jj in $ptr_mon ; do
216                    name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`
217                    tst=`grep $name $outpref | wc -l | awk '{print $1}'`
218                    if test ! "x$tst" = x0 ; then ptrfound=1 ; fi
219                done
220                if test $ptrfound = '1' ; then
221                    eval "HAVE_PTR0"$ii"=t"
222                else
223                    eval "HAVE_PTR0"$ii"=f"
224                  if test "x$ADM" = x -a "x$OADM" = x; then
225                  # 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
227                    listVar=`echo "$listVar" | sed "s/ pt$ii..//g"`
228                  fi
229                fi
230            #   eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' 1>&2
231            done
232            tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){if($i==$1)t+=1}; print t }'`
233          if test $tst != 1 ; then          if test $tst != 1 ; then
234            if test $tst = 0 ; then echo "==> WARNING: selected var >$sVar< not found" 1>&2            if test $tst = 0 ; then echo "==> WARNING: selected var >$sVar< not found" 1>&2
235                   else echo "==> WARNING: found selected var >$sVar< $tst times" 1>&2 ; fi                   else echo "==> WARNING: found selected var >$sVar< $tst times" 1>&2 ; fi
# Line 262  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"          echo "listVar='$listVar'" >> $locDIR"/summary.txt"
242            #---
243          allargs=""          allargs=""
244          for xx in $listVar          for xx in $listVar
245          do          do
246            case $xx in            case $xx in
247             'PS')  if [ $debug -gt 0 ]             'PS')  if [ $debug -gt 0 ]
248                    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
249                    testoutput_var $1 "cg2d_init_res" "cg2d init. residual" $2 $3; yy=$?                    testoutput_var $1 "cg2d_init_res" "Press. Solver (cg2d)" $2 $3; yy=$?
250                    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 ;;
251             'Tmn') testoutput_var $1 "dynstat_theta_min"  "theta minimum"  $2 $3; yy=$? ;;            'Cost') testoutput_var $1 "ADM  precision_derivative_cost" "ADM Cost" $2 $3; yy=$? ;;
252             'Tmx') testoutput_var $1 "dynstat_theta_max"  "theta maximum"  $2 $3; yy=$? ;;            'Grad') testoutput_var $1 "ADM  precision_derivative_grad" "ADM Grad" $2 $3; yy=$? ;;
253             'Tav') testoutput_var $1 "dynstat_theta_mean" "theta mean"     $2 $3; yy=$? ;;             'Tmn') testoutput_var $1 "dynstat_theta_min"  "Theta minimum"  $2 $3; yy=$? ;;
254             'Tsd') testoutput_var $1 "dynstat_theta_sd"   "theta s.d."     $2 $3; yy=$? ;;             'Tmx') testoutput_var $1 "dynstat_theta_max"  "Theta maximum"  $2 $3; yy=$? ;;
255             'Smn') testoutput_var $1 "dynstat_salt_min"  "salt minimum"    $2 $3; yy=$? ;;             'Tav') testoutput_var $1 "dynstat_theta_mean" "Theta mean"     $2 $3; yy=$? ;;
256             'Smx') testoutput_var $1 "dynstat_salt_max"  "salt maximum"    $2 $3; yy=$? ;;             'Tsd') testoutput_var $1 "dynstat_theta_sd"   "Theta Std.Dev"  $2 $3; yy=$? ;;
257             'Sav') testoutput_var $1 "dynstat_salt_mean" "salt mean"       $2 $3; yy=$? ;;             'Smn') testoutput_var $1 "dynstat_salt_min"  "Salt minimum"    $2 $3; yy=$? ;;
258             'Ssd') testoutput_var $1 "dynstat_salt_sd"   "salt s.d."       $2 $3; yy=$? ;;             'Smx') testoutput_var $1 "dynstat_salt_max"  "Salt maximum"    $2 $3; yy=$? ;;
259               'Sav') testoutput_var $1 "dynstat_salt_mean" "Salt mean"       $2 $3; yy=$? ;;
260               'Ssd') testoutput_var $1 "dynstat_salt_sd"   "Salt Std.Dev"    $2 $3; yy=$? ;;
261             'Umn') testoutput_var $1 "dynstat_uvel_min"  "U minimum"       $2 $3; yy=$? ;;             'Umn') testoutput_var $1 "dynstat_uvel_min"  "U minimum"       $2 $3; yy=$? ;;
262             'Umx') testoutput_var $1 "dynstat_uvel_max"  "U maximum"       $2 $3; yy=$? ;;             'Umx') testoutput_var $1 "dynstat_uvel_max"  "U maximum"       $2 $3; yy=$? ;;
263             'Uav') testoutput_var $1 "dynstat_uvel_mean" "U mean"          $2 $3; yy=$? ;;             'Uav') testoutput_var $1 "dynstat_uvel_mean" "U mean"          $2 $3; yy=$? ;;
264             'Usd') testoutput_var $1 "dynstat_uvel_sd"   "U s.d."          $2 $3; yy=$? ;;             'Usd') testoutput_var $1 "dynstat_uvel_sd"   "U Std.Dev"       $2 $3; yy=$? ;;
265             'Vmn') testoutput_var $1 "dynstat_vvel_min"  "V minimum"       $2 $3; yy=$? ;;             'Vmn') testoutput_var $1 "dynstat_vvel_min"  "V minimum"       $2 $3; yy=$? ;;
266             'Vmx') testoutput_var $1 "dynstat_vvel_max"  "V maximum"       $2 $3; yy=$? ;;             'Vmx') testoutput_var $1 "dynstat_vvel_max"  "V maximum"       $2 $3; yy=$? ;;
267             'Vav') testoutput_var $1 "dynstat_vvel_mean" "V mean"          $2 $3; yy=$? ;;             'Vav') testoutput_var $1 "dynstat_vvel_mean" "V mean"          $2 $3; yy=$? ;;
268             'Vsd') testoutput_var $1 "dynstat_vvel_sd"   "V s.d."          $2 $3; yy=$? ;;             'Vsd') testoutput_var $1 "dynstat_vvel_sd"   "V Std.Dev"       $2 $3; yy=$? ;;
269          'pt1mn'|'pt2mn'|'pt3mn'|'pt4mn'|'pt5mn') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`          'pt1mn'|'pt2mn'|'pt3mn'|'pt4mn'|'pt5mn') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`
270             testoutput_var $1 "trcstat_ptracer0"$ii"_min"  "p0"$ii"_min"   $2 $3; yy=$? ;;             testoutput_var $1 "trcstat_ptracer0"$ii"_min"  "p0"$ii"_min"   $2 $3; yy=$? ;;
271          'pt1mx'|'pt2mx'|'pt3mx'|'pt4mx'|'pt5mx') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`          'pt1mx'|'pt2mx'|'pt3mx'|'pt4mx'|'pt5mx') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`
# Line 294  testoutput_run() Line 273  testoutput_run()
273          'pt1av'|'pt2av'|'pt3av'|'pt4av'|'pt5av') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`          'pt1av'|'pt2av'|'pt3av'|'pt4av'|'pt5av') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`
274             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=$? ;;
275          '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/..$//'`
276             testoutput_var $1 "trcstat_ptracer0"$ii"_sd"   "p0"$ii"_sd"    $2 $3; yy=$? ;;             testoutput_var $1 "trcstat_ptracer0"$ii"_sd"   "p0"$ii"_StDv"  $2 $3; yy=$? ;;
277             'Qntmn') testoutput_var $1 "forcing_qnet_min" "Qnet minimum"  $2 $3; yy=$? ;;
278             'Qntmx') testoutput_var $1 "forcing_qnet_max" "Qnet maximum"  $2 $3; yy=$? ;;
279             'Qntav') testoutput_var $1 "forcing_qnet_mean" "Qnet mean"       $2 $3; yy=$? ;;
280             'Qntsd') testoutput_var $1 "forcing_qnet_sd"  "Qnet Std.Dev"  $2 $3; yy=$? ;;
281             'aSImn') testoutput_var $1 "seaice_area_min"   "SIce Area min"   $2 $3; yy=$? ;;
282             'aSImx') testoutput_var $1 "seaice_area_max"   "SIce Area max"   $2 $3; yy=$? ;;
283             'aSIav') testoutput_var $1 "seaice_area_mean"  "SIce Area mean"  $2 $3; yy=$? ;;
284             'aSIsd') testoutput_var $1 "seaice_area_sd"    "SIce Area StDv"  $2 $3; yy=$? ;;
285             'hSImn') testoutput_var $1 "seaice_heff_min"   "SIce Heff min"   $2 $3; yy=$? ;;
286             'hSImx') testoutput_var $1 "seaice_heff_max"   "SIce Heff max"   $2 $3; yy=$? ;;
287             'hSIav') testoutput_var $1 "seaice_heff_mean"  "SIce Heff mean"  $2 $3; yy=$? ;;
288             'hSIsd') testoutput_var $1 "seaice_heff_sd"    "SIce Heff StDv"  $2 $3; yy=$? ;;
289            'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $3; yy=$? ;;
290            'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South"  $2 $3; yy=$? ;;
291            'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North"  $2 $3; yy=$? ;;
292            'HthSiG') testoutput_var $1 "thSI_IceH_ave_G" "thSIc H Global"    $2 $3; yy=$? ;;
293            'HthSiS') testoutput_var $1 "thSI_IceH_ave_S" "thSIc H South"     $2 $3; yy=$? ;;
294            'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North"     $2 $3; yy=$? ;;
295                *) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;;                *) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;;
296            esac            esac
297            if test $xx = $sVar            if test $xx = $sVar
# Line 304  testoutput_run() Line 301  testoutput_run()
301          done          done
302    
303          nbVar=`echo $listVar | awk '{print NF}'`          nbVar=`echo $listVar | awk '{print NF}'`
304          if [ $nbVar -lt $nbDef ] ; then          if [ $nbVar -lt $LEN_CHECK_LIST ] ; then
305          #-- fill line (up to standard length) with dot:          #-- fill line (up to standard length) with dot:
306            adNul=`expr $nbDef - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'`            adNul=`expr $LEN_CHECK_LIST - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'`
307            echo $allargs $adNul            echo $allargs $adNul
308          else          else
309            echo $allargs            echo $allargs
310          fi          fi
311    # <-- same processing for adjoint & forward test
     else  
         testoutput_ad $1 $2 "precision_grdchk_result"  
     fi  
312  }  }
313    
314  genmakemodel()  genmakemodel()
# Line 331  genmakemodel() Line 325  genmakemodel()
325          (          (
326              cd $1;              cd $1;
327              command="$GENMAKE2  -ds -m $MAKE"              command="$GENMAKE2  -ds -m $MAKE"
328              if test "x$ADM" = x ; then              if test "x$MKDEPEND" != x ; then
329                  command="$command --mods=../code"                  command="$command -makedepend=$MKDEPEND"
330              else              fi
331                if test "x$ADM" = xt ; then
332                  command="$command --mods=../code_ad"                  command="$command --mods=../code_ad"
333                elif test "x$OADM" = xt ; then
334                    command="$command -adof ../../../tools/adjoint_options/adjoint_oad -mods '../code_oad ../../OpenAD/code_oad_all'"
335                else
336                    command="$command -mods=../code"
337              fi              fi
338              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
339                  command="$command --optfile=$OPTFILE"                  command="$command -optfile=$OPTFILE"
340              fi              fi
341              if test "x$IEEE" != x ; then              if test "x$IEEE" != x ; then
342                  command="$command -ieee"                  command="$command -ieee"
343              fi              fi
344              if test "x$MPI" = xt ; then              if test "x$GSL" = xt ; then
345                    command="$command -gsl"
346                fi
347                if test "x$MPI" != x0 ; then
348                  command="$command -mpi"                  command="$command -mpi"
349              fi              fi
350                if test "x$MULTI_THREAD" = xt ; then
351                #- run multi-threaded using OpenMP:
352                    command="$command -omp"
353                fi
354                if test "x$USE_R4" = xt ; then
355                    command="$command -use_r4"
356                fi
357              if test "x$TS" = xt ; then              if test "x$TS" = xt ; then
358                  command="$command -ts"                  command="$command -ts"
359              fi              fi
360              if test "x$PAPIS" = xt ; then              if test "x$PAPIS" = xt ; then
361                  command="$command -papis"                  command="$command -papis"
362              else              else
363              if test "x$PCLS" = xt ; then              if test "x$PCLS" = xt ; then
364                  command="$command -pcls"                  command="$command -pcls"
365              fi              fi
366              fi              fi
367              printf 'genmake ... ' 1>&2              printf 'genmake ... '
368              $command > make.log 2>&1              eval $command > genmake.tr_log 2>&1
369              RETVAL=$?              RETVAL=$?
370              #  Reduce the size of the testing emails!              #  Reduce the size of the testing emails!
371              head -100 Makefile > $CDIR/Makefile_head              head -100 Makefile > $CDIR/Makefile_head
372              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
373                  tail make.log                  tail genmake.tr_log
374                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed"
375                  cp genmake_* make.log $CDIR                  cp genmake.log genmake_* genmake.tr_log $CDIR
376                  return 1                  return 1
377              else              else
378                  echo "successful" 1>&2                  echo "successful"
379              fi              fi
380          )          )
381      fi      fi
# Line 375  genmakemodel() Line 384  genmakemodel()
384  makeclean()  makeclean()
385  {  {
386      # makeclean directory      # makeclean directory
387        if test "x$NODEPEND" = xf ; then rm -f $1/make.tr_log ; fi
388      if test "x$NOCLEAN" = xt ; then      if test "x$NOCLEAN" = xt ; then
389          echo "make Clean skipped!"          echo "make Clean skipped!"
390      else      else
# Line 382  makeclean() Line 392  makeclean()
392              cd $1;              cd $1;
393              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi
394              if test -r Makefile ; then              if test -r Makefile ; then
395                  printf 'clean build-dir: make Clean ... ' 2>&1                  printf 'clean build-dir: make Clean ... '
396                  $MAKE Clean >> make.log 2>&1                  $MAKE Clean >> make.tr_log 2>&1
397                  RETVAL=$?                  RETVAL=$?
398                  if test "x$RETVAL" != x0 ; then                  if test "x$RETVAL" != x0 ; then
399                      tail make.log                      tail make.tr_log
400                      echo "makeclean: \"make Clean\" failed" 1>&2                      echo "makeclean: \"make Clean\" failed"
401                      cp make.log $CDIR"/make.log"                      cp make.tr_log genmake.log genmake.tr_log $CDIR
402                      return 1                      return 1
403                  fi                  fi
404                    echo successful
405                else
406                    echo ''
407              fi              fi
             echo successful 1>&2  
408              exit 0              exit 0
409          )          )
410      fi      fi
# Line 406  run_clean() Line 418  run_clean()
418      else      else
419          (          (
420              cd $1;              cd $1;
421              printf 'clean run-dir ... ' 2>&1              printf 'clean run-dir ... '
422              # part of what is done after "make clean" when doing "make CLEAN"              # part of what is done after "make clean" when doing "make CLEAN"
423              find . -name "*.meta" -exec rm {} \;              find . -name "*.meta" -exec rm {} \;
424              find . -name "*.data" -exec rm {} \;              find . -name "*.data" -exec rm {} \;
425              find . -name "fort.*" -exec rm {} \;              find . -name "fort.*" -exec rm {} \;
426              find . -type l -exec rm {} \;              find . -type l -exec rm {} \;
427              rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime              #- should remove executable only if sym-link (and above does it)
428                #rm -f $EXECUTABLE
429                rm -f $RUNLOG *.txt STD* *diagnostics.log datetime
430              rm -rf mnc_test_*              rm -rf mnc_test_*
431              echo successful 1>&2              rm -f *_MIT_CE_000.opt0000 costfunction*0000
432                echo successful
433              exit 0              exit 0
434          )          )
435      fi      fi
# Line 428  makedependmodel() Line 443  makedependmodel()
443      else      else
444          (          (
445              cd $1;              cd $1;
446              printf 'make depend ... ' 1>&2              printf 'make depend ... '
447              $MAKE depend >> make.log 2>&1              $MAKE depend >> make.tr_log 2>&1
448              RETVAL=$?              RETVAL=$?
449              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
450                  tail make.log                  tail make.tr_log
451                  echo "makedependmodel: make depend failed" 1>&2                  echo "makedependmodel: make depend failed"
452                  cp make.log $CDIR"/make.log"                  cp make.tr_log genmake.log genmake.tr_log $CDIR
453                  return 1                  return 1
454              else              else
455                  echo successful 1>&2                  echo successful
456              fi              fi
457          )          )
458      fi      fi
# Line 447  makemodel() Line 462  makemodel()
462  {  {
463      # makemodel directory      # makemodel directory
464      (      (
465        mk_fail=0
466        if test "x$NOMAKE" = xt ; then
467            cd $1;
468            if test -x $EXECUTABLE ; then
469                echo "make skipped!"
470            else
471                echo "no executable!"
472                mk_fail=3
473            fi
474        else
475          cd $1;          cd $1;
476          if test -r Makefile ; then          if test -r Makefile ; then
477              printf 'make ... ' 1>&2              printf 'make ... '
478              if test "x$ADM" = x ; then              if test "x$ADM" = xt ; then
479                    $MAKE adall >> make.tr_log 2>&1
480                elif test "x$OADM" = xt ; then
481                    $MAKE adAll >> make.tr_log 2>&1
482                else
483                  if test "x$JOBS" = x ; then                  if test "x$JOBS" = x ; then
484                      $MAKE >> make.log 2>&1                      $MAKE >> make.tr_log 2>&1
485                  else                  else
486                      $MAKE -j $JOBS >> make.log 2>&1                      $MAKE -j $JOBS >> make.tr_log 2>&1
487                  fi                  fi
             else  
                 $MAKE adall >> make.log 2>&1  
488              fi              fi
489              RETVAL=$?              RETVAL=$?
490              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
491                  tail make.log                  tail make.tr_log
492                  echo failed 1>&2                  echo failed
493                  cp make.log $CDIR"/make.log"                  cp make.tr_log genmake.log genmake.tr_log $CDIR
494                  return 1                  rm -f $EXECUTABLE
495                    mk_fail=1
496              else              else
497                  echo successful 1>&2                  echo successful
498              fi              fi
499            else
500                echo "no Makefile !"
501                mk_fail=2
502          fi          fi
503        fi
504        if test "x$ADM" = xt -a -f taf_ad.log ; then
505                head -1 taf_ad.log >> $CDIR"/summary.txt"
506                nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log`
507                nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log`
508                echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \
509                                    >> $CDIR"/summary.txt"
510        fi
511        if test $mk_fail != 0 ; then return $mk_fail ; fi
512      )      )
513  }  }
514    
515    mk_mpi_size()
516    {
517        # mk_mpi_size input_file output_file proc_Nb
518        #
519        # make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file)
520        #     for an MPI build with no more than proc_Nb processors ;
521        # return the effective number of processors.
522    
523        inp=$1
524        out=$2
525        np=$3
526        tmp=TTT.$$
527    
528        px=`grep "^     & *nPx *=" $inp | sed "s/^     & *nPx *= *//" | sed 's/, *$//'`
529        py=`grep "^     & *nPy *=" $inp | sed "s/^     & *nPy *= *//" | sed 's/, *$//'`
530        sx=`grep "^     & *nSx *=" $inp | sed "s/^     & *nSx *= *//" | sed 's/, *$//'`
531        sy=`grep "^     & *nSy *=" $inp | sed "s/^     & *nSy *= *//" | sed 's/, *$//'`
532    
533        #- find the largest divisor of input_file proc Nb, but not larger than $np
534        pp=0
535        i=1
536        while [ $i -le $px ] ; do
537          if [ `expr $px % $i` -eq 0 ] ; then
538            j=1
539            while [ $j -le $py ] ; do
540              if [ `expr $py % $j` -eq 0 ] ; then
541                ij=`expr $i \* $j`
542                if [ $ij -gt $pp ] ; then
543                  if [ $ij -le $np ] ; then
544                    ix=$i ; jy=$j ; pp=$ij
545                    #echo "  ix,jy= $ix,$jy"
546                  fi
547                fi
548              fi
549              j=`expr $j + 1`
550            done
551          fi
552          i=`expr $i + 1`
553        done
554    
555        #- create new SIZE.h type file:
556        sx=`expr $sx \* $px / $ix`
557        sy=`expr $sy \* $py / $jy`
558        if [ $verbose -gt 1 ]; then
559            echo " px,py,np= $px,$py,$np : New MPI size: px,py= $ix,$jy : sx,sy= $sx,$sy"
560        fi
561        sed "/^     \& *nPx *=/s/[0-9]*,/$ix,/" $inp > $tmp
562        sed "/^     \& *nPy *=/s/[0-9]*,/$jy,/" $tmp > $out
563        sed "/^     \& *nSx *=/s/[0-9]*,/$sx,/" $out > $tmp
564        sed "/^     \& *nSy *=/s/[0-9]*,/$sy,/" $tmp > $out
565        rm -f $tmp
566        return $pp
567    }
568    
569  symlink_mpifiles()  symlink_mpifiles()
570  {  {
571      # Put special links so that MPI specific files are used      # Put special links so that MPI specific files are used
# Line 480  symlink_mpifiles() Line 574  symlink_mpifiles()
574    
575      dir=$1      dir=$1
576      code_dir=$2      code_dir=$2
577      BUILD_DIR=$dir/$3      build_dir=$dir/$3
578      CODE_DIR=$dir/$code_dir  
       
579      # These are files that should replace their counter-part when using -mpi      # These are files that should replace their counter-part when using -mpi
580      MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")`      MPI_FILES=`(cd $dir/$code_dir; find . -name "*_mpi" -print)`
581    
582      #  Is this an MPI run?      for ii in $MPI_FILES ; do
583      if test "x$MPI" = xt ; then          i=`echo $ii | sed 's:^\./::'`
584          # YES: We symbolically link these files to the build          name=`echo $i | sed 's:_mpi::'`
585          # dir so long as there is no real file in place          file="../$code_dir/$i"
586          for ii in $MPI_FILES ; do          if test $name = 'SIZE.h' ; then file="SIZE.h.mpi" ; fi
587              i=`echo $ii | sed 's:^\./::'`  
588              name=`echo $i | sed 's:_mpi::' `          #  Is this an MPI run?
589              cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1          if test "x$MPI" = x0 ; then
590              RETVAL=$?              # NO: We undo any _mpi symbolically linked files
591              if test "x$RETVAL" != x0 ; then              if test -L $build_dir/$name ; then
592                  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  
593                  RETVAL=$?                  RETVAL=$?
594                  if test "x$RETVAL" = x0 ; then                  if test "x$RETVAL" = x0 ; then
595                      #echo Un-linking $name from $linktarg                      if [ $verbose -gt 1 ]; then
596                      rm -f $BUILD_DIR/$name                          echo "  Un-linking $name from ../$code_dir" ; fi
597                        rm -f $build_dir/$name
598                  fi                  fi
599              fi              fi
600          done          else
601      fi              # YES: We symbolically link these files to the build
602                    # dir so long as there is no real file in place
603                ( cd $build_dir ; cmp $name $file > /dev/null 2>&1 )
604                RETVAL=$?
605                if [ $verbose -gt 1 ]; then echo "  cmp $name $file returns: $RETVAL" ; fi
606                if test "x$RETVAL" != x0 ; then
607                    if test -h $build_dir/$name ; then rm -f $build_dir/$name ; fi
608                    if test ! -r $build_dir/$name ; then
609                        if [ $verbose -gt 1 ]; then echo "  Linking $name to $file" ; fi
610                        (cd $build_dir; ln -sf $file $name)
611                    fi
612                fi
613            fi
614        done
615  }  }
616    
617  linkdata()  linkdata()
# Line 528  linkdata() Line 622  linkdata()
622      if test -d $1 ; then      if test -d $1 ; then
623          (          (
624              cd $1 ; shift              cd $1 ; shift
625                echo 'linkdata from dirs:' $*
626                inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')`
627                for xx in $inpMPI ; do
628                  if test -r "../"$1"/"$xx ; then
629                    # found 1 _mpi sfx file in 1rst input dir and it is readable
630                    yy=`echo $xx | sed 's:\.mpi$::'`
631                    if test "x$MPI" = "x0" ; then
632                        # not mpi test: remove symbolic link
633                        if test -h $yy ; then rm -f $yy ; fi
634                    else
635                        # mpi test: remove symbolic link & link .mpi sfx file
636                        if test -h $yy ; then rm -f $yy ; fi
637                        if test ! -r $yy ; then
638                            ln -sf "../"$1"/"$xx $yy ;
639                            printf " $xx" 1>&2
640                        fi
641                    fi
642                  fi
643                done
644              if test -r "../"$1"/eedata.mth" ; then              if test -r "../"$1"/eedata.mth" ; then
645              # found eedata.mth in 1rst input dir and it is readable              # found eedata.mth in 1rst input dir and it is readable
646                  if test "x$MULTI_THREAD" = "xt" ; then                  if test "x$MULTI_THREAD" = "xt" ; then
647                  # multi-threaded test: remove symbolic link & link eedata.mth                  # multi-threaded test: remove symbolic link & link eedata.mth
648                      if test -h eedata ; then rm -f eedata ; fi                      if test -h eedata ; then rm -f eedata ; fi
649                      if test ! -r eedata ; then                      if test ! -r eedata ; then
650                          ln -sf "../"$1"/eedata.mth" eedata ;                          ln -sf "../"$1"/eedata.mth" eedata ;
651                          printf 'eedata.mth ' 1>&2                          printf ' eedata.mth' 1>&2
652                      fi                      fi
653                  else                  else
654                  # not multi-threaded test: remove eedata symbolic link                  # not multi-threaded test: remove eedata symbolic link
655                      if test -h eedata ; then rm -f eedata ; fi                      if test -h eedata ; then rm -f eedata ; fi
656                  fi                  fi
657              fi              fi
658                prevDir='NONE'
659              for ldir in $* ; do              for ldir in $* ; do
660                  if test -d "../"$ldir ; then                  if test -d "../"$ldir -a $ldir != $prevDir ; then
661                      printf 'ldir='${ldir} 1>&2                      printf " ldir=${ldir}:" 1>&2
662                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`
663                      for i in $files ; do                      for i in $files ; do
664                          if test ! -d "../"$ldir/$i ; then                          if test ! -d "../"$ldir/$i ; then
# Line 554  linkdata() Line 668  linkdata()
668                              fi                              fi
669                          fi                          fi
670                      done                      done
671                        printf ' ;' 1>&2
672                      if test -x "../"$ldir"/"prepare_run ; then                      if test -x "../"$ldir"/"prepare_run ; then
673                          "../"$ldir"/"prepare_run                          "../"$ldir"/"prepare_run 1>&2
674                        else
675                            echo '' 1>&2
676                      fi                      fi
                     printf ' ; ' 1>&2  
677                  fi                  fi
678                    prevDir=$ldir
679              done              done
680          )          )
681      fi      fi
# Line 568  runmodel() Line 685  runmodel()
685  {  {
686      # runmodel directory      # runmodel directory
687      #      #
688      #  runs "$COMMAND in "directory"      #  runs $COMMAND in "directory"
689      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
690      (      (
691          cd $1          cd $1
692          printf 'runmodel in %s ...' $1 1>&2          printf 'runmodel in %s ... ' $1
693          # make output.txt          if test "x$MPI" != x0 ; then
694          echo              #- adjust the MPI run command with the right number of Procs
695                #echo '' ; echo "  COMMAND='$COMMAND'"
696                COMMAND=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"`
697                if test "x$MPI_MFILE" != x ; then
698                  COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"`
699                fi
700                #echo "  COMMAND='$COMMAND'"
701            fi
702            if test -L $EXECUTABLE ; then
703              if test -x "../"$builddir"/"$EXECUTABLE ; then
704                cmp $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1
705                outD=$? ; if test "x$outD" != x0 ; then rm -f $EXECUTABLE ; fi
706              else rm -f $EXECUTABLE
707              fi
708            fi
709          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
710              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_tmp
711              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
712          fi          fi
713          if test ! -x $EXECUTABLE ; then          if test ! -x $EXECUTABLE ; then
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                  echo " no executable:" $EXECUTABLE >> run.log              echo " no executable:" $EXECUTABLE >> $RUNLOG
717                  RETVAL=8              RETVAL=8
718                  ENDVAL=-1              ENDVAL=-1
719          else          else
720              if test $OUTPUTFILE -ot $EXECUTABLE ; then            if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then
721                  rm -f run.log ; touch run.log              # output do not exist or is older than executable:
722                  if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi              rm -f $RUNLOG ; touch $RUNLOG
723                  ( eval $COMMAND ) >> run.log 2>&1              if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
724                  RETVAL=$?              ( eval $COMMAND ) >> $RUNLOG 2>&1
725              else              RETVAL=$?
726                  RETVAL=0              ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
727                  if test -f run.log ; then              if [ $POSTCLEAN -eq 1 -a $ENDVAL -gt 0 ] ; then
728                      if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi                  find . -name "*.meta" -exec rm {} \;
729                      echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1                  find . -name "*.data" -exec rm {} \;
730                  else                  rm -rf mnc_test_*
                     touch run.log  
                     if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi  
                     echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1  
                     echo " no previous run.log: assume NORMAL END" >> run.log 2>&1  
                 fi  
731              fi              fi
732              ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`            else
733                RETVAL=0
734                ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
735                touch $RUNLOG
736                if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
737                echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1
738              fi
739            fi
740            rm -f run.log_tmp
741            #- in all cases where OutputFile exists, report SIZE (and AD time)
742            if test -f $OUTPUTFILE ; then
743              grep '(PID\.TID 0000\.0001)      n.. =' $OUTPUTFILE \
744                    | sed 's/(PID.TID 0000.0001)     //' >> $CDIR"/summary.txt"
745              if test "x$ADM" = xt ; then
746                grep -A3 'Seconds in section "ALL' $OUTPUTFILE >> $CDIR"/summary.txt"
747              fi
748          fi          fi
749          rm -f run.log_00          if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
         #if test "x$RETVAL" = x0 ; then  
750          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
751              tail run.log              echo successful
752              echo successful 1>&2              printf '=> output from running in %s :\n' $1 1>&2
753              # === Reduce the size of the testing emails!              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
754              #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE              return 0
755              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi          elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then
756                #-- for some weird cases (run is finihed but with error code)
757                echo 'finished with error (run:' $RETVAL ' end:' $ENDVAL ')'
758                printf '=> output from running in %s :\n' $1 1>&2
759                tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
760              return 0              return 0
761          else          else
762              tail run.log              echo 'failed (run:' $RETVAL ' end:' $ENDVAL ')'
763              echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2              printf '=> output from running in %s :\n' $1 1>&2
764              cp run.log $CDIR"/run.log"              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
765              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi              cp $RUNLOG $CDIR"/"$RUNLOG
766              return 1              return 1
767          fi          fi
768      )      )
# Line 628  createcodelet() Line 772  createcodelet()
772  {  {
773      # create codelet for comparing model output      # create codelet for comparing model output
774    
775      printf "creating the comparison code...  "      printf "creating the comparison code (using CC=$CC)...  "
776      cat > tr_cmpnum.c <<EOF      cat > tr_cmpnum.c <<EOF
777  #include <stdio.h>  #include <stdio.h>
778  #include <math.h>  #include <math.h>
# Line 637  int main( int argc, char** argv )  { Line 781  int main( int argc, char** argv )  {
781    double a,b,abave,relerr;    double a,b,abave,relerr;
782    best = -22;    best = -22;
783    lncnt = 0;    lncnt = 0;
784    while( 1 & (lncnt+=1) < 999 )  {    while( 1 & ( (lncnt+=1) < 999 ) )  {
785      scanf("%d", &linnum);      scanf("%d", &linnum);
786      if (linnum == -1)  break;      if (linnum == -1)  break;
787      scanf("%lf", &a);  scanf("%lf", &b);      scanf("%lf", &a);  scanf("%lf", &b);
# Line 668  EOF Line 812  EOF
812          return 0          return 0
813      else      else
814          echo          echo
815          echo "ERROR: failed to compile comparison code -- please specify"          echo "ERROR: failed to compile comparison code -- please specify"
816          echo "  a C compiler using the CC environment variable."          echo "  a C compiler using the CC environment variable."
817          exit 1          exit 1
818      fi      fi
# Line 684  formatresults() Line 828  formatresults()
828      listPrt=$@      listPrt=$@
829      listRes=`echo $listPrt | sed 's/>//' | sed 's/<//'`      listRes=`echo $listPrt | sed 's/>//' | sed 's/<//'`
830      xx=`echo $listPrt | sed 's/.*>//' | sed 's/<.*//' | awk '{print $1}'`      xx=`echo $listPrt | sed 's/.*>//' | sed 's/<.*//' | awk '{print $1}'`
831      printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</'      printf '%3s' $listPrt
832  #   printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > / /' | sed 's/  < / /'  #   line below does not work on hp-ux_ia64 : do those substitutions later on
833        #   printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</'
834    
835      if [ $xx = '..' ]; then      if [ $xx = '..' ]; then
836          printf ' N/O '          printf ' N/O '
837      elif [ $xx = '--' ]; then      elif [ $xx = '--' ]; then
# Line 702  formatresults() Line 847  formatresults()
847      fi      fi
848      printf '  %s' $nm      printf '  %s' $nm
849      printf '\n'      printf '\n'
850        
851  }  }
852    
853  scandirs()  scandirs()
854  {  {
855      if [ $# -eq 1 ]; then      if [ $# -eq 1 ]; then
856          for arg in * ; do          for arg in * ; do
857              test -d $arg/$1 && echo $arg              test -f $arg/$1 && echo $arg
858          done          done
859      else      else
860          echo $*          echo $*
# Line 717  scandirs() Line 862  scandirs()
862  }  }
863    
864    
865    check_eedata()
866    {
867        # check_eedata size.h eedata
868        if [ $# -eq 2 ] ; then
869          if test -f $1 -a -f $2 ; then
870          sx=`grep "^     & *nSx *=" $1 | sed "s/^     & *nSx *=//" | sed 's/, *$//'`
871          nx=`grep "^ *nTx *=" $2 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
872          if test "x$nx" = x ; then
873            rx=10
874          else
875            rx=`expr $sx % $nx`
876          fi
877          sy=`grep "^     & *nSy *=" $1 | sed "s/^     & *nSy *=//" | sed 's/, *$//'`
878          ny=`grep "^ *nTy *=" $2 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
879          if test "x$ny" = x ; then
880            ry=20
881          else
882            ry=`expr $sy % $ny`
883          fi
884          echo `expr $rx + $ry`
885        else
886          echo '-1'
887          fi
888        else
889          echo '-2'
890        fi
891    
892    }
893    
894  ###############################################################################  ###############################################################################
895    
896    
897  #  Default properties  #  Default properties
898  debug=0  debug=0
899  verbose=1  verbose=1
 clean=0  
 expts=''  
 # ieee=1  
900    
901  IEEE=true  IEEE=true
902  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
903      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
904  fi  fi
905    GSL=f
906    
907  CLEANUP=f  CLEANUP=f
908    NORUN=f
909  QUICK=f  QUICK=f
910    NOMAKE=f
911  NOGENMAKE=f  NOGENMAKE=f
912  NOCLEAN=f  NOCLEAN=f
913  NODEPEND=f  NODEPEND=f
914  POSTCLEAN=f  POSTCLEAN=0
915    
916  BASH=  BASH=
917  OPTFILE=NONE  OPTFILE=NONE
# Line 747  TESTDIRS= Line 920  TESTDIRS=
920  SKIPDIRS=  SKIPDIRS=
921  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
922  HAVE_MPACK=  HAVE_MPACK=
923  MPACK="$MPACKDIR/mpack"  MPACK=
924  COMMAND=  COMMAND=
925    MKDEPEND=
926  if test "x$MAKE" = x ; then  if test "x$MAKE" = x ; then
927      MAKE=make      MAKE=make
928  fi  fi
# Line 756  if test "x$CC" = x ; then Line 930  if test "x$CC" = x ; then
930      CC=cc      CC=cc
931  fi  fi
932  JOBS=  JOBS=
933  MPI=f  MPI=0
934    MPI_MFILE=
935  MULTI_THREAD=f  MULTI_THREAD=f
936  OUTDIR=  OUTDIR=
937  DELDIR=  DELDIR=
938    USE_R4=
939    
940  ADM=  ADM=
941    OADM=
942    
943  # Additional monitor types  # list of pTracers to check for monitor output
944  PTRACERS_NUM="1 2 3 4 5"  PTRACERS_NUM="1 2 3 4 5"
945    
946  MATCH_CRIT=13  MATCH_CRIT=10
947    
948  printf "parsing options...  "  printf "parsing options...  "
949    
# Line 781  for ac_option ; do Line 958  for ac_option ; do
958      fi      fi
959    
960      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
961        
962      case $ac_option in      case $ac_option in
963                    
964          -help | --help | -h | --h)          -help | --help | -h | --h) usage ;;
965              usage ;;  
966                    -optfile | --optfile | -of | --of) ac_prev=OPTFILE ;;
967          -optfile | --optfile | -of | --of)          -optfile=* | --optfile=* | -of=* | --of=*) OPTFILE=$ac_optarg ;;
968              ac_prev=OPTFILE ;;  
969          -optfile=* | --optfile=* | -of=* | --of=*)          -addr | --addr | -a | --a) ac_prev=ADDRESSES ;;
970              OPTFILE=$ac_optarg ;;          -addr=* | --addr=* | -a=* | --a=*) ADDRESSES=$ac_optarg ;;
971                    -mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;;
972          -addr | --addr | -a | --a)          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;;
973              ac_prev=ADDRESSES ;;  
974          -addr=* | --addr=*)          -tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;;
975              ADDRESSES=$ac_optarg ;;          -tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;;
976            -skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;;
977          -tdir | --tdir | -t | --t)          -skipdir=* | --skipdir=* | -skd=* | --skd=*) SKIPDIRS=$ac_optarg ;;
978              ac_prev=TESTDIRS ;;  
979          -tdir=* | --tdir=*)          -bash | --bash | -b | --b) ac_prev=BASH ;;
980              TESTDIRS=$ac_optarg ;;          -bash=* | --bash=* | -b=* | --b=*) BASH=$ac_optarg ;;
981    
982          -skipdir | --skipdir | -skd | --skd)          -command | --command | -c | --c) ac_prev=COMMAND ;;
983              ac_prev=SKIPDIRS ;;          -command=* | --command=* | -c=* | --c=*) COMMAND=$ac_optarg ;;
984          -skipdir=* | --skipdir=*)  
985              SKIPDIRS=$ac_optarg ;;          -makedepend | --makedepend | -md | --md) ac_prev=MKDEPEND ;;
986            -makedepend=* | --makedepend=* | -md=* | --md=*) MKDEPEND=$ac_optarg ;;
987          -bash | --bash | -b | --b)  
988              ac_prev=BASH ;;          -make | --make | -m | --m) ac_prev=MAKE ;;
989          -bash=* | --bash=*)          -make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;;
990              BASH=$ac_optarg ;;  
991            -odir | --odir) ac_prev=OUTDIR ;;
992          -command | --command | -c | --c)          -odir=* | --odir=*) OUTDIR=$ac_optarg ;;
993              ac_prev=COMMAND ;;  
994          -command=* | --command=*)          -ptracers | --ptracers | -ptr | --ptr) ac_prev=PTRACERS_NUM ;;
995              COMMAND=$ac_optarg ;;          -ptracers=* | --ptracers=* | -ptr=* | --ptr=*) PTRACERS_NUM=$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 ;;  
996    
997          -match | --match ) ac_prev=MATCH_CRIT ;;          -match | --match ) ac_prev=MATCH_CRIT ;;
998          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;
999    
1000          -j) ac_prev=JOBS ;;          -j | --j) ac_prev=JOBS ;;
1001          -j=*) JOBS=$ac_optarg ;;          -j=* | --j=*) JOBS=$ac_optarg ;;
1002    
1003          -clean | --clean)          -clean | --clean) CLEANUP=t ; DELDIR=t ;;
             CLEANUP=t ; DELDIR=t ;;  
1004    
1005          -quick | --quick | -q | --q)          -norun | --norun | -nr | --nr) NORUN=t ;;
1006              QUICK=t ;;          -runonly | --runonly | -ro | --ro) QUICK=t ; NOMAKE=t ;;
1007          -nogenmake | --nogenmake | -ng | --ng)          -quick | --quick | -q | --q) QUICK=t ;;
1008              NOGENMAKE=t ;;          -nogenmake | --nogenmake | -ng | --ng) NOGENMAKE=t ;;
1009          -noclean | --noclean | -nc | --nc)          -noclean | --noclean | -nc | --nc) NOCLEAN=t ;;
1010              NOCLEAN=t ;;          -nodepend | --nodepend | -nd | --nd) NODEPEND=t ;;
1011          -nodepend | --nodepend | -nd | --nd)  
1012              NODEPEND=t ;;          -postclean | --postclean | -pc | --pc) POSTCLEAN=2 ;;
1013            -deloutp | --deloutp | -do | --do) POSTCLEAN=1 ;;
1014    
1015            -mpi | --mpi) MPI=2 ;;
1016            -MPI | --MPI) ac_prev=MPI ;;
1017            -MPI=* | --MPI=*) MPI=$ac_optarg ;;
1018    
1019          -postclean | --postclean | -pc | --pc)          -mfile | --mfile | -mf | --mf) ac_prev=MPI_MFILE ;;
1020              POSTCLEAN=t ;;          -mfile=* | --mfile=* | -mf=* | --mf=*) MPI_MFILE=$ac_optarg ;;
   
         -mpi) MPI=t ;;  
1021    
1022          -mth) MULTI_THREAD=t ;;          -mth) MULTI_THREAD=t ;;
1023    
1024          -adm | -ad) ADM=t ;;          -adm | -ad) ADM=t ;;
1025            -oad) OADM=t; NODEPEND=t ;;
1026    
1027          -ieee) IEEE=true ;;          -ieee) IEEE=true ;;
1028          -noieee) IEEE= ;;          -noieee) IEEE= ;;
1029            -gsl) GSL=t ;;
1030    
1031          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
1032          -debug) debug=1 ;;          -debug) debug=1 ;;
# Line 868  for ac_option ; do Line 1034  for ac_option ; do
1034    
1035          -deldir | -dd) DELDIR=t ;;          -deldir | -dd) DELDIR=t ;;
1036    
1037          -ts) TS=t;;          -use_r4|-ur4) USE_R4=t ;;
1038    
1039            -ts) TS=t;;
1040          -papis) PAPIS=t;;          -papis) PAPIS=t;;
   
1041          -pcls) PCL=t;;          -pcls) PCL=t;;
1042    
1043          -*)          -*) echo "Error: unrecognized option: "$ac_option
1044              echo "Error: unrecognized option: "$ac_option              usage ;;
1045              usage          *)  echo "Error: unrecognized argument: "$ac_option
1046              ;;              usage ;;
1047            
         *)  
             echo "Error: unrecognized argument: "$ac_option  
             usage  
             ;;  
           
1048       esac       esac
1049        
1050  done  done
1051    
1052  if test "x$QUICK" = xt ; then  if test "x$QUICK" = xt ; then
# Line 894  if test "x$QUICK" = xt ; then Line 1055  if test "x$QUICK" = xt ; then
1055      NODEPEND=t      NODEPEND=t
1056  fi  fi
1057    
1058  if test "x$TESTDIRS" = x ; then  #- check length of MPI machine file:
1059      if test "x$ADM" = xt ; then  if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then
1060          LIST=`scandirs results_ad`      if test -r $MPI_MFILE ; then
1061            nl=`wc -l $MPI_MFILE | awk '{print $1}'`
1062            if [ $nl -lt $MPI ] ; then
1063              echo "Error: need at least $MPI nodes (currently only $nl) in MPI_MFILE=$MPI_FILE"
1064              usage
1065            fi
1066            if [ $verbose -gt 1 ]; then
1067                echo " MPI_MFILE=$MPI_MFILE : $nl procs for MPI=$MPI run"
1068            fi
1069      else      else
1070          LIST=`scandirs results`            echo "Error: cannot access MPI_MFILE=$MPI_FILE"
1071              usage
1072      fi      fi
1073    fi
1074    
1075    #- setting for forward or ADM testing
1076    if test "x$ADM" = xt ; then
1077        code_dir=code_ad
1078        inputdir=input_ad
1079        ref_outp="output_adm.txt"
1080        EXECUTABLE="mitgcmuv_ad"
1081    elif test "x$OADM" = xt ; then
1082        code_dir=code_oad
1083        inputdir=input_oad
1084        ref_outp="output_oadm.txt"
1085        EXECUTABLE="mitgcmuv_ad"
1086    else
1087        code_dir=code
1088        inputdir=input
1089        ref_outp="output.txt"
1090        EXECUTABLE="mitgcmuv"
1091    fi
1092    
1093    xx=`echo $TESTDIRS | awk '{print $1}'`
1094    if test "x$TESTDIRS" = x ; then
1095        LIST=`scandirs results/$ref_outp`
1096    elif test $xx = 'start_from' ; then
1097        xx=`echo $TESTDIRS | awk '{print $2}'`
1098        LIST=`scandirs results/$ref_outp | sed -n "/$xx/,$ p"`
1099  else  else
1100      #- expand group of experiments:      #- expand group of experiments:
1101      LIST=" "      LIST=" "
# Line 914  else Line 1110  else
1110                   LIST=${LIST}" "`ls | grep 'tutorial_'` ;;                   LIST=${LIST}" "`ls | grep 'tutorial_'` ;;
1111          *)       LIST=${LIST}" "$xx ;;          *)       LIST=${LIST}" "$xx ;;
1112        esac        esac
1113      done      done
1114  fi  fi
1115  #echo 'LIST='${LIST}'<'  #echo 'LIST='${LIST}'<'
1116  #- skip dirs, remove duplicate and non-directory:  #- skip dirs, remove duplicate and non-directory:
# Line 935  do Line 1131  do
1131          else count=1 ; echo "" ;  echo -n " skip: \"$xx\""          else count=1 ; echo "" ;  echo -n " skip: \"$xx\""
1132          fi          fi
1133      fi      fi
1134  done  done
1135  if test $count = 1 ; then echo "" ; echo -n " ... " ; fi  if test $count = 1 ; then echo "" ; echo -n " ... " ; fi
1136  #echo 'TESTDIRS='${TESTDIRS}'<'  #echo 'TESTDIRS='${TESTDIRS}'<'
1137    
# Line 943  if test "x$OPTFILE" = xNONE -a "x$MITGCM Line 1139  if test "x$OPTFILE" = xNONE -a "x$MITGCM
1139      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
1140  fi  fi
1141    
1142  if test "x$ADM" = xt ; then  LOC_MFILE='tr_mpi_mfile'
1143      EXECUTABLE="mitgcmuv_ad"  RUNLOG="run.tr_log"
1144      OUTPUTFILE="output_adm.txt"  OUTPUTFILE=$ref_outp
 else  
     EXECUTABLE="mitgcmuv"  
     OUTPUTFILE="output.txt"  
 fi  
   
1145  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
1146      COMMAND="./$EXECUTABLE > $OUTPUTFILE"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
1147  fi  fi
1148  if test "x$MPI" = xt ; then  if test "x$MPI" != x0 ; then
1149      OUTPUTFILE="STDOUT.0000"      OUTPUTFILE="STDOUT.0000"
1150  fi  fi
1151    
 #echo "OK"  
1152  echo "OK (COMMAND= $COMMAND )"  echo "OK (COMMAND= $COMMAND )"
1153    
1154  # set the Default List of output variables to be checked:  # set the Default List of output variables to be checked:
1155  #  (use default or load experiment-specific list from file "tr_checklist")  #  (use default or load experiment-specific list from file "tr_checklist")
1156  # content : 1rst = main variable used to decide if it pass or FAIL  # content : 1rst = main variable used to decide if it pass or FAIL
1157  #         others = number of matching digits to be printed in summary.txt  #         others = number of matching digits to be printed in summary.txt
1158  if test "x$ADM" != xt ; then  if test "x$ADM" = x -a "x$OADM" = x; then
1159      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+'
1160      EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..'      EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..'
1161      nbDef=`echo $DEF_CHECK_LIST | awk '{print NF-1+3*gsub("+","E")}'`      LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`
1162      ii=`echo $EMPTY_RESULTS | awk '{print NF}'`      ii=`echo $EMPTY_RESULTS | awk '{print NF}'`
1163      EMPTY_RESULTS=$EMPTY_RESULTS`expr $nbDef - $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 "  ."}}'`
1164    else
1165        DEF_CHECK_LIST='Grad Cost Grad'
1166        EMPTY_RESULTS='.. ..'
1167        LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`
1168  fi  fi
1169    
1170  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
1171  createcodelet  if test -x tr_cmpnum ; then
1172        echo "skipping comparison code build"
1173    else
1174        createcodelet
1175    fi
1176    
1177  #  build the mpack utility  #  build the mpack utility (if ADDRESSES = NONE, do it to test the build)
1178  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then  if test "x$ADDRESSES" = x ; then
1179      echo "skipping mpack build"      echo "skipping mpack build"
1180  else  else
1181      build_mpack      build_mpack
1182  fi  fi
1183    
1184  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
1185    CMDLINE=$0
1186    for xx in "$@" ; do nw=`echo $xx | wc -w`
1187        if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"
1188                            else CMDLINE="$CMDLINE '$xx'" ; fi
1189    done
1190    #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done
1191  MACH=`hostname`  MACH=`hostname`
1192  UNAMEA=`uname -a`  UNAMEA=`uname -a`
1193  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
1194  BASE="tr_"$MACH"_"$DATE"_"  BASE="tr_"$MACH"_"$DATE"_"
1195  if test "x$OUTDIR" != x ; then  if test "x$OUTDIR" != x ; then
1196      BASE="tr_"$OUTDIR"_"$DATE"_"      BASE="tr_"$OUTDIR"_"$DATE"_"
1197    else
1198        short_name=`hostname | sed 's/\..*$//'`
1199        BASE="tr_"$short_name"_"$DATE"_"
1200  fi  fi
1201  DNUM=0  DNUM=0
1202  DRESULTS="$BASE$DNUM"  DRESULTS="$BASE$DNUM"
# Line 1004  if test "x$RETVAL" != x0 ; then Line 1211  if test "x$RETVAL" != x0 ; then
1211      exit 1      exit 1
1212  fi  fi
1213  SUMMARY="$DRESULTS/summary.txt"  SUMMARY="$DRESULTS/summary.txt"
 printf "Start time:  " >> $SUMMARY  
1214  start_date=`date`  start_date=`date`
1215  echo $start_date > $SUMMARY  echo $start_date > $SUMMARY
1216    echo 'run:' $CMDLINE >> $SUMMARY
1217    echo 'on :' $UNAMEA  >> $SUMMARY
1218    
1219  of_path=  of_path=
1220  if test "x$OPTFILE" != xNONE ; then  if test "x$OPTFILE" != xNONE ; then
# Line 1030  if test "x$OPTFILE" != xNONE ; then Line 1238  if test "x$OPTFILE" != xNONE ; then
1238      fi      fi
1239  else  else
1240      echo >> $SUMMARY      echo >> $SUMMARY
1241      echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY      echo "No \"OPTFILE\" was specified ; genmake2 found and uses:" >> $SUMMARY
1242      echo "   so the genmake default will be used." >> $SUMMARY      #-note: to be filled later after 1rst run
1243  fi  fi
1244  echo  echo
1245  echo >> $SUMMARY  echo >> $SUMMARY
1246  if test "x$ADM" = x ; then  if test "x$ADM" = x -a "x$OADM" = x; then
1247      if [ $MATCH_CRIT -lt 10 ] ;      if [ $MATCH_CRIT -lt 10 ] ;
1248      then line_0="default  "$MATCH_CRIT ;      then line_0="default  "$MATCH_CRIT ;
1249      else line_0="default "$MATCH_CRIT ; fi      else line_0="default "$MATCH_CRIT ; fi
1250         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"
 #   line_0="            ----T-----  ----S-----  ----U-----  ----V-----"  
1251      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"
1252      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  ."
1253      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"
1254      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  ."
1255      for ii in $PTRACERS_NUM ; do      for ii in $PTRACERS_NUM ; do
         #  tst=`eval 'echo $HAVE_PTR0'$ii`  
         #  if test "x$tst" = xt ; then  
1256          line_0="$line_0  --PTR 0"$ii"--"          line_0="$line_0  --PTR 0"$ii"--"
1257          line_1="$line_1        m  s"          line_1="$line_1        m  s"
1258          line_2="$line_2  m  m  e  ."          line_2="$line_2  m  m  e  ."
1259          line_3="$line_3  i  a  a  d"          line_3="$line_3  i  a  a  d"
1260          line_4="$line_4  n  x  n  ."          line_4="$line_4  n  x  n  ."
         #  fi  
1261      done      done
1262      echo "$line_0" | tee -a $SUMMARY      echo "$line_0" | tee -a $SUMMARY
1263      echo "$line_1" | tee -a $SUMMARY      echo "$line_1" | tee -a $SUMMARY
# Line 1064  if test "x$ADM" = x ; then Line 1268  if test "x$ADM" = x ; then
1268  else  else
1269      echo "ADJOINT=true" >> $SUMMARY      echo "ADJOINT=true" >> $SUMMARY
1270      echo >> $SUMMARY      echo >> $SUMMARY
1271        if [ $MATCH_CRIT -lt 10 ] ;
1272        then line_0="default     "$MATCH_CRIT ;
1273        else line_0="default    "$MATCH_CRIT ; fi
1274        echo "$line_0" | tee -a $SUMMARY
1275      cat << EOF | tee -a $SUMMARY      cat << EOF | tee -a $SUMMARY
1276  G D M    C  G  G D M    C  G
1277  E p a R  o  r  E p a R  o  r
# Line 1072  N n k u  s  a Line 1280  N n k u  s  a
1280    
1281  EOF  EOF
1282  fi  fi
1283    echo "-------------------------------------------------------------------------------"
1284    
1285  #  ...and each test directory...  #  ...and each test directory...
1286  for dir in $TESTDIRS ; do  for dir in $TESTDIRS ; do
1287        
1288        # set builddir & rundir:
1289        builddir="build"
1290        if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1291        rundir="run"
1292        pfxdir="tr_$rundir"
1293        if test ! -d $dir/$rundir ; then
1294            rundir=$builddir
1295        fi
1296        CODE_DIR=$dir/$code_dir
1297        BUILD_DIR=$dir/$builddir
1298    
1299      #  Cleanup only!      #  Cleanup only!
1300      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
1301          if test -r $dir/build/Makefile ; then          echo -n '  --- dir:' $BUILD_DIR ': '
1302              echo '  ------  clean dir:' $dir/build          makeclean $BUILD_DIR
1303              ( cd $dir/build ; make CLEAN )          (   cd $BUILD_DIR
1304          fi              rm -f $EXECUTABLE *.bak
1305          if test -d $dir/run/CVS ; then              rm -f genmake_state genmake_*optfile genmake.log
1306              echo '  ------  clean dir:' $dir/run              rm -f SIZE.h.mpi genmake.tr_log make.tr_log
             run_clean $dir/run  
         fi  
         (  
             cd $dir  
             rm -rf tr_run.*  
1307          )          )
1308            if test -d $dir/$rundir/CVS ; then
1309                echo -n '  --- dir:' $dir/$rundir ': '
1310                run_clean $dir/$rundir
1311            fi
1312            trdir=`( cd $dir ; find . -type d -name "$pfxdir.*" -print | sed 's/^.\///')`
1313            ttd=`echo $trdir | wc -w`
1314            if test $ttd != 0 ; then
1315                echo '  --- rm dir:' $trdir
1316                ( cd $dir ; rm -rf $trdir )
1317            fi
1318          continue          continue
1319      fi      fi
1320    
1321      #  Verify that the testdir exists and contains previous      #  Verify that the testdir exists and contains previous
1322      #  results in the correct location--or skip this directory!      #  results in the correct location--or skip this directory!
1323      fout=      fout=$dir"/results/"$ref_outp
     if test "x$ADM" = x ; then  
         fout=$dir"/results/output.txt"  
     else  
         fout=$dir"/results_ad/output_adm.txt"  
     fi  
1324      if test ! -r $fout ; then      if test ! -r $fout ; then
1325          echo "can't read \"$fout\" -- skipping $dir"          echo "can't read \"$fout\" -- skipping $dir"
1326          continue          continue
1327      fi      fi
     if test "x$ADM" = x ; then  
         check_for_add_mon_output  $fout  
     fi  
1328    
1329      # Check for additional types of monitor output      # Check for specific files for particular type of run
1330    
1331      builddir="build"      if test "x$MPI" != "x0" ; then
1332      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi          if test -r $CODE_DIR"/SIZE.h_mpi" ; then
1333      rundir="run"              #- create new SIZE.h with no more than '$MPI' Procs
1334     #rundir=$builddir              mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI
1335      if test ! -d $dir/$rundir ; then              LOC_NPROC=$?
1336          rundir=$builddir              (   cd $BUILD_DIR
1337      fi                  if test -r SIZE.h.mpi ; then
1338                            cmp tr_size.mpi SIZE.h.mpi > /dev/null 2>&1 ; RETVAL=$?
1339      if test "x$ADM" = x ; then                  else RETVAL=1
1340          code_dir=code                  fi
1341          CODE_DIR=$dir/code                  if test "x$RETVAL" = x0 ; then
1342          input_dirs='input'                      rm -f tr_size.mpi
1343      else                  else
1344          code_dir=code_ad                      rm -f SIZE.h.mpi ; mv tr_size.mpi SIZE.h.mpi
1345          CODE_DIR=$dir/code_ad                  fi
1346          input_dirs='input_ad input'              )
1347      fi          else
1348      BUILD_DIR=$dir/$builddir              echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1349                continue
1350      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then          fi
1351          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"          if test "x$MPI_MFILE" != x ; then
1352          continue              #- create new MPI machine-file with the right number of Procs
1353                rm -f $LOC_MFILE
1354                cat $MPI_MFILE | sort | uniq | head -$LOC_NPROC > $LOC_MFILE
1355                nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1356                if [ $nl -lt $LOC_NPROC ] ; then
1357                    rm -f $LOC_MFILE
1358                    cat $MPI_MFILE | head -$LOC_NPROC > $LOC_MFILE
1359                    #sed -n "1,$LOC_NPROC p" $MPI_MFILE > $LOC_MFILE
1360                fi
1361                if [ $verbose -gt 1 ]; then
1362                    nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1363                    echo " new LOC_MFILE=$LOC_MFILE : $nl procs for LOC_NPROC=$LOC_NPROC"
1364                fi
1365            fi
1366      fi      fi
1367      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
1368          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"
1369          continue          continue
1370      fi      fi
1371        if test "x$MPI" != "x0" -a "x$MULTI_THREAD" = "xt" ; then
1372            retv=`check_eedata $BUILD_DIR"/SIZE.h.mpi" $dir"/input/eedata.mth"`
1373            if test $retv != 0 ; then
1374                echo "input/eedata.mth tiling misfit -- skipping $dir"
1375                continue
1376            fi
1377        fi
1378    
1379      #  Check whether there are "extra runs" for this testdir      #  Check whether there are "extra runs" for this testdir
1380      extra_runs=      extra_runs=
1381      if test "x$ADM" = x ; then      if test "x$NORUN" = xf ; then
1382          ex_run_dirs=`( cd $dir ; echo input.* )`          ex_run_dirs=`( cd $dir ; echo $inputdir.* )`
1383          #echo "ex_run_dirs='$ex_run_dirs'"      fi
1384          for exd in $ex_run_dirs ; do      #echo "ex_run_dirs='$ex_run_dirs'"
1385              name=`echo $exd | sed -e 's/input.//g'`      for exd in $ex_run_dirs ; do
1386              outf="$dir/results/output.$name.txt"          name=`echo $exd | sed -e "s/$inputdir\.//"`
1387              if test -f $outf -a -r $outf ; then          refExOut=`echo $ref_outp | sed "s/\./.${name}./"`
1388                  if test "x$MULTI_THREAD" = "xt" ; then          outf="$dir/results/$refExOut"
1389                      if test -r $dir"/"$exd"/eedata.mth" ; then          if test -f $outf -a -r $outf ; then
1390                          extra_runs="$extra_runs $name"            if test "x$MULTI_THREAD" = "xt" ; then
1391                      #else echo $dir"/"$exd"/eedata.mth: not found"              if test -r $dir"/"$exd"/eedata.mth" ; then
1392                      fi                if test "x$MPI" = "x0" ; then
1393                  else                  extra_runs="$extra_runs $name"
1394                  else
1395                    retv=`check_eedata $BUILD_DIR"/SIZE.h.mpi" $dir"/"$exd"/eedata.mth"`
1396                    if test $retv = 0 ; then
1397                      extra_runs="$extra_runs $name"                      extra_runs="$extra_runs $name"
1398                    else
1399                        echo $exd"/eedata.mth tiling misfit -- skipping $dir"
1400                  fi                  fi
1401                  fi
1402                #else echo $dir"/"$exd"/eedata.mth: not found"
1403              fi              fi
1404          done            else
1405      fi              extra_runs="$extra_runs $name"
1406              fi
1407            fi
1408        done
1409    
     echo "-------------------------------------------------------------------------------"  
1410      echo      echo
1411      if test "x$extra_runs" = "x" ; then      if test "x$extra_runs" = "x" ; then
1412         echo "Experiment:  $dir"         echo "Experiment:  $dir"
1413      else      else
1414         echo "Experiment:  $dir ; extra_runs=$extra_runs"         echo "Experiment:  $dir ; extra_runs=$extra_runs"
# Line 1171  for dir in $TESTDIRS ; do Line 1417  for dir in $TESTDIRS ; do
1417      unset genmake makedepend make run      unset genmake makedepend make run
1418      results=$EMPTY_RESULTS      results=$EMPTY_RESULTS
1419    
1420      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir & summary.txt file for each tested experiment (tdir)
1421      rel_CDIR=$DRESULTS"/"$dir      locDIR=$DRESULTS"/"$dir
1422      mkdir $rel_CDIR      mkdir $locDIR
1423      CDIR=`pwd`"/$rel_CDIR"      #- report to this experiment local summary file ---
1424            echo "DATE='$DATE' ; tdir='$dir'" > $locDIR"/summary.txt"
1425      if test "x$CLEANUP" = xt ; then      echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1426          echo '====>>> this is to check that we never go through this part <<< ==='      echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1427          makeclean $dir/$builddir \      CDIR=`pwd`"/$locDIR"
1428              && run_clean $dir/$rundir  
1429        if test "x$NORUN" = xt ; then
1430                run=N
1431            genmakemodel $dir/$builddir && genmake=Y \
1432                && makeclean $dir/$builddir \
1433                && symlink_mpifiles $dir $code_dir $builddir \
1434                && makedependmodel $dir/$builddir && makedepend=Y \
1435                && makemodel $dir/$builddir && make=Y
1436      else      else
1437          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
1438              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
             && run_clean $dir/$rundir \  
1439              && symlink_mpifiles $dir $code_dir $builddir \              && symlink_mpifiles $dir $code_dir $builddir \
1440              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
1441              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
1442              && linkdata $dir/$rundir $input_dirs \              && run_clean $dir/$rundir \
1443                && linkdata $dir/$rundir $inputdir \
1444              && runmodel $dir/$rundir && run=Y \              && runmodel $dir/$rundir && run=Y \
1445              && results=`testoutput_run $dir $rundir "txt"`              && results=`testoutput_run $dir $rundir $ref_outp`
1446      fi      fi
1447            #echo "results='$results'"
1448      echo  
     if test "x$ADM" = x ; then  
1449          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1450          echo          echo 1>&2
1451          echo "$fres" >> $SUMMARY          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
1452          touch $CDIR"/summary.txt"          echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
         echo "fresults='$fres'" >> $CDIR"/summary.txt"  
         echo "MACH='$MACH'" >> $CDIR"/summary.txt"  
         echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
         echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
         echo "tdir='$dir'" >> $CDIR"/summary.txt"  
1453    
1454          for ex in $extra_runs ; do          for ex in $extra_runs ; do
1455              unset run              unset run
1456              results=$EMPTY_RESULTS              results=$EMPTY_RESULTS
1457              #  Create an output dir for each OPTFILE/tdir.ex combination              #  reference output file
1458              rel_CDIR=$DRESULTS"/"$dir"."$ex              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`
1459              mkdir $rel_CDIR              #  Create an output dir & summary.txt file for each extra run (tdir.ex)
1460              CDIR=`pwd`"/$rel_CDIR"              locDIR=$DRESULTS"/"$dir"."$ex
1461              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"              mkdir $locDIR
1462              run_clean $dir/tr_run.$ex              #- report to this experiment local summary file ---
1463              linkdata $dir/tr_run.$ex input.$ex input              echo "DATE='$DATE' ; tdir='$dir.$ex'" > $locDIR"/summary.txt"
1464              runmodel $dir/tr_run.$ex && run=Y \              #echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1465                  && results=`testoutput_run $dir tr_run.$ex ${ex}".txt"`              #echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1466              fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`              CDIR=`pwd`"/$locDIR"
1467                test ! -e "$dir/$pfxdir.$ex" && mkdir "$dir/$pfxdir.$ex"
1468                run_clean $dir/$pfxdir.$ex
1469                linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir
1470                runmodel $dir/$pfxdir.$ex && run=Y \
1471                && results=`testoutput_run $dir $pfxdir.$ex $refExOut`
1472              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1473              fres="$fres.$ex"              fres="$fres.$ex"
1474              echo              echo 1>&2
1475              echo "$fres" >> $SUMMARY              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
1476              touch $CDIR"/summary.txt"              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
1477              echo "fresults='$fres'" >> $CDIR"/summary.txt"              if test "x$POSTCLEAN" = x2 ; then
1478              echo "MACH='$MACH'" >> $CDIR"/summary.txt"                  run_clean $dir/$pfxdir.$ex
             echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
             echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
             echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt"  
             if test "x$POSTCLEAN" = xt ; then  
                 run_clean $dir/tr_run.$ex  
1479              fi              fi
1480          done          done
     else  
         fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`  
         fres=$fres"$results   $dir"  
         echo  
         echo "$fres" >> $SUMMARY  
         touch $CDIR"/summary.txt"  
         echo "fresults='$fres'" >> $CDIR"/summary.txt"  
         echo "MACH='$MACH'" >> $CDIR"/summary.txt"  
         echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
         echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
         echo "tdir='$dir'" >> $CDIR"/summary.txt"  
         grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \  
                            >> $CDIR"/summary.txt"  
     fi  
1481    
1482        if test -f $DRESULTS"/"genmake_state ; then : ; else
1483            if test -f $dir/$builddir/Makefile ; then
1484                mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
1485                echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state
1486                sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state
1487                echo " $mkOpt" >> $DRESULTS/genmake_state
1488                if test "x$OPTFILE" = xNONE ; then
1489                    eval $mkOpt
1490                    sed "/^No \"OPTFILE\" was specified ; genmake2/a\  OPTFILE=${OPTFILE}"\
1491                            $SUMMARY > tr_0.tmp_log
1492                    RETVAL=$?
1493                    if test "x$RETVAL" = x0 ; then rm -f $SUMMARY
1494                            cp tr_0.tmp_log $SUMMARY
1495                    else rm -f tr_0.tmp_log
1496                    fi
1497                fi
1498                gmkLog=$dir/$builddir/genmake.log
1499                grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1
1500                RETVAL=$?
1501                if test "x$RETVAL" = x0 ; then
1502                    echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state
1503                    sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \
1504                           | grep -v '^... compiler version ' > tr_1.tmp_log
1505                    sed -n '1,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \
1506                            >> $DRESULTS/genmake_state
1507                    rm -f tr_1.tmp_log
1508                fi
1509            fi
1510        fi
1511      #postclean $dir/$builddir      #postclean $dir/$builddir
1512      if test "x$POSTCLEAN" = xt ; then      if test "x$POSTCLEAN" = x2 ; then
1513          makeclean $dir/$builddir \          makeclean $dir/$builddir \
1514              && run_clean $dir/$rundir              && run_clean $dir/$rundir
1515      fi      fi
1516            if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then rm -f $LOC_MFILE ; fi
1517    
1518      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
1519        
1520  done  done
1521    
1522  printf "Start time:  " >> $SUMMARY  printf "Start time:  " >> $SUMMARY
1523  echo $start_date >> $SUMMARY  echo "$start_date" >> $SUMMARY
1524  printf "End time:    " >> $SUMMARY  printf "End time:    " >> $SUMMARY
1525  date >> $SUMMARY  date >> $SUMMARY
1526    
# Line 1282  else Line 1545  else
1545              echo "An email containing results was sent to the following addresses:"              echo "An email containing results was sent to the following addresses:"
1546              echo "  \"$ADDRESSES\""              echo "  \"$ADDRESSES\""
1547              echo              echo
1548                test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"
1549                test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"
1550          fi          fi
         test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"  
         test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"  
1551      fi      fi
1552  fi  fi
1553    
1554  rm -f tr_cmpnum.c tr_cmpnum  if test "x$QUICK" = xf -a "x$NORUN" = xf ; then
1555        rm -f tr_cmpnum.c tr_cmpnum
1556    fi
1557    
1558  if test "x$CLEANUP" != xt ; then  if test "x$CLEANUP" != xt ; then
1559      cat $SUMMARY | sed 's/  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.//'      cat $SUMMARY | sed 's/ \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \. //'
 #   cat $SUMMARY | sed 's/  \.//g'  
1560      if test -e tr_out.txt ; then      if test -e tr_out.txt ; then
1561          mv tr_out.txt tr_out.txt.old          mv tr_out.txt tr_out.txt.old
1562      fi      fi
1563      cat $SUMMARY | sed 's/  \.//g' > tr_out.txt      cat $SUMMARY | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' > tr_out.txt
1564  fi  fi
1565    
1566  if test "x$DELDIR" = xt ; then  if test "x$DELDIR" = xt ; then

Legend:
Removed from v.1.94  
changed lines
  Added in v.1.160

  ViewVC Help
Powered by ViewVC 1.1.22