/[MITgcm]/MITgcm/tools/do_tst_2+2
ViewVC logotype

Diff of /MITgcm/tools/do_tst_2+2

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

revision 1.2 by jmc, Wed Jan 9 22:02:03 2008 UTC revision 1.9 by jmc, Wed Jan 19 23:43:13 2011 UTC
# Line 12  usage() Line 12  usage()
12          echo "  -help         : print usage"          echo "  -help         : print usage"
13          echo "  -t   LIST_EXP : only check experiments in LIST_EXP"          echo "  -t   LIST_EXP : only check experiments in LIST_EXP"
14          echo "  -skd LIST_EXP : skip experiments in LIST_EXP"          echo "  -skd LIST_EXP : skip experiments in LIST_EXP"
15            echo "  -exe  COMMAND : use COMMAND to run the tests"
16            echo "  -mpi          : run the tests using MPI"
17          echo "  -o     STRING : used to build output directory name"          echo "  -o     STRING : used to build output directory name"
18          echo "                      (DEF=\"hostname\")"          echo "                      (DEF=\"hostname\")"
19          echo "  -a,-A  STRING : email address to send output to"          echo "  -a,-A  STRING : email address to send output to"
# Line 24  usage() Line 26  usage()
26  CLEAN=0  CLEAN=0
27  TESTDIRS=  TESTDIRS=
28  SKIPDIRS=  SKIPDIRS=
29  OUTDIR=`hostname`  SCRIPT='../tools/tst_2+2'
30    scrArg='All'
31    COMMAND=
32    mpi=0
33    OUTDIR=`hostname | sed 's/\..*$//'`
34  SAVELOG=0  SAVELOG=0
35  ADDRESS=  ADDRESS=
 SCRIPT='../tools/tst_2+2'  
36  MPACK="../tools/mpack-1.6/mpack"  MPACK="../tools/mpack-1.6/mpack"
37  here=`pwd`  here=`pwd`
38  yy=  yy=
# Line 42  do Line 47  do
47        -clean) CLEAN=1 ;;        -clean) CLEAN=1 ;;
48        -t    ) yy=TESTDIRS ;;        -t    ) yy=TESTDIRS ;;
49        -skd  ) yy=SKIPDIRS ;;        -skd  ) yy=SKIPDIRS ;;
50          -exe  ) yy=COMMAND ;;
51          -mpi  ) mpi=1 ;;
52        -a    ) yy=ADDRESS ;;        -a    ) yy=ADDRESS ;;
53        -A    ) yy=ADDRESS ; SAVELOG=1 ;;        -A    ) yy=ADDRESS ; SAVELOG=1 ;;
54        -o    ) yy=OUTDIR ;;        -o    ) yy=OUTDIR ;;
# Line 128  echo  >> $SUMMARY Line 135  echo  >> $SUMMARY
135  echo 'P. Run  Result     experiment'  >> $SUMMARY  echo 'P. Run  Result     experiment'  >> $SUMMARY
136  echo '  1 2 3'  >> $SUMMARY  echo '  1 2 3'  >> $SUMMARY
137    
138    #-- For MPI test:
139    RUNOUTP="output.txt"
140    if [ $mpi -ge 1 ] ; then
141      SCRIPT="$SCRIPT -mpi"
142      RUNOUTP="STDOUT.0000"
143    fi
144    
145  for xx in $LIST  for xx in $LIST
146  do  do
147    echo ==============================================================================    echo ==============================================================================
148      if [ $mpi -ge 1 ] ; then
149        NP_MPI=2
150        mpi_size=$xx/build/SIZE.h.mpi
151        if test -f $mpi_size ; then
152          px=`grep '^     & *nPx *=' $mpi_size | sed 's/^     & *nPx *= *//' | sed 's/, *$//'`
153          py=`grep '^     & *nPy *=' $mpi_size | sed 's/^     & *nPy *= *//' | sed 's/, *$//'`
154          pp=`expr $px \* $py` > /dev/null 2>&1 ; out=$?
155          if test "x$out" = x0 ; then NP_MPI=$pp ; fi
156        fi
157        rCommand=`echo $COMMAND | sed "s/ TR_NPROC / $NP_MPI /"`
158      else
159        rCommand=$COMMAND
160      fi
161    listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )`    listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )`
162    for yy in $listD    for yy in $listD
163    do    do
164      if test -f $xx/$yy/output.txt ; then      if test -f $xx/$yy/$RUNOUTP ; then
165        if test "x$OPTFILE" = x -a -f $xx/build/Makefile ; then        if test "x$OPTFILE" = x -a -f $xx/build/Makefile ; then
166          comm=`grep '^# OPTFILE=' $xx/build/Makefile 2>/dev/null | head -1 | sed 's/^# //'`          comm=`grep '^# OPTFILE=' $xx/build/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
167          echo "from '$xx/build/Makefile', extract:" > $DRESULTS/genmake_state          echo "from '$xx/build/Makefile', extract:" > $DRESULTS/genmake_state
168          echo $comm >> $DRESULTS/genmake_state          sed -n '/^# executed by:/,+1 p' $xx/build/Makefile >> $DRESULTS/genmake_state
169            echo " $comm" >> $DRESULTS/genmake_state
170          eval $comm          eval $comm
171            gmkLog=$xx/build/genmake.log
172            grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1
173            out=$?
174            if test "x$out" = x0 ; then
175                echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state
176                sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \
177                           | grep -v '^... compiler version ' > tr_vers.tmp_log
178                sed -n '1,/^$/p' tr_vers.tmp_log | sed '/^$/d' | sed 's/^./ &/' \
179                          >> $DRESULTS/genmake_state
180                rm -f tr_vers.tmp_log
181            fi
182        fi        fi
183        if test $yy = 'run' ; then nam=$xx        if test $yy = 'run' ; then nam=$xx
184        else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi        else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi
185        echo -n "Entering $xx/$yy :"        echo -n "Entering $xx/$yy :"
186        cd $xx/$yy        cd $xx/$yy
187        pwd > outp.tst_2+2.log        pwd > outp.tst_2+2.log
188        echo $SCRIPT All >> outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log        if test "x$COMMAND" = x ; then
189        $SCRIPT All >> outp.tst_2+2.log 2>&1          echo $SCRIPT $scrArg >> outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log
190        out=$?          $SCRIPT $scrArg >> outp.tst_2+2.log 2>&1
191            out=$?
192          else
193            echo "$SCRIPT $scrArg -command \"$rCommand\"" >> outp.tst_2+2.log
194            echo ' ' >> outp.tst_2+2.log
195            $SCRIPT $scrArg -command "$rCommand" >> outp.tst_2+2.log 2>&1
196            out=$?
197          fi
198        case $out in        case $out in
199         0 ) echo ' pass test 2+2=4'         0 ) echo ' pass test 2+2=4'
200             echo "Y Y Y Y  pass   <- $nam" >> ../../$SUMMARY ;;             echo "Y Y Y Y  pass   <- $nam" >> ../../$SUMMARY ;;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.22