/[MITgcm]/MITgcm/verification/testreport
ViewVC logotype

Diff of /MITgcm/verification/testreport

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

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

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

  ViewVC Help
Powered by ViewVC 1.1.22