/[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.15 by jmc, Sat Aug 18 18:59:14 2012 UTC revision 1.20 by jmc, Fri Oct 23 23:11:50 2015 UTC
# Line 20  usage() Line 20  usage()
20          echo "  -a,-A  STRING : email address to send output to"          echo "  -a,-A  STRING : email address to send output to"
21          echo "                      (DEF=\"\" no email is sent)"          echo "                      (DEF=\"\" no email is sent)"
22          echo "                      (-A: + save each log file)"          echo "                      (-A: + save each log file)"
23            echo "  -send  STRING : sending command (instead of using mpack)"
24            echo "  -sd    STRING : location to save output tar file to send (DEF='$SAVDIR')"
25          echo "  -clean        : clean output & reset"          echo "  -clean        : clean output & reset"
26          exit          exit
27  }  }
# Line 30  SKIPDIRS= Line 32  SKIPDIRS=
32  SCRIPT='../tools/tst_2+2'  SCRIPT='../tools/tst_2+2'
33  LOGFILE='tst_2+2_out.log'  LOGFILE='tst_2+2_out.log'
34  scrArg='All'  scrArg='All'
35    bldDir='build'
36  COMMAND=  COMMAND=
37  mpi=0  mpi=0
38  MPI_MFILE=  MPI_MFILE=
39  OUTDIR=`hostname | sed 's/\..*$//'`  OUTDIR=`hostname -s | tr '[:upper:]' '[:lower:]'`
40  SAVELOG=0  SAVELOG=0
41  ADDRESS=  ADDRESS=
42  MPACK="../tools/mpack-1.6/mpack"  MPACK="../tools/mpack-1.6/mpack"
43    SENDCMD=
44    SAVDIR='.'
45  here=`pwd`  here=`pwd`
46  yy=  yy=
47  for xx  for xx
# Line 55  do Line 60  do
60        -mf   ) yy=MPI_MFILE ;;        -mf   ) yy=MPI_MFILE ;;
61        -a    ) yy=ADDRESS ;;        -a    ) yy=ADDRESS ;;
62        -A    ) yy=ADDRESS ; SAVELOG=1 ;;        -A    ) yy=ADDRESS ; SAVELOG=1 ;;
63          -send ) yy=SENDCMD ;;
64          -sd   ) yy=SAVDIR ;;
65        -o    ) yy=OUTDIR ;;        -o    ) yy=OUTDIR ;;
66          *) echo "Error: unrecognized option: "$xx ; usage ; exit ;;          *) echo "Error: unrecognized option: "$xx ; usage ; exit ;;
67        esac        esac
# Line 78  do Line 85  do
85    fi    fi
86  done  done
87    
88  #------------------------  if test -x $SCRIPT ; then
89  if test $CLEAN = 1 ; then   if test $CLEAN = 1 ; then
90   echo "clean output from script '$SCRIPT' for experiment in:"     echo "clean output from script '$SCRIPT' for experiment in:"
91     else
92       echo "run script '$SCRIPT' for experiment in:"
93     fi
94   echo " $LIST"   echo " $LIST"
95   echo ""   echo ""
96     yy=`echo $SCRIPT | grep -c '^\/'`
97     if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi
98    else
99     echo "ERROR: script '$SCRIPT' not found or not executable"
100     exit
101    fi
102    #------------------------
103    
104    if test $CLEAN = 1 ; then
105   for xx in $LIST   for xx in $LIST
106   do   do
107    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' )`
# Line 100  if test $CLEAN = 1 ; then Line 119  if test $CLEAN = 1 ; then
119   done   done
120   exit   exit
121  fi  fi
 if test -x $SCRIPT ; then  
  echo "run script '$SCRIPT' for experiment in:"  
  echo " $LIST"  
  echo ""  
  yy=`echo $SCRIPT | grep -c '^\/'`  
  if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi  
 else  
  echo "ERROR: script '$SCRIPT' not found or not executable"  
  exit  
 fi  
   
122  #------------------------  #------------------------
123  #  Create a uniquely named directory to store results  #  Create a uniquely named directory to store results
124  CMDLINE=$0  CMDLINE=$0
# Line 118  for xx in "$@" ; do nw=`echo $xx | wc -w Line 126  for xx in "$@" ; do nw=`echo $xx | wc -w
126      if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"      if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"
127                          else CMDLINE="$CMDLINE '$xx'" ; fi                          else CMDLINE="$CMDLINE '$xx'" ; fi
128  done  done
 #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done  
129  DATE=''  DATE=''
130  if test -f tr_out.txt ; then  if test -f tr_out.txt ; then
131  #  try to use the date corresponding to 'Start time:' in file "tr_out.txt" :  #  try to use the date corresponding to 'Start time:' in file "tr_out.txt" :
# Line 162  RUNOUTP="output.txt" Line 169  RUNOUTP="output.txt"
169  if [ $mpi -ge 1 ] ; then  if [ $mpi -ge 1 ] ; then
170    SCRIPT="$SCRIPT -mpi"    SCRIPT="$SCRIPT -mpi"
171    RUNOUTP="STDOUT.0000"    RUNOUTP="STDOUT.0000"
172      if test "x$COMMAND" = x ; then COMMAND="mpirun -v -np TR_NPROC ./mitgcmuv" ; fi
173  fi  fi
174    
175  for xx in $LIST  for xx in $LIST
# Line 171  do Line 179  do
179      rCommand=$COMMAND      rCommand=$COMMAND
180    else    else
181      LOC_NPROC=2      LOC_NPROC=2
182      mpi_size=$xx/build/SIZE.h.mpi      mpi_size=$xx/$bldDir/SIZE.h.mpi
183      if test -f $mpi_size ; then      if test -f $mpi_size ; then
184        px=`grep '^     & *nPx *=' $mpi_size | sed 's/^     & *nPx *= *//' | sed 's/, *$//'`        px=`grep '^     & *nPx *=' $mpi_size | sed 's/^     & *nPx *= *//' | sed 's/, *$//'`
185        py=`grep '^     & *nPy *=' $mpi_size | sed 's/^     & *nPy *= *//' | sed 's/, *$//'`        py=`grep '^     & *nPy *=' $mpi_size | sed 's/^     & *nPy *= *//' | sed 's/, *$//'`
# Line 196  do Line 204  do
204    for yy in $listD    for yy in $listD
205    do    do
206      if test -f $xx/$yy/$RUNOUTP ; then      if test -f $xx/$yy/$RUNOUTP ; then
207        if test "x$OPTFILE" = x -a -f $xx/build/Makefile ; then        if test "x$OPTFILE" = x -a -f $xx/$bldDir/Makefile ; then
208          comm=`grep '^# OPTFILE=' $xx/build/Makefile 2>/dev/null | head -1 | sed 's/^# //'`          comm=`grep '^# OPTFILE=' $xx/$bldDir/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
209          echo "from '$xx/build/Makefile', extract:" > $DRESULTS/genmake_state          echo "from '$xx/$bldDir/Makefile', extract:" > $DRESULTS/genmake_state
210          sed -n '/^# executed by:/,+1 p' $xx/build/Makefile >> $DRESULTS/genmake_state          sed -n '/^# executed by:/,+1 p' $xx/$bldDir/Makefile >> $DRESULTS/genmake_state
211          echo " $comm" >> $DRESULTS/genmake_state          echo " $comm" >> $DRESULTS/genmake_state
212          eval $comm          eval $comm
213          gmkLog=$xx/build/genmake.log          gmkLog=$xx/$bldDir/genmake.log
214          grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1          grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1
215          out=$?          out=$?
216          if test "x$out" = x0 ; then          if test "x$out" = x0 ; then
# Line 255  done Line 263  done
263  printf "End time:    " >> $SUMMARY  printf "End time:    " >> $SUMMARY
264  date >> $SUMMARY  date >> $SUMMARY
265    
266  #  If address was supplied and mpack exist, then send email using mpack.  #  If address was supplied, then send email using Send-Command or mpack.
267  if test "x$ADDRESS" != xNONE -a "x$ADDRESS" != x ; then  if test "x$ADDRESS" != xNONE -a "x$ADDRESS" != x ; then
268      if test -x $MPACK ; then      if test "x$SENDCMD" = x ; then
269          tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \        # if Send-Command is empty and mpack exist, then send email using mpack.
270              && gzip $DRESULTS".tar" \        if test -x $MPACK ; then SENDCMD=$MPACK
271              && $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESS        else
272            echo "Warning: $MPACK is not executable => no email was sent"
273            echo
274          fi
275        fi
276        if test "x$SENDCMD" != x ; then
277            #echo " run: $SENDCMD -s MITgcm-test -m 3555000  ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESS"
278            tar -cf  ${SAVDIR}/${DRESULTS}".tar" $DRESULTS > /dev/null 2>&1 \
279                && gzip  ${SAVDIR}/${DRESULTS}".tar" \
280                && $SENDCMD -s MITgcm-test -m 3555000  ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESS
281          out=$?          out=$?
282          if test "x$out" != x0 ; then          if test "x$out" != x0 ; then
283              echo              echo
# Line 274  if test "x$ADDRESS" != xNONE -a "x$ADDRE Line 291  if test "x$ADDRESS" != xNONE -a "x$ADDRE
291              echo "  \"$ADDRESS\""              echo "  \"$ADDRESS\""
292              echo              echo
293          fi          fi
294          test -f $DRESULTS".tar"  &&  rm -f $DRESULTS".tar"          test -f ${SAVDIR}/${DRESULTS}".tar" &&  rm -f ${SAVDIR}/${DRESULTS}".tar"
295          test -f $DRESULTS".tar.gz"  &&  rm -f $DRESULTS".tar.gz"          test -f ${SAVDIR}/${DRESULTS}".tar.gz" &&  rm -f ${SAVDIR}/${DRESULTS}".tar.gz"
     else  
         echo "Warning: $MPACK is not executable => no email was sent"  
         echo  
296      fi      fi
297  fi  fi
298    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.22