/[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.132 by jmc, Thu Jan 14 23:17:42 2010 UTC revision 1.192 by jmc, Sun Aug 18 19:53:47 2013 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 " ---- type of test : ----"
15        echo "  (-tlm)                   perform a Tangent Linear run"
16        echo "  (-adm|-ad)               perform an adjoint run"
17        echo "  (-oad)                   perform an OpenAD adjoint run"
18      echo "  (-mth)                   run multi-threaded (using eedata.mth)"      echo "  (-mth)                   run multi-threaded (using eedata.mth)"
19      echo "  (-mpi)                   compile and run using MPI"      echo "  (-mpi)                   use MPI to compile and run on 2 processors"
20      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"      echo "  (-MPI)  NUMBER           use MPI to compile and run on max NUMBER procs"
21      echo "                             (DEF=\"-ieee\")"      echo "  (-mfile|-mf) STRING      MPI: file with list of possible machines to run on"
22        echo "  (-command|-c) STRING     command to run (needed for MPI run)"
23        echo " ---- testing options : ----"
24        echo "  (-optfile|-of) STRING    list of optfiles to use"
25        echo "  (-fast)                  use optfile default for compiler flags (no '-ieee')"
26        echo "                            DEF=off => use IEEE numerics option (if available)"
27        echo "  (-devel)                 use optfile developement flags (if available)"
28      echo "  (-gsl)                   compile with \"-gsl\" flag"      echo "  (-gsl)                   compile with \"-gsl\" flag"
29      echo "  (-of=|-optfile=)STRING   list of optfiles to use"      echo "  (-use_r4|-ur4)           if allowed, use real*4 type for '_RS' variable"
30      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-tdir|-t) STRING        list of group and/or exp. dirs to test"
     echo "                             (DEF=\"\" no email is sent)"  
     echo "  (-mpd|-mpackdir) DIR     location of the mpack utility"  
     echo "                             (DEF=\"../tools/mpack-1.6\")"  
     echo "  (-t|-tdir) STRING        list of group and/or exp. dirs to test"  
31      echo "                             (recognized groups: basic, tutorials)"      echo "                             (recognized groups: basic, tutorials)"
32      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
33      echo "  (-skd|-skipdir) STRING   list of exp. dirs to skip"      echo "                             (if list= 'start_from THIS_EXP' then"
34        echo "                              test THIS_EXP + all the following)"
35        echo "  (-skipdir|-skd) STRING   list of exp. dirs to skip"
36      echo "                             (DEF=\"\" which test all)"      echo "                             (DEF=\"\" which test all)"
37      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"      echo "  (-ts)                    provide timing information per timestep"
38      echo "                             Bourne-compatible \"sh\" shell"      echo "  (-papis)                 provide MFlop/s per timestep using PAPI"
39        echo "  (-pcls)                  provide MFlop/s per timestep using PCL"
40        echo " ---- system options : ----"
41        echo "  (-bash|-b) STRING        preferred location of a \"bash\" or \"sh\" shell"
42      echo "                             (DEF=\"\" for \"bash\")"      echo "                             (DEF=\"\" for \"bash\")"
43      echo "  (-adm|-ad)               perform an adjoint run"      echo "  (-ef) STRING             used as genmake2 \"-extra_flag\" argument"
44      echo "  (-oad)                   perform an OpenAD adjoint run"      echo "  (-makedepend|-md) STRING command to use for \"makedepend\""
45      echo "  (-command) STRING        command to run"      echo "  (-make|-m) STRING        command to use for \"make\""
     echo "                             (DEF=\"make output.txt\")"  
     echo "  (-m|-make) STRING        command to use for \"make\""  
46      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
47        echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"
48        echo " ---- output options : ----"
49        echo "  (-match) NUMBER          Matching Criteria (number of digits)"
50        echo "                             (DEF=\"$MATCH_CRIT\")"
51      echo "  (-odir) STRING           used to build output directory name"      echo "  (-odir) STRING           used to build output directory name"
52      echo "                             (DEF=\"hostname\")"      echo "                             (DEF=\"hostname\")"
53      echo "  (-ptr|-ptracers) STRING  specify which ptracers to test"      echo "  (-addr|-a) STRING        list of email recipients"
54      echo "                             (DEF=\"1 2 3 4 5\")"      echo "                             (DEF=\"\" no email is sent)"
55      echo "  (-match) NUMBER          Matching Criteria (number of digits)"      echo "  (-send)       STRING     sending command (instead of using mpack)"
56      echo "                             (DEF=\"12\")"      echo "  (-savdir|-sd) STRING     location to save output tar file to send (DEF='$SAVDIR')"
57      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"      echo "  (-mpackdir|-mpd) DIR     location of the mpack utility"
58      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "                             (DEF=\"../tools/mpack-1.6\")"
59        echo " -- do only some parts: --"
60        echo "  (-clean)                 *ONLY* run \"make CLEAN\" & clean run-dir"
61        echo "  (-norun|-nr)             skip the \"runmodel\" stage (stop after make)"
62        echo "  (-obj)                   only produces objects (=norun & no executable)"
63        echo "  (-runonly|-ro)           *ONLY* run stage (=\"-quick\" without make)"
64      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
65      echo "  (-nogenmake|-ng)         skip the genmake stage"      echo "  (-nogenmake|-ng)         skip the genmake stage"
66      echo "  (-noclean|-nc)           skip the \"make clean\" stage"      echo "  (-noclean|-nc)           skip the \"make clean\" stage"
67      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
68        echo "  (-postclean|-pc)         after each exp. test, clean build-dir & run-dir"
69        echo "  (-deloutp|-do)           delete output files after successful run"
70      echo "  (-deldir|-dd)            on success, delete the output directory"      echo "  (-deldir|-dd)            on success, delete the output directory"
     echo "  (-ts)                    provide timing information per timestep"  
     echo "  (-papis)                 provide MFlop/s per timestep using PAPI"  
     echo "  (-pcls)                  provide MFlop/s per timestep using PCL"  
71      echo      echo
72      echo "and where STRING can be a whitespace-delimited list"      echo "and where STRING can be a whitespace-delimited list"
73      echo "such as:"      echo "such as:"
# Line 104  testoutput_var() Line 121  testoutput_var()
121  {  {
122      # testoutput_var dir s1 label subdir reference_output      # testoutput_var dir s1 label subdir reference_output
123      #      #
124      #  compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE      #  compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE
125      #     with same output from reference file $dir/results/$reference_output      #     with same output from reference file $dir/$reference_output
126      #  using search strings s1 and text label      #  using search strings s1 and text label
127    
128      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
129          echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2          echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2
130      fi      fi
131      if [ -r $1/$4/$OUTPUTFILE ]; then      if [ -r $1/$4/$OUTPUTFILE ]; then
132          grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt          grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > ${TMP}a.txt
133          lncntA=`wc -l tmp1.txt | awk '{print $1}' `          lncntA=`wc -l ${TMP}a.txt | awk '{print $1}' `
134          if [ $lncntA -lt 2 ]; then          if [ $lncntA -lt 2 ]; then
135              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
136                  echo Not enough lines of output when searching for "$2" 1>&2                  echo Not enough lines of output when searching for "$2" 1>&2
137              fi              fi
138              return 99              rm -f ${TMP}a.txt ; return 99
139          fi          fi
140      else      else
141          echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2          echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2
142          return 99          return 99
143      fi      fi
144      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
145          echo testoutput_var: grep "$2" $1/results/$5 1>&2          echo testoutput_var: grep "$2" $1/$5 1>&2
146      fi      fi
147      grep "$2" $1/results/$5 | sed 's/.*=//' | cat -n > tmp2.txt      grep "$2" $1/$5 | sed 's/.*=//' | cat -n > ${TMP}b.txt
148      lncntB=`wc -l tmp2.txt | awk '{print $1}' `      lncntB=`wc -l ${TMP}b.txt | awk '{print $1}' `
149      if [ $lncntB -lt 2 ]; then      if [ $lncntB -lt 2 ]; then
150          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
151              echo Not enough lines of output when searching for "$2" 1>&2              echo Not enough lines of output when searching for "$2" 1>&2
152          fi          fi
153          return 99          rm -f ${TMP}a.txt ${TMP}b.txt ; return 99
154      fi      fi
155      if [ $lncntA -ne $lncntB ]; then      if [ $lncntA -ne $lncntB ]; then
156          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
157              echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2              echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2
158          fi          fi
159          return 99          rm -f ${TMP}a.txt ${TMP}b.txt ; return 99
160      fi      fi
161      has_nan=`cat tmp1.txt | grep -i nan | wc -l`      has_nan=`cat ${TMP}a.txt | grep -i nan | wc -l`
162      if [ $has_nan -gt 0  ] ; then      if [ $has_nan -gt 0  ] ; then
163          echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values  1>&2          echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values  1>&2
164          return 99          rm -f ${TMP}a.txt ${TMP}b.txt ; return 99
165      fi      fi
166      has_inf=`cat tmp1.txt | grep -i inf | wc -l`      has_inf=`cat ${TMP}a.txt | grep -i inf | wc -l`
167      if [ $has_inf -gt 0  ] ; then      if [ $has_inf -gt 0  ] ; then
168          echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values  1>&2          echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values  1>&2
169          return 99          rm -f ${TMP}a.txt ${TMP}b.txt ; return 99
170      fi      fi
171      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
172          echo testoutput_var: join tmp1.txt tmp2.txt 1>&2          echo testoutput_var: join ${TMP}a.txt ${TMP}b.txt 1>&2
173      fi      fi
174      join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt      # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
175        join ${TMP}a.txt ${TMP}b.txt | awk '{print $1 " " $2 " " $3}' | sed -e 's|:||g' > ${TMP}c.txt
176      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
177          echo testoutput_var: compare_lines 1>&2          echo testoutput_var: compare_lines 1>&2
178      fi      fi
179      if [ $verbose -gt 1 ]; then      if [ $verbose -gt 1 ]; then
180          cat tmp3.txt 1>&2          cat ${TMP}c.txt 1>&2
181      fi      fi
182      echo "-1" >> tmp3.txt      echo "-1" >> ${TMP}c.txt
183      # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number      digits_of_similarity=`./tr_cmpnum < ${TMP}c.txt`
     cat tmp3.txt | sed -e 's|:||g' > tmp4.txt  
     digits_of_similarity=`./tr_cmpnum < tmp4.txt`  
184      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
185          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
186              echo testoutput_var: No comparison was available for \"$3\" 1>&2              echo testoutput_var: No comparison was available for \"$3\" 1>&2
# Line 175  testoutput_var() Line 191  testoutput_var()
191              echo There were $digits_of_similarity decimal places of similarity for \"$3\" 1>&2              echo There were $digits_of_similarity decimal places of similarity for \"$3\" 1>&2
192          fi          fi
193      fi      fi
194      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt      rm -f ${TMP}a.txt ${TMP}b.txt ${TMP}c.txt
195        
196      return $digits_of_similarity      return $digits_of_similarity
197  }  }
198    
# Line 186  testoutput_run() Line 202  testoutput_run()
202      #      #
203      #  test output from 1 run in "directory"      #  test output from 1 run in "directory"
204  # --> same processing for adjoint & forward test  # --> same processing for adjoint & forward test
205          # default list of output variables to be checked:          # default list of output variables to be checked:
206          #  1rst : main variable used to decide if it pass or FAIL          #  1rst : main variable used to decide if it pass or FAIL
207          #  others : number of matching digits to be printed in summary.txt          #  others : number of matching digits to be printed in summary.txt
208          listChk=$DEF_CHECK_LIST          listChk=$DEF_CHECK_LIST
209          #  load experiment-specific list from file "tr_checklist" (if it exist)          #  load experiment-specific list from file "tr_checklist" (if it exist)
210          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
211          sVar=`echo $listChk | awk '{print $1}'`          sVar=`echo $listChk | awk '{print $1}'`
212          # remove 1rst var and expand the list: + => min max mean s.d          # remove 1rst var and expand the list: + => min max mean s.d
213          listVar=`echo $listChk | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' \          listVar=`echo $listChk | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' \
214                                 | sed 's/+//g' | sed "s/^$sVar//"`                                 | sed 's/+//g' | sed "s/^$sVar//"`
215          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
216          # check for ptracer output in reference_output file :          # set ref.outp file-name and, if compressed, uncompress it into subdir
217          outpref=$1/results/$3          refoutp=results/$3
218          ptr_mon="trcstat_ptracerXX_min trcstat_ptracerXX_max"          if test ! -r $1/results/$3 ; then
219          ptr_mon="$ptr_mon trcstat_ptracerXX_mean trcstat_ptracerXX_sd"            if test -r $1/results/${3}.gz ; then
220          for ii in $PTRACERS_NUM ; do              tmpNam1=$3
221                tmpNam2=`echo $tmpNam1 | sed 's/\..*\././'`
222                if test "x$tmpNam1" = "x$tmpNam2" ; then
223                    tmpNam1=`echo $tmpNam2 | sed 's/\./.std./'`
224                fi
225                refoutp=$2/$tmpNam1
226                if [ $debug -gt 0 ]; then
227                    echo "testoutput_run: gunzip 'results/$3.gz' into '$refoutp'" 1>&2
228                fi
229                gzip -cd $1/results/${3}.gz > $1/$refoutp
230              else
231                echo "missing reference output file '$3' (.gz) in '$1/results/'"
232              fi
233            fi
234            # check for ptracer output in reference_output file :
235            if test $KIND = 0 ; then
236              ptr_mon="trcstat_ptracerXX_min trcstat_ptracerXX_max"
237              ptr_mon="$ptr_mon trcstat_ptracerXX_mean trcstat_ptracerXX_sd"
238              for ii in $PTRACERS_NUM ; do
239              ptrfound=0              ptrfound=0
240              for jj in $ptr_mon ; do              for jj in $ptr_mon ; do
241                  name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`                  name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`
242                  tst=`grep $name $outpref | wc -l | awk '{print $1}'`                  tst=`grep $name $1/$refoutp | wc -l | awk '{print $1}'`
243                  if test ! "x$tst" = x0 ; then ptrfound=1 ; fi                  if test ! "x$tst" = x0 ; then ptrfound=1 ; fi
244              done              done
245              if test $ptrfound = '1' ; then              if test $ptrfound = '1' ; then
246                  eval "HAVE_PTR0"$ii"=t"                  eval "HAVE_PTR0"$ii"=t"
247              else              else
248                  eval "HAVE_PTR0"$ii"=f"                  eval "HAVE_PTR0"$ii"=f"
               if test "x$ADM" = x -a "x$OADM" = x; then  
249                # remove this ptr from the list of output variable to check                # remove this ptr from the list of output variable to check
250                # echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2                # echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2
251                  listVar=`echo "$listVar" | sed "s/ pt$ii..//g"`                  listVar=`echo "$listVar" | sed "s/ pt$ii..//g"`
               fi  
252              fi              fi
253          #   eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' 1>&2            # eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' 1>&2
254          done            done
255          tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){if($i==$1)t+=1}; print t }'`          fi
256          if test $tst != 1 ; then          tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){if($i==$1)t+=1}; print t }'`
257            if test $tst = 0 ; then echo "==> WARNING: selected var >$sVar< not found" 1>&2          if test $tst != 1 ; then
258                   else echo "==> WARNING: found selected var >$sVar< $tst times" 1>&2 ; fi            if test $tst = 0 ; then echo "==> WARNING: selected var >$sVar< not found" 1>&2
259            echo "==> WARNING: in checked list:" $listVar 1>&2                   else echo "==> WARNING: found selected var >$sVar< $tst times" 1>&2 ; fi
260          #- put it back once:            echo "==> WARNING: in checked list:" $listVar 1>&2
261            listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`          #- put it back once:
262          fi            listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`
263            fi
264          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
265          echo "listVar='$listVar'" > $CDIR"/summary.txt"          echo "listVar='$listVar'" >> $locDIR"/summary.txt"
266          allargs=""          #---
267          for xx in $listVar          allargs=""
268          do          for xx in $listVar
269            case $xx in          do
270              case $xx in
271             'PS')  if [ $debug -gt 0 ]             'PS')  if [ $debug -gt 0 ]
272                    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
273                    testoutput_var $1 "cg2d_init_res" "Press. Solver (cg2d)" $2 $3; yy=$?                    testoutput_var $1 "cg2d_init_res" "Press. Solver (cg2d)" $2 $refoutp ; yy=$?
274                    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 ;;
275            'Cost') testoutput_var $1 "ADM  precision_derivative_cost" "ADM Cost" $2 $3; yy=$? ;;            'Cost') testoutput_var $1 "ADM  ref_cost_function" "ADM CostFct" $2 $refoutp ; yy=$? ;;
276            'Grad') testoutput_var $1 "ADM  precision_derivative_grad" "ADM Grad" $2 $3; yy=$? ;;           'AdGrd') testoutput_var $1 "ADM  adjoint_gradient"  "ADM Ad Grad" $2 $refoutp ; yy=$? ;;
277             'Tmn') testoutput_var $1 "dynstat_theta_min"  "Theta minimum"  $2 $3; yy=$? ;;           'FDGrd') testoutput_var $1 "ADM  finite-diff_grad"  "ADM FD Grad" $2 $refoutp ; yy=$? ;;
278             'Tmx') testoutput_var $1 "dynstat_theta_max"  "Theta maximum"  $2 $3; yy=$? ;;          'tlmCst') testoutput_var $1 "TLM  ref_cost_function" "TLM CostFct" $2 $refoutp ; yy=$? ;;
279             'Tav') testoutput_var $1 "dynstat_theta_mean" "Theta mean"     $2 $3; yy=$? ;;          'tlmGrd') testoutput_var $1 "TLM  tangent-lin_grad"  "TLM TL Grad" $2 $refoutp ; yy=$? ;;
280             'Tsd') testoutput_var $1 "dynstat_theta_sd"   "Theta Std.Dev"  $2 $3; yy=$? ;;          'fwdGrd') testoutput_var $1 "TLM  finite-diff_grad"  "TLM FD Grad" $2 $refoutp ; yy=$? ;;
281             'Smn') testoutput_var $1 "dynstat_salt_min"  "Salt minimum"    $2 $3; yy=$? ;;             'Tmn') testoutput_var $1 "dynstat_theta_min"  "Theta minimum"  $2 $refoutp ; yy=$? ;;
282             'Smx') testoutput_var $1 "dynstat_salt_max"  "Salt maximum"    $2 $3; yy=$? ;;             'Tmx') testoutput_var $1 "dynstat_theta_max"  "Theta maximum"  $2 $refoutp ; yy=$? ;;
283             'Sav') testoutput_var $1 "dynstat_salt_mean" "Salt mean"       $2 $3; yy=$? ;;             'Tav') testoutput_var $1 "dynstat_theta_mean" "Theta mean"     $2 $refoutp ; yy=$? ;;
284             'Ssd') testoutput_var $1 "dynstat_salt_sd"   "Salt Std.Dev"    $2 $3; yy=$? ;;             'Tsd') testoutput_var $1 "dynstat_theta_sd"   "Theta Std.Dev"  $2 $refoutp ; yy=$? ;;
285             'Umn') testoutput_var $1 "dynstat_uvel_min"  "U minimum"       $2 $3; yy=$? ;;             'Smn') testoutput_var $1 "dynstat_salt_min"  "Salt minimum"    $2 $refoutp ; yy=$? ;;
286             'Umx') testoutput_var $1 "dynstat_uvel_max"  "U maximum"       $2 $3; yy=$? ;;             'Smx') testoutput_var $1 "dynstat_salt_max"  "Salt maximum"    $2 $refoutp ; yy=$? ;;
287             'Uav') testoutput_var $1 "dynstat_uvel_mean" "U mean"          $2 $3; yy=$? ;;             'Sav') testoutput_var $1 "dynstat_salt_mean" "Salt mean"       $2 $refoutp ; yy=$? ;;
288             'Usd') testoutput_var $1 "dynstat_uvel_sd"   "U Std.Dev"       $2 $3; yy=$? ;;             'Ssd') testoutput_var $1 "dynstat_salt_sd"   "Salt Std.Dev"    $2 $refoutp ; yy=$? ;;
289             'Vmn') testoutput_var $1 "dynstat_vvel_min"  "V minimum"       $2 $3; yy=$? ;;             'Umn') testoutput_var $1 "dynstat_uvel_min"  "U minimum"       $2 $refoutp ; yy=$? ;;
290             'Vmx') testoutput_var $1 "dynstat_vvel_max"  "V maximum"       $2 $3; yy=$? ;;             'Umx') testoutput_var $1 "dynstat_uvel_max"  "U maximum"       $2 $refoutp ; yy=$? ;;
291             'Vav') testoutput_var $1 "dynstat_vvel_mean" "V mean"          $2 $3; yy=$? ;;             'Uav') testoutput_var $1 "dynstat_uvel_mean" "U mean"          $2 $refoutp ; yy=$? ;;
292             'Vsd') testoutput_var $1 "dynstat_vvel_sd"   "V Std.Dev"       $2 $3; yy=$? ;;             'Usd') testoutput_var $1 "dynstat_uvel_sd"   "U Std.Dev"       $2 $refoutp ; yy=$? ;;
293               'Vmn') testoutput_var $1 "dynstat_vvel_min"  "V minimum"       $2 $refoutp ; yy=$? ;;
294               'Vmx') testoutput_var $1 "dynstat_vvel_max"  "V maximum"       $2 $refoutp ; yy=$? ;;
295               'Vav') testoutput_var $1 "dynstat_vvel_mean" "V mean"          $2 $refoutp ; yy=$? ;;
296               'Vsd') testoutput_var $1 "dynstat_vvel_sd"   "V Std.Dev"       $2 $refoutp ; yy=$? ;;
297          '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/..$//'`
298             testoutput_var $1 "trcstat_ptracer0"$ii"_min"  "p0"$ii"_min"   $2 $3; yy=$? ;;             testoutput_var $1 "trcstat_ptracer0"$ii"_min"  "p0"$ii"_min"   $2 $refoutp ; yy=$? ;;
299          '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/..$//'`
300             testoutput_var $1 "trcstat_ptracer0"$ii"_max"  "p0"$ii"_max"   $2 $3; yy=$? ;;             testoutput_var $1 "trcstat_ptracer0"$ii"_max"  "p0"$ii"_max"   $2 $refoutp ; yy=$? ;;
301          '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/..$//'`
302             testoutput_var $1 "trcstat_ptracer0"$ii"_mean" "p0"$ii"_mean" $2 $3; yy=$? ;;             testoutput_var $1 "trcstat_ptracer0"$ii"_mean" "p0"$ii"_mean" $2 $refoutp ; yy=$? ;;
303          '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/..$//'`
304             testoutput_var $1 "trcstat_ptracer0"$ii"_sd"   "p0"$ii"_StDv"  $2 $3; yy=$? ;;             testoutput_var $1 "trcstat_ptracer0"$ii"_sd"   "p0"$ii"_StDv"  $2 $refoutp ; yy=$? ;;
305           'Qntmn') testoutput_var $1 "forcing_qnet_min" "Qnet minimum"  $2 $3; yy=$? ;;           'Qntmn') testoutput_var $1 "forcing_qnet_min" "Qnet minimum"  $2 $refoutp ; yy=$? ;;
306           'Qntmx') testoutput_var $1 "forcing_qnet_max" "Qnet maximum"  $2 $3; yy=$? ;;           'Qntmx') testoutput_var $1 "forcing_qnet_max" "Qnet maximum"  $2 $refoutp ; yy=$? ;;
307           'Qntav') testoutput_var $1 "forcing_qnet_mean" "Qnet mean"       $2 $3; yy=$? ;;           'Qntav') testoutput_var $1 "forcing_qnet_mean" "Qnet mean"       $2 $refoutp ; yy=$? ;;
308           'Qntsd') testoutput_var $1 "forcing_qnet_sd"  "Qnet Std.Dev"  $2 $3; yy=$? ;;           'Qntsd') testoutput_var $1 "forcing_qnet_sd"  "Qnet Std.Dev"  $2 $refoutp ; yy=$? ;;
309           'aSImn') testoutput_var $1 "seaice_area_min"   "SIce Area min"   $2 $3; yy=$? ;;           'aSImn') testoutput_var $1 "seaice_area_min"   "SIce Area min"   $2 $refoutp ; yy=$? ;;
310           'aSImx') testoutput_var $1 "seaice_area_max"   "SIce Area max"   $2 $3; yy=$? ;;           'aSImx') testoutput_var $1 "seaice_area_max"   "SIce Area max"   $2 $refoutp ; yy=$? ;;
311           'aSIav') testoutput_var $1 "seaice_area_mean"  "SIce Area mean"  $2 $3; yy=$? ;;           'aSIav') testoutput_var $1 "seaice_area_mean"  "SIce Area mean"  $2 $refoutp ; yy=$? ;;
312           'aSIsd') testoutput_var $1 "seaice_area_sd"    "SIce Area StDv"  $2 $3; yy=$? ;;           'aSIsd') testoutput_var $1 "seaice_area_sd"    "SIce Area StDv"  $2 $refoutp ; yy=$? ;;
313           'hSImn') testoutput_var $1 "seaice_heff_min"   "SIce Heff min"   $2 $3; yy=$? ;;           'hSImn') testoutput_var $1 "seaice_heff_min"   "SIce Heff min"   $2 $refoutp ; yy=$? ;;
314           'hSImx') testoutput_var $1 "seaice_heff_max"   "SIce Heff max"   $2 $3; yy=$? ;;           'hSImx') testoutput_var $1 "seaice_heff_max"   "SIce Heff max"   $2 $refoutp ; yy=$? ;;
315           'hSIav') testoutput_var $1 "seaice_heff_mean"  "SIce Heff mean"  $2 $3; yy=$? ;;           'hSIav') testoutput_var $1 "seaice_heff_mean"  "SIce Heff mean"  $2 $refoutp ; yy=$? ;;
316           'hSIsd') testoutput_var $1 "seaice_heff_sd"    "SIce Heff StDv"  $2 $3; yy=$? ;;           'hSIsd') testoutput_var $1 "seaice_heff_sd"    "SIce Heff StDv"  $2 $refoutp ; yy=$? ;;
317          'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $3; yy=$? ;;           'uSImn') testoutput_var $1 "seaice_uice_min"   "SIce Uice min"   $2 $refoutp ; yy=$? ;;
318          'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South"  $2 $3; yy=$? ;;           'uSImx') testoutput_var $1 "seaice_uice_max"   "SIce Uice max"   $2 $refoutp ; yy=$? ;;
319          'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North"  $2 $3; yy=$? ;;           'uSIav') testoutput_var $1 "seaice_uice_mean"  "SIce Uice mean"  $2 $refoutp ; yy=$? ;;
320          'HthSiG') testoutput_var $1 "thSI_IceH_ave_G" "thSIc H Global"    $2 $3; yy=$? ;;           'uSIsd') testoutput_var $1 "seaice_uice_sd"    "SIce Uice StDv"  $2 $refoutp ; yy=$? ;;
321          'HthSiS') testoutput_var $1 "thSI_IceH_ave_S" "thSIc H South"     $2 $3; yy=$? ;;           'vSImn') testoutput_var $1 "seaice_vice_min"   "SIce Vice min"   $2 $refoutp ; yy=$? ;;
322          'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North"     $2 $3; yy=$? ;;           'vSImx') testoutput_var $1 "seaice_vice_max"   "SIce Vice max"   $2 $refoutp ; yy=$? ;;
323                *) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;;           'vSIav') testoutput_var $1 "seaice_vice_mean"  "SIce Vice mean"  $2 $refoutp ; yy=$? ;;
324            esac           'vSIsd') testoutput_var $1 "seaice_vice_sd"    "SIce Vice StDv"  $2 $refoutp ; yy=$? ;;
325            if test $xx = $sVar          'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $refoutp ; yy=$? ;;
326            then allargs="$allargs > $yy <"          'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South"  $2 $refoutp ; yy=$? ;;
327            else allargs="$allargs $yy"          'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North"  $2 $refoutp ; yy=$? ;;
328            fi          'HthSiG') testoutput_var $1 "thSI_IceH_ave_G" "thSIc H Glob-ave"  $2 $refoutp ; yy=$? ;;
329          done          'HthSiS') testoutput_var $1 "thSI_IceH_ave_S" "thSIc H South-av"  $2 $refoutp ; yy=$? ;;
330            'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North-av"  $2 $refoutp ; yy=$? ;;
331            'HthMxS') testoutput_var $1 "thSI_IceH_max_S" "thSIc H South-max" $2 $refoutp ; yy=$? ;;
332            'HthMxN') testoutput_var $1 "thSI_IceH_max_N" "thSIc H North-max" $2 $refoutp ; yy=$? ;;
333            'StrmIc') testoutput_var $1 "STREAMICE_FP_ERR" "StreamIce Solver" $2 $refoutp ; yy=$? ;;
334                  *) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;;
335              esac
336              if test $xx = $sVar
337              then allargs="$allargs > $yy <"
338              else allargs="$allargs $yy"
339              fi
340            done
341    
342          nbVar=`echo $listVar | awk '{print NF}'`          nbVar=`echo $listVar | awk '{print NF}'`
343          if [ $nbVar -lt $LEN_CHECK_LIST ] ; then          if [ $nbVar -lt $LEN_CHECK_LIST ] ; then
344          #-- fill line (up to standard length) with dot:          #-- fill line (up to standard length) with dot:
345            adNul=`expr $LEN_CHECK_LIST - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'`            adNul=`expr $LEN_CHECK_LIST - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'`
346            echo $allargs $adNul            echo $allargs $adNul
347          else          else
348            echo $allargs            echo $allargs
349          fi          fi
350  # <-- same processing for adjoint & forward test  # <-- same processing for adjoint & forward test
351  }  }
352    
# Line 315  genmakemodel() Line 364  genmakemodel()
364          (          (
365              cd $1;              cd $1;
366              command="$GENMAKE2  -ds -m $MAKE"              command="$GENMAKE2  -ds -m $MAKE"
367              if test "x$ADM" = xt ; then              if test "x$MKDEPEND" != x ; then
368                    command="$command -makedepend=$MKDEPEND"
369                fi
370                if test $KIND = 1 -o $KIND = 2 ; then
371                  command="$command --mods=../code_ad"                  command="$command --mods=../code_ad"
372              elif test "x$OADM" = xt ; then              elif test $KIND = 4 ; then
373                  command="$command -adof ../../../tools/adjoint_options/adjoint_oad -mods '../code_oad ../../OpenAD/code_oad_all'"                  command="$command -adof ../../../tools/adjoint_options/adjoint_oad -mods '../code_oad ../../OpenAD/code_oad_all'"
374              else              else
375                  command="$command -mods=../code"                  command="$command -mods=../code"
# Line 325  genmakemodel() Line 377  genmakemodel()
377              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
378                  command="$command -optfile=$OPTFILE"                  command="$command -optfile=$OPTFILE"
379              fi              fi
380              if test "x$IEEE" != x ; then              if test $OptLev = 1 ; then
381                  command="$command -ieee"                  command="$command -ieee"
382              fi              fi
383                if test $OptLev = 0 ; then
384                    command="$command -devel"
385                fi
386              if test "x$GSL" = xt ; then              if test "x$GSL" = xt ; then
387                  command="$command -gsl"                  command="$command -gsl"
388              fi              fi
389              if test "x$MPI" = xt ; then              if test "x$MPI" != x0 ; then
390                  command="$command -mpi"                  command="$command -mpi"
391              fi              fi
392              if test "x$MULTI_THREAD" = xt ; then              if test "x$MULTI_THREAD" = xt ; then
393              #- run multi-threaded using OpenMP:              #- run multi-threaded using OpenMP:
394                  command="$command -omp"                  command="$command -omp"
395              fi              fi
396                if test "x$USE_R4" = xt ; then
397                    command="$command -use_r4"
398                fi
399                if test "x$EXTRFLG" != x ; then
400                    command="$command -extra_flag $EXTRFLG"
401                fi
402              if test "x$TS" = xt ; then              if test "x$TS" = xt ; then
403                  command="$command -ts"                  command="$command -ts"
404              fi              fi
405              if test "x$PAPIS" = xt ; then              if test "x$PAPIS" = xt ; then
406                  command="$command -papis"                  command="$command -papis"
407              else              else
408              if test "x$PCLS" = xt ; then              if test "x$PCLS" = xt ; then
409                  command="$command -pcls"                  command="$command -pcls"
410              fi              fi
411              fi              fi
412              printf 'genmake ... ' 1>&2              printf 'genmake ... '
413              # $command > make.log 2>&1              eval $command > genmake.tr_log 2>&1
             eval $command > make.log 2>&1  
414              RETVAL=$?              RETVAL=$?
415              #  Reduce the size of the testing emails!              #  Reduce the size of the testing emails!
416              head -100 Makefile > $CDIR/Makefile_head              head -100 Makefile > $CDIR/Makefile_head
417              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
418                  tail make.log                  tail genmake.tr_log
419                  echo "genmakemodel: genmake failed" 1>&2                  echo "genmakemodel: genmake failed"
420                  cp genmake_* make.log $CDIR                  cp genmake.log genmake_* genmake.tr_log $CDIR
421                  return 1                  return 1
422              else              else
423                  echo "successful" 1>&2                  echo "successful"
424              fi              fi
425          )          )
426      fi      fi
# Line 369  genmakemodel() Line 429  genmakemodel()
429  makeclean()  makeclean()
430  {  {
431      # makeclean directory      # makeclean directory
432        if test "x$NODEPEND" = xf ; then rm -f $1/make.tr_log ; fi
433      if test "x$NOCLEAN" = xt ; then      if test "x$NOCLEAN" = xt ; then
434          echo "make Clean skipped!"          echo "make Clean skipped!"
435      else      else
# Line 376  makeclean() Line 437  makeclean()
437              cd $1;              cd $1;
438              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi              #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi
439              if test -r Makefile ; then              if test -r Makefile ; then
440                  printf 'clean build-dir: make Clean ... ' 2>&1                  printf 'clean build-dir: make Clean ... '
441                  $MAKE Clean >> make.log 2>&1                  $MAKE Clean >> make.tr_log 2>&1
442                  RETVAL=$?                  RETVAL=$?
443                  if test "x$RETVAL" != x0 ; then                  if test "x$RETVAL" != x0 ; then
444                      tail make.log                      tail make.tr_log
445                      echo "makeclean: \"make Clean\" failed" 1>&2                      echo "makeclean: \"make Clean\" failed"
446                      cp make.log $CDIR"/make.log"                      cp make.tr_log genmake.log genmake.tr_log $CDIR
447                      return 1                      return 1
448                  fi                  fi
449                  echo successful 1>&2                  echo successful
450              else              else
451                  echo ''                  echo ''
452              fi              fi
# Line 400  run_clean() Line 461  run_clean()
461      if test "x$NOCLEAN" = xt ; then      if test "x$NOCLEAN" = xt ; then
462          echo "run_clean skipped!"          echo "run_clean skipped!"
463      else      else
464          (        (
465              cd $1;          cd $1;
466              printf 'clean run-dir ... ' 2>&1          printf 'clean run-dir ... '
467              # part of what is done after "make clean" when doing "make CLEAN"          # part of what is done after "make clean" when doing "make CLEAN"
468              find . -name "*.meta" -exec rm {} \;          find . -name "*.meta" -exec rm {} \;
469              find . -name "*.data" -exec rm {} \;          find . -name "*.data" -exec rm {} \;
470              find . -name "fort.*" -exec rm {} \;          find . -name "fort.*" -exec rm {} \;
471              find . -type l -exec rm {} \;          find . -type l -exec rm {} \;
472              rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime          #- should remove executable only if sym-link (already done above)
473              rm -rf mnc_test_*          rm -f $RUNLOG *.txt STDOUT.* STDERR.* *diagnostics.log *.[0-9][0-9][0-9][0-9].log
474              rm -f *_MIT_CE_000.opt0000 costfunction*0000          rm -f datetime costfinal divided.ctrl snapshot* output_adm.*.diva_*
475              echo successful 1>&2          rm -f *_MIT_CE_000.opt0000 costfunction*0000
476              exit 0          rm -f oad_cp.[0-9][0-9][0-9].?????
477          )          rm -rf mnc_test_*
478            echo successful
479            exit 0
480          )
481      fi      fi
482  }  }
483    
# Line 425  makedependmodel() Line 489  makedependmodel()
489      else      else
490          (          (
491              cd $1;              cd $1;
492              printf 'make depend ... ' 1>&2              printf 'make depend ... '
493              $MAKE depend >> make.log 2>&1              $MAKE depend >> make.tr_log 2>&1
494              RETVAL=$?              RETVAL=$?
495              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
496                  tail make.log                  tail make.tr_log
497                  echo "makedependmodel: make depend failed" 1>&2                  echo "makedependmodel: make depend failed"
498                  cp make.log $CDIR"/make.log"                  cp make.tr_log genmake.log genmake.tr_log $CDIR
499                  return 1                  return 1
500              else              else
501                  echo successful 1>&2                  echo successful
502              fi              fi
503          )          )
504      fi      fi
# Line 444  makemodel() Line 508  makemodel()
508  {  {
509      # makemodel directory      # makemodel directory
510      (      (
511        mk_fail=0
512        if test "x$NOMAKE" = xt ; then
513            cd $1;
514            if test -x $EXECUTABLE ; then
515                echo "make skipped!"
516            else
517                echo "no executable!"
518                mk_fail=3
519            fi
520        else
521          cd $1;          cd $1;
522          if test -r Makefile ; then          if test -r Makefile ; then
523              printf 'make ... ' 1>&2              printf 'make ... '
524              if test "x$ADM" = xt ; then              if test "x$REPLMAKE" = x ; then
525                  $MAKE adall >> make.log 2>&1                  $MAKE $TARG >> make.tr_log 2>&1
526              elif test "x$OADM" = xt ; then              else
527                  $MAKE adAll >> make.log 2>&1                  $REPLMAKE $TARG >> make.tr_log 2>&1
             else  
                 if test "x$JOBS" = x ; then  
                     $MAKE >> make.log 2>&1  
                 else  
                     $MAKE -j $JOBS >> make.log 2>&1  
                 fi  
528              fi              fi
529              RETVAL=$?              RETVAL=$?
530              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
531                  tail make.log                  tail make.tr_log
532                  echo failed 1>&2                  echo failed
533                  cp make.log $CDIR"/make.log"                  cp genmake.log genmake.tr_log $CDIR
534                    tail -$NBLINES_MKLOG make.tr_log > $CDIR"/make.tr_log_tail"
535                  rm -f $EXECUTABLE                  rm -f $EXECUTABLE
536                  return 1                  mk_fail=1
537              else              else
538                  echo successful 1>&2                  echo successful
539              fi              fi
540            else
541                echo "no Makefile !"
542                mk_fail=2
543            fi
544        fi
545        if test $KIND = 1 -a -f taf_ftl.log ; then
546            head -1 taf_ftl.log >> $CDIR"/summary.txt"
547        fi
548        if test $KIND = 2 -a -f taf_ad.log ; then
549            head -1 taf_ad.log >> $CDIR"/summary.txt"
550            nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log`
551            nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log`
552            if test -f taf_output ; then
553                n2er=`grep -c 'TAF *.* ERROR ' taf_output`
554                n3er=`grep -c '\*ERROR\* ' taf_output`
555                nerr=`expr $nerr + $n2er + $n3er`
556          fi          fi
557            echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \
558                                    >> $CDIR"/summary.txt"
559        fi
560        if test $mk_fail != 0 ; then return $mk_fail ; fi
561      )      )
562  }  }
563    
564    mk_mpi_size()
565    {
566        # mk_mpi_size input_file output_file proc_Nb threads_Nb_X threads_Nb_Y
567        #
568        #  make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file)
569        #     for an MPI build with no more than proc_Nb processors ;
570        #  ensure that enough tiles per proc (nSx,nSy) remain for the given
571        #     number of threads (nTx,nTy) ;
572        #  return the effective number of processors.
573    
574        inp=$1
575        out=$2
576        np=$3
577        tx=$4
578        ty=$5
579        tmp=TTT.$$
580    
581        # dirX : select with direction to favor in MPI process repartition
582        #   dirX=1 : prefer to put more proc in X direction
583        #   dirX=0 : prefer to put more proc in Y direction
584        dirX=0
585    
586        px=`grep "^     & *nPx *=" $inp | sed "s/^     & *nPx *= *//" | sed 's/, *$//'`
587        py=`grep "^     & *nPy *=" $inp | sed "s/^     & *nPy *= *//" | sed 's/, *$//'`
588        sx=`grep "^     & *nSx *=" $inp | sed "s/^     & *nSx *= *//" | sed 's/, *$//'`
589        sy=`grep "^     & *nSy *=" $inp | sed "s/^     & *nSy *= *//" | sed 's/, *$//'`
590    
591        #- for each direction, assume # of threads is a multiple of total number of tiles
592        nx=$px
593        if [ `expr $sx % $tx` -ne 0 -a `expr $sx \* $px % $tx` -eq 0 ] ; then
594            nx=`expr $sx \* $px / $tx`
595            if [ $verbose -gt 1 ]; then
596                echo " change px from $px to $nx to accommodate $tx threads"
597            fi
598        fi
599        ny=$py
600        if [ `expr $sy % $ty` -ne 0 -a `expr $sy \* $py % $ty` -eq 0 ] ; then
601            ny=`expr $sy \* $py / $ty`
602            if [ $verbose -gt 1 ]; then
603                echo " change py from $py to $ny to accommodate $ty threads"
604            fi
605        fi
606        #- find the largest divisor of input_file proc Nb, but not larger than $np
607        pp=0
608        i=1
609        while [ $i -le $nx ] ; do
610          if [ `expr $nx % $i` -eq 0 ] ; then
611            j=1
612            while [ $j -le $ny ] ; do
613              if [ `expr $ny % $j` -eq 0 ] ; then
614                ij=`expr $i \* $j`
615                if [ $ij -gt $pp ] ; then
616                    flag=1
617                elif [ $ij -eq $pp ] ; then
618                    flag=$dirX
619                else
620                    flag=0
621                fi
622                if test $flag = 1 ; then
623                  if [ $ij -le $np ] ; then
624                    ix=$i ; jy=$j ; pp=$ij
625                    #echo "  ix,jy= $ix,$jy"
626                  fi
627                fi
628              fi
629              j=`expr $j + 1`
630            done
631          fi
632          i=`expr $i + 1`
633        done
634    
635        #- create new SIZE.h type file:
636        sx=`expr $sx \* $px / $ix`
637        sy=`expr $sy \* $py / $jy`
638        if [ $verbose -gt 1 ]; then
639            echo " px,py,np= $px,$py,$np : New MPI size: px,py= $ix,$jy : sx,sy= $sx,$sy"
640        fi
641        sed "/^     \& *nPx *=/s/[0-9]*,/$ix,/" $inp > $tmp
642        sed "/^     \& *nPy *=/s/[0-9]*,/$jy,/" $tmp > $out
643        sed "/^     \& *nSx *=/s/[0-9]*,/$sx,/" $out > $tmp
644        sed "/^     \& *nSy *=/s/[0-9]*,/$sy,/" $tmp > $out
645        rm -f $tmp
646        return $pp
647    }
648    
649  symlink_mpifiles()  symlink_mpifiles()
650  {  {
651      # 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 654  symlink_mpifiles()
654    
655      dir=$1      dir=$1
656      code_dir=$2      code_dir=$2
657      BUILD_DIR=$dir/$3      build_dir=$dir/$3
658      CODE_DIR=$dir/$code_dir  
       
659      # These are files that should replace their counter-part when using -mpi      # These are files that should replace their counter-part when using -mpi
660      MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)`      MPI_FILES=`(cd $dir/$code_dir; find . -name "*_mpi" -print)`
661    
662      #  Is this an MPI run?      for ii in $MPI_FILES ; do
663      if test "x$MPI" = xt ; then          i=`echo $ii | sed 's:^\./::'`
664          # YES: We symbolically link these files to the build          name=`echo $i | sed 's:_mpi::'`
665          # dir so long as there is no real file in place          file="../$code_dir/$i"
666          for ii in $MPI_FILES ; do          if test $name = 'SIZE.h' ; then file="SIZE.h.mpi" ; fi
667              i=`echo $ii | sed 's:^\./::'`  
668              name=`echo $i | sed 's:_mpi::' `          #  Is this an MPI run?
669              cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1          if test "x$MPI" = x0 ; then
670              RETVAL=$?              # NO: We undo any _mpi symbolically linked files
671              if test "x$RETVAL" != x0 ; then              if test -L $build_dir/$name ; then
672                  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  
673                  RETVAL=$?                  RETVAL=$?
674                  if test "x$RETVAL" = x0 ; then                  if test "x$RETVAL" = x0 ; then
675                      #echo Un-linking $name from $linktarg                      if [ $verbose -gt 1 ]; then
676                      rm -f $BUILD_DIR/$name                          echo "  Un-linking $name from ../$code_dir" ; fi
677                        rm -f $build_dir/$name
678                  fi                  fi
679              fi              fi
680          done          else
681      fi              # YES: We symbolically link these files to the build
682                    # dir so long as there is no real file in place
683                ( cd $build_dir ; cmp $name $file > /dev/null 2>&1 )
684                RETVAL=$?
685                if [ $verbose -gt 1 ]; then echo "  cmp $name $file returns: $RETVAL" ; fi
686                if test "x$RETVAL" != x0 ; then
687                    if test -h $build_dir/$name ; then rm -f $build_dir/$name ; fi
688                    if test ! -r $build_dir/$name ; then
689                        if [ $verbose -gt 1 ]; then echo "  Linking $name to $file" ; fi
690                        (cd $build_dir; ln -sf $file $name)
691                    fi
692                fi
693            fi
694        done
695  }  }
696    
697  linkdata()  linkdata()
# Line 528  linkdata() Line 702  linkdata()
702      if test -d $1 ; then      if test -d $1 ; then
703          (          (
704              cd $1 ; shift              cd $1 ; shift
705              inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')`              echo 'linkdata from dirs:' $*
706                inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')`
707              for xx in $inpMPI ; do              for xx in $inpMPI ; do
708                if test -r "../"$1"/"$xx ; then                if test -r "../"$1"/"$xx ; then
709                  # found 1 _mpi sfx file in 1rst input dir and it is readable                  # found 1 _mpi sfx file in 1rst input dir and it is readable
710                  yy=`echo $xx | sed 's:\.mpi$::'`                  yy=`echo $xx | sed 's:\.mpi$::'`
711                  if test "x$MPI" = "xt" ; then                  if test "x$MPI" = "x0" ; then
712                  # mpi test: remove symbolic link & link _mpi sfx file                      # not mpi test: remove symbolic link
713                      if test -h $yy ; then rm -f $yy ; fi                      if test -h $yy ; then rm -f $yy ; fi
                     if test ! -r $yy ; then  
                         ln -sf "../"$1"/"$xx $yy ;  
                         printf "$xx " 1>&2  
                     fi  
714                  else                  else
715                  # not mpi test: remove symbolic link                      # mpi test: remove symbolic link & link .mpi sfx file
716                      if test -h $yy ; then rm -f $yy ; fi                      if test -h $yy ; then rm -f $yy ; fi
717                        if test ! -r $yy ; then
718                            ln -sf "../"$1"/"$xx $yy ;
719                            printf " $xx" 1>&2
720                        fi
721                  fi                  fi
722                fi                fi
723              done              done
# Line 551  linkdata() Line 726  linkdata()
726                  if test "x$MULTI_THREAD" = "xt" ; then                  if test "x$MULTI_THREAD" = "xt" ; then
727                  # multi-threaded test: remove symbolic link & link eedata.mth                  # multi-threaded test: remove symbolic link & link eedata.mth
728                      if test -h eedata ; then rm -f eedata ; fi                      if test -h eedata ; then rm -f eedata ; fi
729                      if test ! -r eedata ; then                      if test ! -r eedata ; then
730                          ln -sf "../"$1"/eedata.mth" eedata ;                          ln -sf "../"$1"/eedata.mth" eedata ;
731                          printf 'eedata.mth ' 1>&2                          printf ' eedata.mth' 1>&2
732                      fi                      fi
733                  else                  else
734                  # not multi-threaded test: remove eedata symbolic link                  # not multi-threaded test: remove eedata symbolic link
# Line 563  linkdata() Line 738  linkdata()
738              prevDir='NONE'              prevDir='NONE'
739              for ldir in $* ; do              for ldir in $* ; do
740                  if test -d "../"$ldir -a $ldir != $prevDir ; then                  if test -d "../"$ldir -a $ldir != $prevDir ; then
741                      printf 'ldir='${ldir} 1>&2                      printf " ldir=${ldir}:" 1>&2
742                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`                      files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`
743                      for i in $files ; do                      for i in $files ; do
744                          if test ! -d "../"$ldir/$i ; then                          if test ! -d "../"$ldir/$i ; then
# Line 573  linkdata() Line 748  linkdata()
748                              fi                              fi
749                          fi                          fi
750                      done                      done
751                        printf ' ;' 1>&2
752                      if test -x "../"$ldir"/"prepare_run ; then                      if test -x "../"$ldir"/"prepare_run ; then
753                          "../"$ldir"/"prepare_run                          "../"$ldir"/"prepare_run 1>&2
754                        else
755                            echo '' 1>&2
756                      fi                      fi
                     printf ' ; ' 1>&2  
757                  fi                  fi
758                  prevDir=$ldir                  prevDir=$ldir
759              done              done
# Line 588  runmodel() Line 765  runmodel()
765  {  {
766      # runmodel directory      # runmodel directory
767      #      #
768      #  runs "$COMMAND in "directory"      #  runs $COMMAND in "directory"
769      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
770      (      (
771          cd $1          cd $1
772          printf 'runmodel in %s ...' $1 1>&2          printf 'runmodel in %s ... ' $1
773          # make output.txt          if test "x$MPI" != x0 ; then
774          echo              #- adjust the MPI run command with the right number of Procs
775          if test -L $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then              #echo '' ; echo "  COMMAND='$COMMAND'"
776              diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1              COMMAND=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"`
777              outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; fi              if test "x$MPI_MFILE" != x ; then
778                  COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"`
779                fi
780                #echo "  COMMAND='$COMMAND'"
781            fi
782            if test -L $EXECUTABLE ; then
783              if test -x "../"$builddir"/"$EXECUTABLE ; then
784                cmp $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1
785                outD=$? ; if test "x$outD" != x0 ; then rm -f $EXECUTABLE ; fi
786              else rm -f $EXECUTABLE
787              fi
788          fi          fi
789          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
790              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_tmp              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_tmp
791              ln -sf "../"$builddir"/"$EXECUTABLE .              ln -sf "../"$builddir"/"$EXECUTABLE .
792          fi          fi
793          if test ! -x $EXECUTABLE ; then          if test ! -x $EXECUTABLE ; then
794                  rm -f $RUNLOG ; touch $RUNLOG              rm -f $RUNLOG ; touch $RUNLOG
795                  if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi              if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
796                  echo " no executable:" $EXECUTABLE >> $RUNLOG              echo " no executable:" $EXECUTABLE >> $RUNLOG
797                  RETVAL=8              RETVAL=8
798                  ENDVAL=-1              ENDVAL=-1
799          else          else
800              if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then            if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then
801                # output do not exist or is older than executable:              # output do not exist or is older than executable:
802                  rm -f $RUNLOG ; touch $RUNLOG              rm -f $OUTPUTFILE $RUNLOG ; touch $RUNLOG
803                  if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi              if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
804                  ( eval $COMMAND ) >> $RUNLOG 2>&1          #- Divided Adjoint Run:
805                  RETVAL=$?          #  get the number of additional runs (add_DIVA_runs) from file "run_ADM_DIVA"
806              else              if test $KIND = 2 -a -f run_ADM_DIVA ; then
807                  RETVAL=0                adm_diva_nb=`sed -n '/^ *add_DIVA_runs\>.*=/p' run_ADM_DIVA | sed 's/ //g'`
808                  if test -f $RUNLOG ; then                echo " Divided Adjoint Run: $adm_diva_nb" >> $RUNLOG
809                      if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi                eval "let $adm_diva_nb"
810                      echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1                if [ $add_DIVA_runs -ge 1 ] ; then
811                  else                  rm -f costf* divided.ctrl snapshot*
812                      touch $RUNLOG                  echo -n "(add_DIVA_runs=$add_DIVA_runs) ... "
813                      if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi                  for ii in `seq 1 $add_DIVA_runs` ; do
814                      echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1                    ( eval $COMMAND ) >> $RUNLOG 2>&1
815                      echo " no previous $RUNLOG: assume NORMAL END" >> $RUNLOG 2>&1                    echo " additional DIVA run # $ii : done" >> $RUNLOG
816                  fi                    mv -f $OUTPUTFILE ${OUTPUTFILE}.diva_${ii}
817                    done
818                  fi
819                fi
820            #- special DIVA processing ends here
821                ( eval $COMMAND ) >> $RUNLOG 2>&1
822                RETVAL=$?
823                ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
824                if [ $POSTCLEAN -eq 1 -a $ENDVAL -gt 0 ] ; then
825                    find . -name "*.meta" -exec rm {} \;
826                    find . -name "*.data" -exec rm {} \;
827                    rm -rf mnc_test_*
828              fi              fi
829              ENDVAL=`cat $RUNLOG | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`            else
830                RETVAL=0
831                ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
832                touch $RUNLOG
833                if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
834                echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1
835              fi
836          fi          fi
837          rm -f run.log_tmp          rm -f run.log_tmp
838            #- in all cases where OutputFile exists, report SIZE and time
839            if test -f $OUTPUTFILE ; then
840              grep '(PID\.TID 0000\.0001)      n.. =' $OUTPUTFILE \
841                    | sed 's/(PID.TID 0000.0001)   //' >> $CDIR"/summary.txt"
842              grep -A3 'Seconds in section "ALL' $OUTPUTFILE \
843                    | sed 's/(PID.TID 0000.0001)   //' >> $CDIR"/summary.txt"
844            fi
845            if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
846          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then          if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
847              tail $RUNLOG              echo successful
848              echo successful 1>&2              printf '=> output from running in %s :\n' $1 1>&2
849              # === Reduce the size of the testing emails!              tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
             #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE  
             if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi  
850              return 0              return 0
851          elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then          elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then
852              #-- for some weird cases (run is finihed but with error code)              #-- for some weird cases (run is finihed but with error code)
853              tail $RUNLOG              echo 'finished with error (run:' $RETVAL ' end:' $ENDVAL ')'
854              echo finished with error '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2              printf '=> output from running in %s :\n' $1 1>&2
855                tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
856              return 0              return 0
857          else          else
858              tail $RUNLOG              echo 'failed (run:' $RETVAL ' end:' $ENDVAL ')'
859              echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2              printf '=> output from running in %s :\n' $1 1>&2
860                tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
861              cp $RUNLOG $CDIR"/"$RUNLOG              cp $RUNLOG $CDIR"/"$RUNLOG
             if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi  
862              return 1              return 1
863          fi          fi
864      )      )
# Line 697  EOF Line 908  EOF
908          return 0          return 0
909      else      else
910          echo          echo
911          echo "ERROR: failed to compile comparison code -- please specify"          echo "ERROR: failed to compile comparison code -- please specify"
912          echo "  a C compiler using the CC environment variable."          echo "  a C compiler using the CC environment variable."
913          exit 1          exit 1
914      fi      fi
# Line 716  formatresults() Line 927  formatresults()
927      printf '%3s' $listPrt      printf '%3s' $listPrt
928  #   line below does not work on hp-ux_ia64 : do those substitutions later on  #   line below does not work on hp-ux_ia64 : do those substitutions later on
929  #   printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</'  #   printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</'
930        
931      if [ $xx = '..' ]; then      if [ $xx = '..' ]; then
932          printf ' N/O '          printf ' N/O '
933      elif [ $xx = '--' ]; then      elif [ $xx = '--' ]; then
# Line 731  formatresults() Line 942  formatresults()
942          fi          fi
943      fi      fi
944      printf '  %s' $nm      printf '  %s' $nm
945        if test $KIND = 2 ; then
946            #-- apppend taf repport summary:
947            tafrep=`grep -c '^ TAF reports ' $CDIR/summary.txt`
948            if test $tafrep = 1 ; then
949                grep '^ TAF reports ' $CDIR/summary.txt | awk '{printf "  (e=%i, w=%i)",$3,$6}'
950            fi
951        fi
952      printf '\n'      printf '\n'
953        
954  }  }
955    
956  scandirs()  scandirs()
957  {  {
958      if [ $# -eq 1 ]; then      if [ $# -eq 1 ]; then
959          for arg in * ; do          for arg in * ; do
960              test -f $arg/$1 && echo $arg             #test -f $arg/$1 && echo $arg
961                test -f $arg/$1 -o -f $arg/$1.gz && echo $arg
962          done          done
963      else      else
964          echo $*          echo $*
# Line 749  scandirs() Line 968  scandirs()
968    
969  check_eedata()  check_eedata()
970  {  {
971      # check_eedata size.h eedata      # check_eedata eedata size.h
972      if [ $# -eq 2 ] ; then      if [ $# -eq 2 ] ; then
973        if test -f $1 -a -f $2 ; then       if test -f $1 -a -f $2 ; then
974        sx=`grep "^     & *nSx *=" $1 | sed "s/^     & *nSx *=//" | sed 's/, *$//'`        nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
975        nx=`grep "^ *nTx *=" $2 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`        sx=`grep "^     & *nSx *=" $2 | sed "s/^     & *nSx *=//" | sed 's/, *$//'`
976        if test "x$nx" = x ; then        if test "x$nx" = x ; then
977          rx=10          rx=10
978        else        else
979          rx=`expr $sx % $nx`          rx=`expr $sx % $nx`
980        fi        fi
981        sy=`grep "^     & *nSy *=" $1 | sed "s/^     & *nSy *=//" | sed 's/, *$//'`        ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
982        ny=`grep "^ *nTy *=" $2 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`        sy=`grep "^     & *nSy *=" $2 | sed "s/^     & *nSy *=//" | sed 's/, *$//'`
983        if test "x$ny" = x ; then        if test "x$ny" = x ; then
984          ry=20          ry=20
985        else        else
986          ry=`expr $sy % $ny`          ry=`expr $sy % $ny`
987        fi        fi
988        echo `expr $rx + $ry`        echo `expr $rx + $ry`
989      else       else
990        echo '-1'        echo '-1'
991        fi       fi
992        elif [ $# -eq 1 ] ; then
993         if test -f $1 ; then
994          nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
995          if test "x$nx" = x ; then nx=1 ; fi
996          ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
997          if test "x$ny" = x ; then ny=1 ; fi
998         #echo $nx $ny
999          echo $nx
1000         else
1001          echo '-1'
1002         fi
1003      else      else
1004        echo '-2'        echo '-2'
1005      fi      fi
# Line 782  check_eedata() Line 1012  check_eedata()
1012  #  Default properties  #  Default properties
1013  debug=0  debug=0
1014  verbose=1  verbose=1
1015  clean=0  NBLINES_MKLOG=16000
1016    
1017  IEEE=true  OptLev=1
 if test "x$MITGCM_IEEE" != x ; then  
     IEEE=$MITGCM_IEEE  
 fi  
1018  GSL=f  GSL=f
1019    
1020  CLEANUP=f  CLEANUP=f
1021    NORUN=f
1022  QUICK=f  QUICK=f
1023    NOMAKE=f
1024  NOGENMAKE=f  NOGENMAKE=f
1025  NOCLEAN=f  NOCLEAN=f
1026  NODEPEND=f  NODEPEND=f
1027  POSTCLEAN=f  POSTCLEAN=0
1028    
1029  BASH=  BASH=
1030  OPTFILE=NONE  OPTFILE=NONE
# Line 805  SKIPDIRS= Line 1034  SKIPDIRS=
1034  MPACKDIR="../tools/mpack-1.6"  MPACKDIR="../tools/mpack-1.6"
1035  HAVE_MPACK=  HAVE_MPACK=
1036  MPACK=  MPACK=
1037    SENDCMD=
1038    SAVDIR='.'
1039  COMMAND=  COMMAND=
1040    MKDEPEND=
1041  if test "x$MAKE" = x ; then  if test "x$MAKE" = x ; then
1042      MAKE=make      MAKE=make
1043  fi  fi
1044    REPLMAKE=
1045  if test "x$CC" = x ; then  if test "x$CC" = x ; then
1046      CC=cc      CC=cc
1047  fi  fi
1048  JOBS=  JOBS=
1049  MPI=f  TARG=
1050    MPI=0
1051    MPI_MFILE=
1052  MULTI_THREAD=f  MULTI_THREAD=f
1053  OUTDIR=  OUTDIR=
1054  DELDIR=  DELDIR=
1055    USE_R4=
1056    EXTRFLG=
1057    
1058  ADM=  #- type of testing (KIND):
1059  OADM=  #   KIND=0 : forward (= default) ;  KIND=1 : Tangent Linear with TAF ;
1060    #   KIND=2 : Adjoint with TAF ;     KIND=4 : Adjoint with OpenAD
1061    KIND=0
1062    
1063  # list of pTracers to check for monitor output  # list of pTracers to check for monitor output
1064  PTRACERS_NUM="1 2 3 4 5"  PTRACERS_NUM="1 2 3 4 5"
1065    
1066  MATCH_CRIT=13  MATCH_CRIT=10
1067    
1068  printf "parsing options...  "  printf "parsing options...  "
1069    
# Line 839  for ac_option ; do Line 1078  for ac_option ; do
1078      fi      fi
1079    
1080      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
1081        
1082      case $ac_option in      case $ac_option in
1083                    
1084          -help | --help | -h | --h)          -help | --help | -h | --h) usage ;;
1085              usage ;;  
1086                    -optfile | --optfile | -of | --of) ac_prev=OPTFILE ;;
1087          -optfile | --optfile | -of | --of)          -optfile=* | --optfile=* | -of=* | --of=*) OPTFILE=$ac_optarg ;;
1088              ac_prev=OPTFILE ;;  
1089          -optfile=* | --optfile=* | -of=* | --of=*)          -addr | --addr | -a | --a) ac_prev=ADDRESSES ;;
1090              OPTFILE=$ac_optarg ;;          -addr=* | --addr=* | -a=* | --a=*) ADDRESSES=$ac_optarg ;;
1091                    -mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;;
1092          -addr | --addr | -a | --a)          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;;
1093              ac_prev=ADDRESSES ;;  
1094          -addr=* | --addr=*)          -send | --send ) ac_prev=SENDCMD ;;
1095              ADDRESSES=$ac_optarg ;;          -send=* | --send=* ) SENDCMD=$ac_optarg ;;
1096          -mpackdir | --mpackdir | -mpd | --mpd)          -savdir | --savdir | -sd | --sd ) ac_prev=SAVDIR ;;
1097              ac_prev=MPACKDIR ;;          -savdir=* | --savdir=* | -sd=* | --sd=* ) SAVDIR=$ac_optarg ;;
1098          -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*)  
1099              MPACKDIR=$ac_optarg ;;          -tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;;
1100            -tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;;
1101          -tdir | --tdir | -t | --t)          -skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;;
1102              ac_prev=TESTDIRS ;;          -skipdir=* | --skipdir=* | -skd=* | --skd=*) SKIPDIRS=$ac_optarg ;;
1103          -tdir=* | --tdir=*)  
1104              TESTDIRS=$ac_optarg ;;          -bash | --bash | -b | --b) ac_prev=BASH ;;
1105            -bash=* | --bash=* | -b=* | --b=*) BASH=$ac_optarg ;;
1106          -skipdir | --skipdir | -skd | --skd)  
1107              ac_prev=SKIPDIRS ;;          -command | --command | -c | --c) ac_prev=COMMAND ;;
1108          -skipdir=* | --skipdir=*)          -command=* | --command=* | -c=* | --c=*) COMMAND=$ac_optarg ;;
1109              SKIPDIRS=$ac_optarg ;;  
1110            -makedepend | --makedepend | -md | --md) ac_prev=MKDEPEND ;;
1111          -bash | --bash | -b | --b)          -makedepend=* | --makedepend=* | -md=* | --md=*) MKDEPEND=$ac_optarg ;;
1112              ac_prev=BASH ;;  
1113          -bash=* | --bash=*)          -make | --make | -m | --m) ac_prev=MAKE ;;
1114              BASH=$ac_optarg ;;          -make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;;
1115    
1116          -command | --command | -c | --c)          -repl_mk | --repl_mk ) ac_prev=REPLMAKE ;;
1117              ac_prev=COMMAND ;;          -repl_mk=* | --repl_mk=*) REPLMAKE=$ac_optarg ;;
1118          -command=* | --command=*)  
1119              COMMAND=$ac_optarg ;;          -odir | --odir) ac_prev=OUTDIR ;;
1120            -odir=* | --odir=*) OUTDIR=$ac_optarg ;;
1121          -make | --make | -m | --m)  
1122              ac_prev=MAKE ;;          -ptracers | --ptracers | -ptr | --ptr) ac_prev=PTRACERS_NUM ;;
1123          -make=* | --make=*)          -ptracers=* | --ptracers=* | -ptr=* | --ptr=*) PTRACERS_NUM=$ac_optarg ;;
             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 ;;  
1124    
1125          -match | --match ) ac_prev=MATCH_CRIT ;;          -match | --match ) ac_prev=MATCH_CRIT ;;
1126          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;          -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;
1127    
1128          -j) ac_prev=JOBS ;;          -j | --j) ac_prev=JOBS ;;
1129          -j=*) JOBS=$ac_optarg ;;          -j=* | --j=*) JOBS=$ac_optarg ;;
1130    
1131          -clean | --clean)          -ef | --ef) ac_prev=EXTRFLG ;;
1132              CLEANUP=t ; DELDIR=t ;;          -ef=* | --ef=*) EXTRFLG=$ac_optarg ;;
1133    
1134          -quick | --quick | -q | --q)          -clean | --clean) CLEANUP=t ; DELDIR=t ;;
             QUICK=t ;;  
         -nogenmake | --nogenmake | -ng | --ng)  
             NOGENMAKE=t ;;  
         -noclean | --noclean | -nc | --nc)  
             NOCLEAN=t ;;  
         -nodepend | --nodepend | -nd | --nd)  
             NODEPEND=t ;;  
1135    
1136          -postclean | --postclean | -pc | --pc)          -norun | --norun | -nr | --nr) NORUN=t ;;
1137              POSTCLEAN=t ;;          -obj | --obj ) TARG='obj' ; NORUN=t ;;
1138            -runonly | --runonly | -ro | --ro) QUICK=t ; NOMAKE=t ;;
1139            -quick | --quick | -q | --q) QUICK=t ;;
1140            -nogenmake | --nogenmake | -ng | --ng) NOGENMAKE=t ;;
1141            -noclean | --noclean | -nc | --nc) NOCLEAN=t ;;
1142            -nodepend | --nodepend | -nd | --nd) NODEPEND=t ;;
1143    
1144            -postclean | --postclean | -pc | --pc) POSTCLEAN=2 ;;
1145            -deloutp | --deloutp | -do | --do) POSTCLEAN=1 ;;
1146    
1147            -mpi | --mpi) MPI=2 ;;
1148            -MPI | --MPI) ac_prev=MPI ;;
1149            -MPI=* | --MPI=*) MPI=$ac_optarg ;;
1150    
1151          -mpi) MPI=t ;;          -mfile | --mfile | -mf | --mf) ac_prev=MPI_MFILE ;;
1152            -mfile=* | --mfile=* | -mf=* | --mf=*) MPI_MFILE=$ac_optarg ;;
1153    
1154          -mth) MULTI_THREAD=t ;;          -mth) MULTI_THREAD=t ;;
1155    
1156          -adm | -ad) ADM=t ;;          -tlm) if test $KIND = 0 ; then KIND=1 ; else
1157                    echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage
1158          -oad) OADM=t; NODEPEND=t ;;                fi ;;
1159            -adm | -ad) if test $KIND = 0 ; then KIND=2 ; else
1160          -ieee) IEEE=true ;;                  echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage
1161          -noieee) IEEE= ;;                fi ;;
1162          -gsl) GSL=t ;;          -oad) if test $KIND = 0 ; then KIND=4 ; NODEPEND=t ; else
1163                    echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage
1164                  fi ;;
1165    
1166            -ieee)   echo "Warning: ignore option '-ieee' (already the default)"
1167                     printf " ... " ;;
1168            -noieee) echo "Warning: will use option '-fast' instead of '-noieee' (obsolete)"
1169                     printf " ... " ; OptLev=`expr $OptLev \* 2` ;;
1170            -fast)  OptLev=`expr $OptLev \* 2` ;;
1171            -devel) OptLev=0 ;;
1172            -gsl) GSL=t ;;
1173    
1174          -verbose) verbose=2 ;;          -verbose) verbose=2 ;;
1175          -debug) debug=1 ;;          -debug) debug=1 ;;
# Line 933  for ac_option ; do Line 1177  for ac_option ; do
1177    
1178          -deldir | -dd) DELDIR=t ;;          -deldir | -dd) DELDIR=t ;;
1179    
1180          -ts) TS=t;;          -use_r4|-ur4) USE_R4=t ;;
1181    
1182            -ts) TS=t;;
1183          -papis) PAPIS=t;;          -papis) PAPIS=t;;
   
1184          -pcls) PCL=t;;          -pcls) PCL=t;;
1185    
1186          -*)          -*) echo "Error: unrecognized option: "$ac_option
1187              echo "Error: unrecognized option: "$ac_option              usage ;;
1188              usage          *)  echo "Error: unrecognized argument: "$ac_option
1189              ;;              usage ;;
1190            
         *)  
             echo "Error: unrecognized argument: "$ac_option  
             usage  
             ;;  
           
1191       esac       esac
1192        
1193  done  done
1194    
1195  if test "x$QUICK" = xt ; then  if test "x$QUICK" = xt ; then
# Line 959  if test "x$QUICK" = xt ; then Line 1198  if test "x$QUICK" = xt ; then
1198      NODEPEND=t      NODEPEND=t
1199  fi  fi
1200    
1201    #- check length of MPI machine file:
1202    if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then
1203        if test -r $MPI_MFILE ; then
1204            nl=`wc -l $MPI_MFILE | awk '{print $1}'`
1205            if [ $nl -lt $MPI ] ; then
1206              echo "Error: need at least $MPI nodes (currently only $nl) in MPI_MFILE=$MPI_FILE"
1207              usage
1208            fi
1209            if [ $verbose -gt 1 ]; then
1210                echo " MPI_MFILE=$MPI_MFILE : $nl procs for MPI=$MPI run"
1211            fi
1212        else
1213              echo "Error: cannot access MPI_MFILE=$MPI_FILE"
1214              usage
1215        fi
1216    fi
1217    
1218  #- setting for forward or ADM testing  #- setting for forward or ADM testing
1219  if test "x$ADM" = xt ; then  if test $KIND = 1 ; then
1220        TARG=ftlall
1221        code_dir=code_ad
1222        inputdir=input_ad
1223        ref_outp="output_tlm.txt"
1224        EXECUTABLE="mitgcmuv_ftl"
1225    elif test $KIND = 2 ; then
1226        if test "x$TARG" = xobj ; then TARG=adobj ; else TARG=adall ; fi
1227      code_dir=code_ad      code_dir=code_ad
1228      inputdir=input_ad      inputdir=input_ad
1229      ref_outp="output_adm.txt"      ref_outp="output_adm.txt"
1230      EXECUTABLE="mitgcmuv_ad"      EXECUTABLE="mitgcmuv_ad"
1231  elif test "x$OADM" = xt ; then  elif test $KIND = 4 ; then
1232        TARG=adAll
1233      code_dir=code_oad      code_dir=code_oad
1234      inputdir=input_oad      inputdir=input_oad
1235      ref_outp="output_oadm.txt"      ref_outp="output_oadm.txt"
1236      EXECUTABLE="mitgcmuv_ad"      EXECUTABLE="mitgcmuv_ad"
1237  else  else
1238        if test "x$JOBS" != x ; then TARG="-j $JOBS $TARG" ; fi
1239      code_dir=code      code_dir=code
1240      inputdir=input      inputdir=input
1241      ref_outp="output.txt"      ref_outp="output.txt"
1242      EXECUTABLE="mitgcmuv"      EXECUTABLE="mitgcmuv"
1243  fi  fi
1244    
1245    xx=`echo $TESTDIRS | awk '{print $1}'`
1246  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
1247      LIST=`scandirs results/$ref_outp`      LIST=`scandirs results/$ref_outp`
1248    elif test $xx = 'start_from' ; then
1249        xx=`echo $TESTDIRS | awk '{print $2}'`
1250        LIST=`scandirs results/$ref_outp | sed -n "/$xx/,$ p"`
1251  else  else
1252      #- expand group of experiments:      #- expand group of experiments:
1253      LIST=" "      LIST=" "
# Line 993  else Line 1262  else
1262                   LIST=${LIST}" "`ls | grep 'tutorial_'` ;;                   LIST=${LIST}" "`ls | grep 'tutorial_'` ;;
1263          *)       LIST=${LIST}" "$xx ;;          *)       LIST=${LIST}" "$xx ;;
1264        esac        esac
1265      done      done
1266  fi  fi
1267  #echo 'LIST='${LIST}'<'  #echo 'LIST='${LIST}'<'
1268  #- skip dirs, remove duplicate and non-directory:  #- skip dirs, remove duplicate and non-directory:
# Line 1010  do Line 1279  do
1279              echo ""; echo -n " -- skip \"$xx\" (not a directory !)"              echo ""; echo -n " -- skip \"$xx\" (not a directory !)"
1280          fi          fi
1281      else      else
1282          if test $count = 1 ; then echo -n ", \"$xx\""          if test $count = 1 ; then echo -n ", \"$xx\""
1283          else count=1 ; echo "" ;  echo -n " skip: \"$xx\""          else count=1 ; echo "" ;  echo -n " skip: \"$xx\""
1284          fi          fi
1285      fi      fi
1286  done  done
1287  if test $count = 1 ; then echo "" ; echo -n " ... " ; fi  if test $count = 1 ; then echo "" ; echo -n " ... " ; fi
1288  #echo 'TESTDIRS='${TESTDIRS}'<'  #echo 'TESTDIRS='${TESTDIRS}'<'
1289    
# Line 1022  if test "x$OPTFILE" = xNONE -a "x$MITGCM Line 1291  if test "x$OPTFILE" = xNONE -a "x$MITGCM
1291      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
1292  fi  fi
1293    
1294  RUNLOG="run.log"  LOC_MFILE='tr_mpi_mfile'
1295    RUNLOG="run.tr_log"
1296  OUTPUTFILE=$ref_outp  OUTPUTFILE=$ref_outp
1297  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
1298      COMMAND="./$EXECUTABLE > $OUTPUTFILE"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
1299  fi  fi
1300  if test "x$MPI" = xt ; then  if test "x$MPI" != x0 ; then
1301      OUTPUTFILE="STDOUT.0000"      OUTPUTFILE="STDOUT.0000"
1302  fi  fi
1303    
1304  echo "OK (COMMAND= $COMMAND )"  echo "OK (COMMAND= $COMMAND )"
1305    
1306    TMP=./tr_$$
1307    #- try to put temporary files in system-local /tmp dir
1308    #TMP=/tmp/tr_$$
1309    #touch $TMP ; retVal=$?
1310    #if [ $retVal -eq 0 ] ; then
1311    #  if test ! -r $TMP ; then TMP=./tr_$$ ; fi
1312    #else
1313    #  TMP=./tr_$$
1314    #fi
1315    #rm -f $TMP
1316    #if [ $verbose -gt 1 ]; then echo " temp files: $TMP" ; fi
1317    
1318  # set the Default List of output variables to be checked:  # set the Default List of output variables to be checked:
1319  #  (use default or load experiment-specific list from file "tr_checklist")  #  (use default or load experiment-specific list from file "tr_checklist")
1320  # content : 1rst = main variable used to decide if it pass or FAIL  # content : 1rst = main variable used to decide if it pass or FAIL
1321  #         others = number of matching digits to be printed in summary.txt  #         others = number of matching digits to be printed in summary.txt
1322  if test "x$ADM" = x -a "x$OADM" = x; then  if test $KIND = 1 ; then
1323        DEF_CHECK_LIST='tlmGrd tlmCst tlmGrd fwdGrd'
1324        EMPTY_RESULTS='.. .. ..'
1325        LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`
1326    elif test $KIND = 2 -o $KIND = 4 ; then
1327        DEF_CHECK_LIST='AdGrd Cost AdGrd FDGrd'
1328        EMPTY_RESULTS='.. .. ..'
1329        LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`
1330    else
1331      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+'
1332      EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..'      EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..'
1333      LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`      LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`
1334      ii=`echo $EMPTY_RESULTS | awk '{print NF}'`      ii=`echo $EMPTY_RESULTS | awk '{print NF}'`
1335      EMPTY_RESULTS=$EMPTY_RESULTS`expr $LEN_CHECK_LIST - $ii | awk 'BEGIN{FS=":"}{for(i=1;i<=$1;i++){printf "  ."}}'`      EMPTY_RESULTS=$EMPTY_RESULTS`expr $LEN_CHECK_LIST - $ii | awk 'BEGIN{FS=":"}{for(i=1;i<=$1;i++){printf "  ."}}'`
 else  
     DEF_CHECK_LIST='Grad Cost Grad'  
     EMPTY_RESULTS='.. ..'  
     LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`  
1336  fi  fi
1337    
1338  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
1339  createcodelet  if test "x$CLEANUP" = xt -o -x tr_cmpnum ; then
1340        echo "skipping comparison code build"
1341    else
1342        createcodelet
1343    fi
1344    
1345  #  build the mpack utility (if ADDRESSES = NONE, do it to test the build)  #  build the mpack utility (if ADDRESSES = NONE, do it to test the build)
1346  if test "x$ADDRESSES" = x ; then  if test "x$ADDRESSES" = x -o "x$SENDCMD" != x ; then
1347      echo "skipping mpack build"      echo "skipping mpack build"
1348  else  else
1349      build_mpack      build_mpack
1350        if test "x$HAVE_MPACK" = xt ; then SENDCMD=$MPACK ; fi
1351  fi  fi
1352    
1353  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
1354  CMDLINE=$0  CMDLINE=$0
1355  for xx in "$@" ; do nw=`echo $xx | wc -w`  for xx in "$@" ; do nw=`echo $xx | wc -w`
1356      if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"      if test $nw = '1' ; then CMDLINE="$CMDLINE $xx" ; else
1357                          else CMDLINE="$CMDLINE '$xx'" ; fi        nb=`echo $xx | grep -c '='`
1358          if test $nb = 0 ; then CMDLINE="$CMDLINE '$xx'"
1359          else yy=`echo "$xx'" | sed "s/=/='/"` ;
1360                                 CMDLINE="$CMDLINE $yy" ; fi
1361        fi
1362  done  done
1363  #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done  #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done
1364  MACH=`hostname`  MACH=`hostname`
# Line 1110  if test "x$OPTFILE" != xNONE ; then Line 1405  if test "x$OPTFILE" != xNONE ; then
1405          echo >> $SUMMARY          echo >> $SUMMARY
1406          echo "  OPTFILE=$OPTFILE" >> $SUMMARY          echo "  OPTFILE=$OPTFILE" >> $SUMMARY
1407      else      else
1408          echo | tee $SUMMARY          echo | tee -a $SUMMARY
1409          echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY          echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee -a $SUMMARY
1410          exit 1          exit 1
1411      fi      fi
1412  else  else
1413      echo >> $SUMMARY      echo >> $SUMMARY
1414      echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY      echo "No \"OPTFILE\" was specified ; genmake2 found and uses:" >> $SUMMARY
1415      echo "   so the genmake default will be used." >> $SUMMARY      #-note: to be filled later after 1rst run
1416  fi  fi
1417  echo  echo
1418  echo >> $SUMMARY  echo >> $SUMMARY
1419  if test "x$ADM" = x -a "x$OADM" = x; then  if test $KIND = 0 ; then
1420      if [ $MATCH_CRIT -lt 10 ] ;      line_0=`printf '%s %2i' 'default' $MATCH_CRIT`
     then line_0="default  "$MATCH_CRIT ;  
     else line_0="default "$MATCH_CRIT ; fi  
1421         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"         line_0="$line_0  ----T-----  ----S-----  ----U-----  ----V-----"
 #   line_0="            ----T-----  ----S-----  ----U-----  ----V-----"  
1422      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"
1423      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  ."
1424      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"
1425      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  ."
1426      for ii in $PTRACERS_NUM ; do      for ii in $PTRACERS_NUM ; do
1427          line_0="$line_0  --PTR 0"$ii"--"          line_0="$line_0  --PTR 0"$ii"--"
# Line 1138  if test "x$ADM" = x -a "x$OADM" = x; the Line 1430  if test "x$ADM" = x -a "x$OADM" = x; the
1430          line_3="$line_3  i  a  a  d"          line_3="$line_3  i  a  a  d"
1431          line_4="$line_4  n  x  n  ."          line_4="$line_4  n  x  n  ."
1432      done      done
1433    else
1434        line_0=`printf '%s %2i' 'default   ' $MATCH_CRIT`
1435      if test $KIND = 1 ; then
1436       #echo "TANGLIN=true" >> $SUMMARY
1437        echo "TangLin generated by TAF" >> $SUMMARY
1438      elif test $KIND = 3 ; then
1439        echo "TangLin generated by OpenAD" >> $SUMMARY
1440      elif test $KIND = 2 ; then
1441       #echo "ADJOINT=true" >> $SUMMARY
1442        echo "Adjoint generated by TAF" >> $SUMMARY
1443      else
1444        echo "Adjoint generated by OpenAD" >> $SUMMARY
1445      fi
1446      if test $KIND = 1 -o $KIND = 3 ; then
1447        line_1="G D M    C  T  F"
1448        line_2="e p a R  o  L  D"
1449      else
1450        line_1="G D M    C  A  F"
1451        line_2="e p a R  o  d  D"
1452      fi
1453        line_3="n n k u  s  G  G"
1454        line_4="2 d e n  t  r  r"
1455        echo >> $SUMMARY
1456    fi
1457    if test "x$CLEANUP" != xt ; then
1458      echo "$line_0" | tee -a $SUMMARY      echo "$line_0" | tee -a $SUMMARY
1459      echo "$line_1" | tee -a $SUMMARY      echo "$line_1" | tee -a $SUMMARY
1460      echo "$line_2" | tee -a $SUMMARY      echo "$line_2" | tee -a $SUMMARY
1461      echo "$line_3" | tee -a $SUMMARY      echo "$line_3" | tee -a $SUMMARY
1462      echo "$line_4" | tee -a $SUMMARY      echo "$line_4" | tee -a $SUMMARY
1463      echo " "       | tee -a $SUMMARY      echo ""        | tee -a $SUMMARY
 else  
     echo "ADJOINT=true" >> $SUMMARY  
     echo >> $SUMMARY  
     if [ $MATCH_CRIT -lt 10 ] ;  
     then line_0="default     "$MATCH_CRIT ;  
     else line_0="default    "$MATCH_CRIT ; fi  
     echo "$line_0" | tee -a $SUMMARY  
     cat << EOF | tee -a $SUMMARY  
 G D M    C  G  
 E p a R  o  r  
 N n k u  s  a  
 2 d e n  t  d  
   
 EOF  
1464  fi  fi
1465    echo "-------------------------------------------------------------------------------"
1466    
1467  #  ...and each test directory...  #  ...and each test directory...
1468  for dir in $TESTDIRS ; do  for dir in $TESTDIRS ; do
1469        
1470      # set builddir & rundir:      # set builddir & rundir:
1471      builddir="build"      builddir="build"
1472      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1473      rundir="run"      rundir="run"
1474        pfxdir="tr_$rundir"
1475      if test ! -d $dir/$rundir ; then      if test ! -d $dir/$rundir ; then
1476          rundir=$builddir          rundir=$builddir
1477      fi      fi
# Line 1177  for dir in $TESTDIRS ; do Line 1482  for dir in $TESTDIRS ; do
1482      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
1483          echo -n '  --- dir:' $BUILD_DIR ': '          echo -n '  --- dir:' $BUILD_DIR ': '
1484          makeclean $BUILD_DIR          makeclean $BUILD_DIR
1485          rm -f $BUILD_DIR/$EXECUTABLE          (   cd $BUILD_DIR
1486                rm -f $EXECUTABLE *.bak
1487                rm -f genmake_state genmake_*optfile genmake.log
1488                rm -f SIZE.h.mpi genmake.tr_log make.tr_log
1489                rm -rf mpi_headers
1490            )
1491          if test -d $dir/$rundir/CVS ; then          if test -d $dir/$rundir/CVS ; then
1492              echo -n '  --- dir:' $dir/$rundir ': '              echo -n '  --- dir:' $dir/$rundir ': '
1493              run_clean $dir/$rundir              run_clean $dir/$rundir
1494          fi          fi
1495          trdir=`( cd $dir ; find . -type d -name "tr_run.*" -print | sed 's/^.\///')`          trdir=`( cd $dir ; find . -type d -name "$pfxdir.*" -print | sed 's/^.\///')`
1496          ttd=`echo $trdir | wc -w`          ttd=`echo $trdir | wc -w`
1497          if test $ttd != 0 ; then          if test $ttd != 0 ; then
1498              echo '  --- rm dir:' $trdir              echo '  --- rm dir:' $trdir
# Line 1191  for dir in $TESTDIRS ; do Line 1501  for dir in $TESTDIRS ; do
1501          continue          continue
1502      fi      fi
1503    
1504      #  Verify that the testdir exists and contains previous      #  Verify that the testdir exists and contains previous
1505      #  results in the correct location--or skip this directory!      #  results in the correct location--or skip this directory!
1506      fout=$dir"/results/"$ref_outp      fout=$dir"/results/"$ref_outp
1507      if test ! -r $fout ; then     #if test ! -r $fout ; then
1508        if test ! -r $fout -a ! -r ${fout}.gz ; then
1509          echo "can't read \"$fout\" -- skipping $dir"          echo "can't read \"$fout\" -- skipping $dir"
1510          continue          continue
1511      fi      fi
1512    
1513      # Check for specific files for particular type of run      # Check for specific files for particular type of run
1514    
1515      if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then      if test ! -r $CODE_DIR"/SIZE.h_mpi"  -a "x$MPI" != "x0" ; then
1516          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1517          continue          continue
1518      fi      fi
# Line 1209  for dir in $TESTDIRS ; do Line 1520  for dir in $TESTDIRS ; do
1520          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"          echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"
1521          continue          continue
1522      fi      fi
1523      if test "x$MPI" = "xt" -a "x$MULTI_THREAD" = "xt" ; then  
1524        retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/input/eedata.mth"`      if test "x$MPI" != "x0" ; then
1525        if test $retv != 0 ; then          ntx=1 ; nty=1
1526          echo "input/eedata.mth tiling misfit -- skipping $dir"          if test "x$MULTI_THREAD" = "xt" ; then
1527          continue            ff=$dir"/input/eedata.mth"
1528        fi            ntx=`grep "^ *nTx *=" $ff | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
1529              nty=`grep "^ *nTy *=" $ff | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
1530              if test "x$ntx" = x ; then ntx=1 ; fi
1531              if test "x$nty" = x ; then nty=1 ; fi
1532            fi
1533            #- create new SIZE.h with no more than '$MPI' Procs
1534            mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI $ntx $nty
1535            LOC_NPROC=$?
1536            (   cd $BUILD_DIR
1537                if test -r SIZE.h.mpi ; then
1538                    cmp tr_size.mpi SIZE.h.mpi > /dev/null 2>&1 ; RETVAL=$?
1539                else RETVAL=1
1540                fi
1541                if test "x$RETVAL" = x0 ; then
1542                    rm -f tr_size.mpi
1543                else
1544                    rm -f SIZE.h.mpi ; mv tr_size.mpi SIZE.h.mpi
1545                fi
1546            )
1547            if test "x$MPI_MFILE" != x ; then
1548                #- create new MPI machine-file with the right number of Procs
1549                rm -f $LOC_MFILE
1550                cat $MPI_MFILE | sort | uniq | head -$LOC_NPROC > $LOC_MFILE
1551                nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1552                if [ $nl -lt $LOC_NPROC ] ; then
1553                    rm -f $LOC_MFILE
1554                    cat $MPI_MFILE | head -$LOC_NPROC > $LOC_MFILE
1555                    #sed -n "1,$LOC_NPROC p" $MPI_MFILE > $LOC_MFILE
1556                fi
1557                if [ $verbose -gt 1 ]; then
1558                    nl=`wc -l $LOC_MFILE | awk '{print $1}'`
1559                    echo " new LOC_MFILE=$LOC_MFILE : $nl procs for LOC_NPROC=$LOC_NPROC"
1560                fi
1561            fi
1562            if test "x$MULTI_THREAD" = "xt" ; then
1563                retv=`check_eedata $dir"/input/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"`
1564                if test $retv != 0 ; then
1565                    echo "input/eedata.mth tiling misfit -- skipping $dir"
1566                    continue
1567                fi
1568            fi
1569      fi      fi
1570    
1571      #  Check whether there are "extra runs" for this testdir      #  Check whether there are "extra runs" for this testdir
1572      extra_runs=      extra_runs=
1573      ex_run_dirs=`( cd $dir ; echo $inputdir.* )`      if test "x$NORUN" = xf ; then
1574            ex_run_dirs=`( cd $dir ; ls -d $inputdir.* 2> /dev/null )`
1575        fi
1576      #echo "ex_run_dirs='$ex_run_dirs'"      #echo "ex_run_dirs='$ex_run_dirs'"
1577      for exd in $ex_run_dirs ; do      for exd in $ex_run_dirs ; do
1578          name=`echo $exd | sed -e "s/$inputdir\.//"`          name=`echo $exd | sed -e "s/$inputdir\.//"`
1579          refExOut=`echo $ref_outp | sed "s/\./.${name}./"`          refExOut=`echo $ref_outp | sed "s/\./.${name}./"`
1580          outf="$dir/results/$refExOut"          outf="$dir/results/$refExOut"
1581          if test -f $outf -a -r $outf ; then          if test -r $outf -o -r ${outf}.gz ; then
1582            if test "x$MULTI_THREAD" = "xt" ; then            if test "x$MULTI_THREAD" = "xt" ; then
1583              if test -r $dir"/"$exd"/eedata.mth" ; then              if test -r $dir"/"$exd"/eedata.mth" ; then
1584                if test "x$MPI" = "xt" ; then                if test "x$MPI" = "x0" ; then
1585                  retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/"$exd"/eedata.mth"`                  extra_runs="$extra_runs $name"
1586                  else
1587                    retv=`check_eedata $dir"/"$exd"/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"`
1588                  if test $retv = 0 ; then                  if test $retv = 0 ; then
1589                      extra_runs="$extra_runs $name"                      extra_runs="$extra_runs $name"
1590                  else                  else
1591                      echo $exd"/eedata.mth tiling misfit -- skipping $dir"                      echo $exd"/eedata.mth tiling misfit -- skipping $dir"
1592                  fi                  fi
               else  
                 extra_runs="$extra_runs $name"  
1593                fi                fi
1594              #else echo $dir"/"$exd"/eedata.mth: not found"              #else echo $dir"/"$exd"/eedata.mth: not found"
1595              fi              fi
# Line 1246  for dir in $TESTDIRS ; do Line 1599  for dir in $TESTDIRS ; do
1599          fi          fi
1600      done      done
1601    
     echo "-------------------------------------------------------------------------------"  
1602      echo      echo
1603      if test "x$extra_runs" = "x" ; then      if test "x$extra_runs" = "x" ; then
1604         echo "Experiment:  $dir"          echo "Experiment:  $dir"
1605      else      else
1606         echo "Experiment:  $dir ; extra_runs=$extra_runs"          echo "Experiment:  $dir ; extra_runs=$extra_runs"
1607      fi      fi
1608      echo      echo
1609      unset genmake makedepend make run      unset genmake makedepend make run
1610      results=$EMPTY_RESULTS      results=$EMPTY_RESULTS
1611    
1612      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir & summary.txt file for each tested experiment (tdir)
1613      rel_CDIR=$DRESULTS"/"$dir      locDIR=$DRESULTS"/"$dir
1614      mkdir $rel_CDIR      mkdir $locDIR
1615      CDIR=`pwd`"/$rel_CDIR"      #- report to this experiment local summary file ---
1616            echo "DATE='$DATE' ; tdir='$dir'" > $locDIR"/summary.txt"
1617      if test "x$CLEANUP" = xt ; then      echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1618          echo '====>>> this is to check that we never go through this part <<< ==='      echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1619          makeclean $dir/$builddir \      CDIR=`pwd`"/$locDIR"
1620              && run_clean $dir/$rundir  
1621        if test "x$NORUN" = xt ; then
1622                run=N
1623            genmakemodel $dir/$builddir && genmake=Y \
1624                && makeclean $dir/$builddir \
1625                && symlink_mpifiles $dir $code_dir $builddir \
1626                && makedependmodel $dir/$builddir && makedepend=Y \
1627                && makemodel $dir/$builddir && make=Y
1628      else      else
1629          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
1630              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
1631              && run_clean $dir/$rundir \              && symlink_mpifiles $dir $code_dir $builddir \
             && symlink_mpifiles $dir $code_dir $builddir \  
1632              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
1633              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
1634              && linkdata $dir/$rundir $inputdir input \              && run_clean $dir/$rundir \
1635                && linkdata $dir/$rundir $inputdir \
1636              && runmodel $dir/$rundir && run=Y \              && runmodel $dir/$rundir && run=Y \
1637              && results=`testoutput_run $dir $rundir $ref_outp`              && results=`testoutput_run $dir $rundir $ref_outp`
1638      fi      fi
1639            #echo "results='$results'"
1640      echo  
1641          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`          fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1642          echo          echo 1>&2
1643          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY          echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
1644          touch $CDIR"/summary.txt"          echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
         echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $CDIR"/summary.txt"  
         echo "MACH='$MACH'" >> $CDIR"/summary.txt"  
         echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
         echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
         echo "tdir='$dir'" >> $CDIR"/summary.txt"  
         if test "x$ADM" = xt ; then  
             head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt"  
             grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \  
                                 >> $CDIR"/summary.txt"  
         fi  
1645    
1646          for ex in $extra_runs ; do          for ex in $extra_runs ; do
1647              unset run              unset run
1648              results=$EMPTY_RESULTS              results=$EMPTY_RESULTS
1649              #  reference output file              #  reference output file
1650              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`              refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`
1651              #  Create an output dir for each OPTFILE/tdir.ex combination              #  Create an output dir & summary.txt file for each extra run (tdir.ex)
1652              rel_CDIR=$DRESULTS"/"$dir"."$ex              locDIR=$DRESULTS"/"$dir"."$ex
1653              mkdir $rel_CDIR              mkdir $locDIR
1654              CDIR=`pwd`"/$rel_CDIR"              #- report to this experiment local summary file ---
1655              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"              echo "DATE='$DATE' ; tdir='$dir.$ex'" > $locDIR"/summary.txt"
1656              run_clean $dir/tr_run.$ex              #echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1657              linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir input              #echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1658              runmodel $dir/tr_run.$ex && run=Y \              CDIR=`pwd`"/$locDIR"
1659              && results=`testoutput_run $dir tr_run.$ex $refExOut`              test ! -e "$dir/$pfxdir.$ex" && mkdir "$dir/$pfxdir.$ex"
1660              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              run_clean $dir/$pfxdir.$ex
1661              fres="$fres.$ex"              linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir
1662              echo              runmodel $dir/$pfxdir.$ex && run=Y \
1663                && results=`testoutput_run $dir $pfxdir.$ex $refExOut`
1664                fres=`formatresults $dir.$ex ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1665                echo 1>&2
1666              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY              echo "$fres" | sed 's/ 99/ --/g' | sed 's/  > />/' | sed 's/  < /</' >> $SUMMARY
1667              touch $CDIR"/summary.txt"              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
1668              echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $CDIR"/summary.txt"              if test "x$POSTCLEAN" = x2 ; then
1669              echo "MACH='$MACH'" >> $CDIR"/summary.txt"                  run_clean $dir/$pfxdir.$ex
             echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"  
             echo "DATE='$DATE'" >> $CDIR"/summary.txt"  
             echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt"  
             if test "x$ADM" = xt ; then  
                 head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt"  
                 grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \  
                                    >> $CDIR"/summary.txt"  
             fi  
             if test "x$POSTCLEAN" = xt ; then  
                 run_clean $dir/tr_run.$ex  
1670              fi              fi
1671          done          done
1672    
1673        if test ! -f $DRESULTS"/"genmake_state ; then
1674            if test -f $dir/$builddir/Makefile ; then
1675                mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
1676                echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state
1677                sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state
1678                echo " $mkOpt" >> $DRESULTS/genmake_state
1679                if test "x$OPTFILE" = xNONE ; then
1680                    eval $mkOpt
1681                    sed "/^No \"OPTFILE\" was specified ; genmake2/a\  OPTFILE=${OPTFILE}"\
1682                            $SUMMARY > tmp.tr_log
1683                    RETVAL=$?
1684                    if test "x$RETVAL" = x0 ; then
1685                        cp -f tmp.tr_log $SUMMARY
1686                    fi
1687                    rm -f tmp.tr_log
1688                fi
1689                gmkLog=$dir/$builddir/genmake.log
1690                if test -r $gmkLog ; then
1691                    grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1
1692                    RETVAL=$?
1693                    if test "x$RETVAL" = x0 ; then
1694                      echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state
1695                      echo "extract compiler version:"   >> $DRESULTS/genmake_state
1696                      sed -n '/Get compiler version/,/<-- compiler version/p' \
1697                         $gmkLog | grep -v '^... compiler version ' > tmp.tr_log
1698                      sed -n '1p' tmp.tr_log >> $DRESULTS/genmake_state
1699                      sed -n '2,/^$/p' tmp.tr_log | sed '/^$/d' | sed 's/^./ &/' \
1700                                             >> $DRESULTS/genmake_state
1701                      rm -f tmp.tr_log
1702                    fi
1703                    echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state
1704                    echo "get NETCDF & LAPACK settings:" >> $DRESULTS/genmake_state
1705                    sed -n '/set HAVE_NETCDF=/p' $gmkLog >> $DRESULTS/genmake_state
1706                    sed -n '/set HAVE_LAPACK=/p' $gmkLog >> $DRESULTS/genmake_state
1707                fi
1708            fi
1709        fi
1710      #postclean $dir/$builddir      #postclean $dir/$builddir
1711      if test "x$POSTCLEAN" = xt ; then      if test "x$POSTCLEAN" = x2 ; then
1712          makeclean $dir/$builddir \          makeclean $dir/$builddir \
1713              && run_clean $dir/$rundir              && run_clean $dir/$rundir
1714      fi      fi
1715            if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then rm -f $LOC_MFILE ; fi
1716    
1717      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
1718        
1719  done  done
1720    
1721  printf "Start time:  " >> $SUMMARY  printf "Start time:  " >> $SUMMARY
# Line 1348  date >> $SUMMARY Line 1728  date >> $SUMMARY
1728  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then  if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
1729      echo "No results email was sent."      echo "No results email was sent."
1730  else  else
1731      if test "x$HAVE_MPACK" = xt ; then      if test "x$SENDCMD" != x ; then
1732          tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \          if [ $verbose -gt 1 ]; then
1733              && gzip $DRESULTS".tar" \             echo " run: $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES"
1734              && $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES          fi
1735            tar -cf ${SAVDIR}/${DRESULTS}".tar" $DRESULTS > /dev/null 2>&1 \
1736                && gzip ${SAVDIR}/${DRESULTS}".tar" \
1737                && $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES
1738          RETVAL=$?          RETVAL=$?
1739          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
1740              echo              echo
# Line 1364  else Line 1747  else
1747              echo "An email containing results was sent to the following addresses:"              echo "An email containing results was sent to the following addresses:"
1748              echo "  \"$ADDRESSES\""              echo "  \"$ADDRESSES\""
1749              echo              echo
1750              test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"              test -f ${SAVDIR}/${DRESULTS}".tar" &&  rm -f ${SAVDIR}/${DRESULTS}".tar"
1751              test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"              test -f ${SAVDIR}/${DRESULTS}".tar.gz" &&  rm -f ${SAVDIR}/${DRESULTS}".tar.gz"
1752          fi          fi
1753      fi      fi
1754  fi  fi
1755    
1756  rm -f tr_cmpnum.c tr_cmpnum  if test "x$QUICK" = xf -a "x$NORUN" = xf ; then
1757        rm -f tr_cmpnum.c tr_cmpnum
1758    fi
1759    
1760  if test "x$CLEANUP" != xt ; then  if test "x$CLEANUP" != xt ; then
1761      cat $SUMMARY | sed 's/ \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \. //'      cat $SUMMARY | sed 's/ \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \.  \. //'
1762      if test -e tr_out.txt ; then      if test -e tr_out.txt ; then
1763          mv tr_out.txt tr_out.txt.old          mv tr_out.txt tr_out.txt.old
1764      fi      fi
1765      cat $SUMMARY | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' > tr_out.txt      cat $SUMMARY | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' > tr_out.txt
1766  fi  fi
# Line 1383  fi Line 1768  fi
1768  if test "x$DELDIR" = xt ; then  if test "x$DELDIR" = xt ; then
1769      rm -rf $DRESULTS      rm -rf $DRESULTS
1770  fi  fi
1771    echo "======== End of testreport execution ========"

Legend:
Removed from v.1.132  
changed lines
  Added in v.1.192

  ViewVC Help
Powered by ViewVC 1.1.22