/[escript]/trunk/bin/run-escript
ViewVC logotype

Diff of /trunk/bin/run-escript

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

revision 4491 by caltinay, Tue Jul 2 01:10:41 2013 UTC revision 4664 by caltinay, Mon Feb 10 01:57:11 2014 UTC
# Line 140  Usage: run-escript [options] script.py [ Line 140  Usage: run-escript [options] script.py [
140      -o      redirect output from MPI to files      -o      redirect output from MPI to files
141      -v      print diagnostics      -v      print diagnostics
142      -x      run in new xterm instance      -x      run in new xterm instance
143      -m      run with valgrind memcheck      -m tool     run with valgrind {tool=m[emcheck]/c[allgrind]}
144      script.py   Your python script      script.py   Your python script
145      arguments...    The optional command-line arguments to your script      arguments...    The optional command-line arguments to your script
146  "  "
# Line 152  fi Line 152  fi
152  #==============================================================================  #==============================================================================
153    
154  # Parse the command-line options  # Parse the command-line options
155  while getopts 'bn:p:t:f:echimoVvx' option  while getopts 'bn:p:t:f:echim:oVvx' option
156  do  do
157      case "$option" in      case "$option" in
158        "b")  DO_BINARY=y        "b")  DO_BINARY=y
159          ;;          ;;
160        "m")  DO_VALGRIND=y        "m")  DO_VALGRIND=$OPTARG
161          ;;          ;;
162        "n")  ESCRIPT_NUM_NODES=$OPTARG        "n")  ESCRIPT_NUM_NODES=$OPTARG
163          ;;          ;;
# Line 236  fi Line 236  fi
236  #  #
237  if [ "$MPI_FLAVOUR" = "none" ]  if [ "$MPI_FLAVOUR" = "none" ]
238  then  then
239      if [ ! -z $ESCRIPT_NUM_NODES ]      if [ ! -z "$ESCRIPT_NUM_NODES" ]; then
240      then          if [ $ESCRIPT_NUM_NODES -gt 1 ]; then
241          echo "Warning: MPI disabled but number of nodes set. Option ignored."              echo "Warning: MPI disabled but number of nodes set. Option ignored."
242            fi
243      fi      fi
244      if [ ! -z $ESCRIPT_NUM_PROCS ]      if [ ! -z "$ESCRIPT_NUM_PROCS" ]; then
245      then          if [ $ESCRIPT_NUM_PROCS -gt 1 ]; then
246          echo "Warning: MPI disabled but number of processors per node set. Option ignored."              echo "Warning: MPI disabled but number of processors per node set. Option ignored."
247            fi
248      fi      fi
249      if [ ! -z "$ESCRIPT_HOSTFILE" ]      if [ ! -z "$ESCRIPT_HOSTFILE" ]
250      then      then
# Line 375  if [ ! -z "$DO_VALGRIND" ] Line 377  if [ ! -z "$DO_VALGRIND" ]
377  then  then
378      VALGRIND_BIN=`which valgrind 2>/dev/null`      VALGRIND_BIN=`which valgrind 2>/dev/null`
379      if [ $? -eq 0 ]; then      if [ $? -eq 0 ]; then
380          LOGDIR=$ESCRIPT_ROOT/memcheck_logs          LOGDIR=$ESCRIPT_ROOT/valgrind_logs
381          [ -d $LOGDIR ] || mkdir $LOGDIR          [ -d $LOGDIR ] || mkdir $LOGDIR
382          LAST_N=`ls -1 $LOGDIR|grep "^memcheck"|tail -1|cut -d. -f2`          if [ ${DO_VALGRIND:0:1} = "c" ];
383          NEW_N=`printf "%04d" $((10#$LAST_N + 1))`          then
384          LOGFILE=${LOGDIR}/memcheck.${NEW_N}.xml              # run callgrind
385          VALGRIND="valgrind --xml=yes --show-reachable=yes --error-limit=no --gen-suppressions=all --suppressions=$ESCRIPT_ROOT/scripts/escript.supp --leak-check=full --xml-file=$LOGFILE"              LOGFILE=${LOGDIR}/callgrind.%p.xml
386          EXEC_CMD="$EXEC_CMD $VALGRIND"              VALGRIND="valgrind --tool=callgrind --callgrind-out-file=$LOGFILE"
387                EXEC_CMD="$EXEC_CMD $VALGRIND"
388            else
389                # run memcheck by default
390                LAST_N=`ls -1 $LOGDIR|grep "^memcheck"|tail -1|cut -d. -f2`
391                NEW_N=`printf "%04d" $((10#$LAST_N + 1))`
392                LOGFILE=${LOGDIR}/memcheck.${NEW_N}.xml
393                VALGRIND="valgrind --tool=memcheck --xml=yes --show-reachable=yes --error-limit=no --gen-suppressions=all --suppressions=$ESCRIPT_ROOT/scripts/escript.supp --leak-check=full --xml-file=$LOGFILE"
394                EXEC_CMD="$EXEC_CMD $VALGRIND"
395            fi
396      else      else
397          echo "Valgrind memcheck requested but valgrind not in path!"          echo "Execution with valgrind requested but valgrind not in path!"
398          exit 1          exit 1
399      fi      fi
400  fi  fi

Legend:
Removed from v.4491  
changed lines
  Added in v.4664

  ViewVC Help
Powered by ViewVC 1.1.26