/[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 3096 by caltinay, Thu Aug 19 01:40:52 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 41  else Line 41  else
41    else    else
42        # name does not contain / therefore we are using        # name does not contain / therefore we are using
43        tscriptdir=`which $0`        tscriptdir=`which $0`
44        if [ $? != 0 ]        if [ $? -ne 0 ]
45        then        then
46            echo "Error! Unable to determine script directory. Exiting."            echo "Error! Unable to determine script directory. Exiting."
47            exit 1            exit 1
# Line 84  then Line 84  then
84      EXTRA_PYTHONPATH=$ESCRIPT_PARENT/pkg/numpy/lib/python2.6/site-packages:$ESCRIPT_PARENT/pkg/matplotlib/lib/python2.6/site-packages:$EXTRA_PYTHONPATH      EXTRA_PYTHONPATH=$ESCRIPT_PARENT/pkg/numpy/lib/python2.6/site-packages:$ESCRIPT_PARENT/pkg/matplotlib/lib/python2.6/site-packages:$EXTRA_PYTHONPATH
85  fi  fi
86    
87    #
88    #   Add VisIt paths if required
89    #
90    WITH_VISIT=`grep usevisit $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`
91    if [ "$WITH_VISIT" = "y" ]; then
92        VISIT_BIN=`which visit`
93        if [ $? -eq 0 ]; then
94            VISIT_PY_PATH=`$VISIT_BIN -env | grep LIBPATH | cut -d= -f2`
95            EXTRA_PYTHONPATH=$EXTRA_PYTHONPATH:$VISIT_PY_PATH
96            EXTRA_LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$VISIT_PY_PATH
97        elif [ ! -z $ESCRIPT_VERBOSE ]; then
98            echo "VisIt module enabled but VisIt not in path!"
99        fi
100    fi
101    
102  HELP_TEXT="  HELP_TEXT="
103  Usage: escript [options] script.py [arguments...]  Usage: escript [options] script.py [arguments...]
# Line 131  do Line 144  do
144        "c")  cat $ESCRIPT_ROOT/lib/buildvars        "c")  cat $ESCRIPT_ROOT/lib/buildvars
145          exit 0          exit 0
146          ;;          ;;
147        "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`")"
148          exit 0          exit 0
149          ;;          ;;
150        "h")  echo "$HELPTEXT"        "h")  echo "$HELPTEXT"
# Line 213  then Line 226  then
226      ESCRIPT_NUM_NODES=1      ESCRIPT_NUM_NODES=1
227      ESCRIPT_NUM_PROCS=1      ESCRIPT_NUM_PROCS=1
228  else  else
229        # use the PBS_NODEFILE if not otherwise specified
230        if [[ ( ! -z $PBS_NODEFILE ) && ( -z $ESCRIPT_HOSTFILE ) ]]
231        then
232        ESCRIPT_HOSTFILE=$PBS_NODEFILE
233    
234        fi
235    
236      if [ ! -z $ESCRIPT_HOSTFILE ]      if [ ! -z $ESCRIPT_HOSTFILE ]
237      then      then
238          if [ -f $ESCRIPT_HOSTFILE ]          if [ -f $ESCRIPT_HOSTFILE ]
# Line 315  then Line 335  then
335      exit 1      exit 1
336    fi    fi
337  fi  fi
338    if [ -z "$@" ]
339    then
340       if [ ! -z $DOBINARY ]
341       then
342           echo "Program must be given."
343           exit 1
344       else
345          DOINTERACTIVE="yes"
346       fi
347    fi
348    
349  #=========================================================================================================  #=========================================================================================================
350  if [ ! -z $DOBINARY ]  if [ ! -z $DOBINARY ]
# Line 373  then Line 403  then
403     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
404     then     then
405        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`
406        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"
407     else     else
408        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"
409     fi     fi
410     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
411     $CMD     $CMD
# Line 401  then Line 431  then
431        else        else
432            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
433        fi        fi
434       else
435          mpdboot -n 1 -r ssh
436          if [ $? -ne 0 ]
437          then
438             echo "mpdboot failed."
439             exit 1
440          else
441              if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
442          fi
443     fi     fi
444     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"
445     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
446     $CMD     $CMD
447     EXIT_CODE=$?     EXIT_CODE=$?
448     if [ ! -z $HOSTFILE ]     mpdallexit
449     then     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
        mpdallexit  
        if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi  
    fi  
450  #=============== SGI's MPIMPT ===================================  #=============== SGI's MPIMPT ===================================
451  elif [ "$MPI_FLAVOUR" = "MPT" ]  elif [ "$MPI_FLAVOUR" = "MPT" ]
452  then  then
# Line 419  then Line 455  then
455     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
456     then     then
457        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`
458        CMD="mpirun $HOST_LIST $ESCRIPT_NUM_PROCS $EXEC_CMD"        CMD="mpirun $HOST_LIST -np $ESCRIPT_NUM_PROCS $EXEC_CMD"
459     else     else
460        CMD="mpirun -np $TOTPROC $EXEC_CMD"        CMD="mpirun -np $TOTPROC $EXEC_CMD"
461     fi     fi
# Line 453  then Line 489  then
489           else           else
490               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
491           fi           fi
492       else
493          mpdboot -n 1 -r ssh
494          if [ $? -ne 0 ]
495          then
496             echo "mpdboot failed."
497             exit 1
498          else
499              if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
500          fi
501     fi     fi
502     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"
503     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
504     $CMD     $CMD
505     EXIT_CODE=$?     EXIT_CODE=$?
506     if [ ! -z $HOSTFILE ]     mpdallexit
507     then     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
        mpdallexit  
        if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi  
    fi  
508  else  else
509     echo "unknown MPI flavour '$MPI_FLAVOUR'."     echo "unknown MPI flavour '$MPI_FLAVOUR'."
510  fi  fi

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

  ViewVC Help
Powered by ViewVC 1.1.26