/[escript]/branches/py3_attempt2/bin/run-escript
ViewVC logotype

Diff of /branches/py3_attempt2/bin/run-escript

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

trunk/bin/escript revision 2865 by gross, Fri Jan 22 03:19:32 2010 UTC trunk/bin/run-escript revision 3059 by jfenwick, Tue Jul 6 03:31:48 2010 UTC
# Line 22  CURDIR=`pwd` Line 22  CURDIR=`pwd`
22  #Environment vars which control operations:  #Environment vars which control operations:
23  # ESCRIPT_NUM_NODES, ESCRIPT_NUM_PROCS, ESCRIPT_NUM_THREADS, ESCRIPT_HOSTFILE, ESCRIPT_CREATESTDFILES  # ESCRIPT_NUM_NODES, ESCRIPT_NUM_PROCS, ESCRIPT_NUM_THREADS, ESCRIPT_HOSTFILE, ESCRIPT_CREATESTDFILES
24    
25  HOSTFILE=/tmp/escript.$$  HOSTFILE=/tmp/escript.$USER.$$
26  HOSTFILE2=/tmp/escript2.$$  HOSTFILE2=/tmp/escript2.$USER.$$
27    
28  #Begin finding ESCRIPT_ROOT  #Begin finding ESCRIPT_ROOT
29  if [ $STDLOCATION -ne 0 ]  if [ $STDLOCATION -ne 0 ]
# Line 131  do Line 131  do
131        "c")  cat $ESCRIPT_ROOT/lib/buildvars        "c")  cat $ESCRIPT_ROOT/lib/buildvars
132          exit 0          exit 0
133          ;;          ;;
134        "V")  echo "escript-pre4.0(build "`grep svn_revision $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`")"        "V")  echo "escript-development(build "`grep svn_revision $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`")"
135          exit 0          exit 0
136          ;;          ;;
137        "h")  echo "$HELPTEXT"        "h")  echo "$HELPTEXT"
# Line 213  then Line 213  then
213      ESCRIPT_NUM_NODES=1      ESCRIPT_NUM_NODES=1
214      ESCRIPT_NUM_PROCS=1      ESCRIPT_NUM_PROCS=1
215  else  else
216        # use the PBS_NODEFILE if not otherwise specified
217        if [[ ( ! -z $PBS_NODEFILE ) && ( -z $ESCRIPT_HOSTFILE ) ]]
218        then
219        ESCRIPT_HOSTFILE=$PBS_NODEFILE
220    
221        fi
222    
223      if [ ! -z $ESCRIPT_HOSTFILE ]      if [ ! -z $ESCRIPT_HOSTFILE ]
224      then      then
225          if [ -f $ESCRIPT_HOSTFILE ]          if [ -f $ESCRIPT_HOSTFILE ]
# Line 315  then Line 322  then
322      exit 1      exit 1
323    fi    fi
324  fi  fi
325    if [ -z "$@" ]
326    then
327       if [ ! -z $DOBINARY ]
328       then
329           echo "Program must be given."
330           exit 1
331       else
332          DOINTERACTIVE="yes"
333       fi
334    fi
335    
336  #=========================================================================================================  #=========================================================================================================
337  if [ ! -z $DOBINARY ]  if [ ! -z $DOBINARY ]
# Line 373  then Line 390  then
390     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
391     then     then
392        HOST_LIST=`awk 'BEGIN{S=""}{if (S == "") { S = $0 } else {S = S "," $0}}END{print S}' $HOSTFILE`        HOST_LIST=`awk 'BEGIN{S=""}{if (S == "") { S = $0 } else {S = S "," $0}}END{print S}' $HOSTFILE`
393        CMD="mpirun -x ${EXPORT_ENV//,/ -x } --bynode -np $TOTPROC --host $HOST_LIST $EXEC_CMD"        CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } --bynode -np $TOTPROC --host $HOST_LIST $EXEC_CMD"
394     else     else
395        CMD="mpirun -x ${EXPORT_ENV//,/ -x } -np $TOTPROC $EXEC_CMD"        CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } -np $TOTPROC $EXEC_CMD"
396     fi     fi
397     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
398     $CMD     $CMD
# Line 401  then Line 418  then
418        else        else
419            if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes."; fi            if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes."; fi
420        fi        fi
421       else
422          mpdboot -n 1 -r ssh
423          if [ $? -ne 0 ]
424          then
425             echo "mpdboot failed."
426             exit 1
427          else
428              if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
429          fi
430     fi     fi
431     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"
432     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
433     $CMD     $CMD
434     EXIT_CODE=$?     EXIT_CODE=$?
435     if [ ! -z $HOSTFILE ]     mpdallexit
436     then     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
        mpdallexit  
        if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi  
    fi  
437  #=============== SGI's MPIMPT ===================================  #=============== SGI's MPIMPT ===================================
438  elif [ "$MPI_FLAVOUR" = "MPT" ]  elif [ "$MPI_FLAVOUR" = "MPT" ]
439  then  then
# Line 419  then Line 442  then
442     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
443     then     then
444        HOST_LIST=`awk 'BEGIN{S=""}{if (S == "") { S = $0 } else {S = S "," $0}}END{print S}' $HOSTFILE`        HOST_LIST=`awk 'BEGIN{S=""}{if (S == "") { S = $0 } else {S = S "," $0}}END{print S}' $HOSTFILE`
445        CMD="mpirun $HOST_LIST $ESCRIPT_NUM_PROCS $EXEC_CMD"        CMD="mpirun $HOST_LIST -np $ESCRIPT_NUM_PROCS $EXEC_CMD"
446     else     else
447        CMD="mpirun -np $TOTPROC $EXEC_CMD"        CMD="mpirun -np $TOTPROC $EXEC_CMD"
448     fi     fi
# Line 453  then Line 476  then
476           else           else
477               if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes."; fi               if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes."; fi
478           fi           fi
479       else
480          mpdboot -n 1 -r ssh
481          if [ $? -ne 0 ]
482          then
483             echo "mpdboot failed."
484             exit 1
485          else
486              if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
487          fi
488     fi     fi
489     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"
490     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
491     $CMD     $CMD
492     EXIT_CODE=$?     EXIT_CODE=$?
493     if [ ! -z $HOSTFILE ]     mpdallexit
494     then     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
        mpdallexit  
        if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi  
    fi  
495  else  else
496     echo "unknown MPI flavour '$MPI_FLAVOUR'."     echo "unknown MPI flavour '$MPI_FLAVOUR'."
497  fi  fi

Legend:
Removed from v.2865  
changed lines
  Added in v.3059

  ViewVC Help
Powered by ViewVC 1.1.26