/[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 3113 by caltinay, Fri Aug 27 04:04:56 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 313  then Line 333  then
333    then    then
334      echo "No program to run was specified. Exiting."      echo "No program to run was specified. Exiting."
335      exit 1      exit 1
336      else
337        DOINTERACTIVE="yes"
338    fi    fi
339  fi  fi
340    
# Line 373  then Line 395  then
395     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
396     then     then
397        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`
398        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"
399     else     else
400        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"
401     fi     fi
402     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
403     $CMD     $CMD
# Line 401  then Line 423  then
423        else        else
424            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
425        fi        fi
426       else
427          mpdboot -n 1 -r ssh
428          if [ $? -ne 0 ]
429          then
430             echo "mpdboot failed."
431             exit 1
432          else
433              if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
434          fi
435     fi     fi
436     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"
437     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
438     $CMD     $CMD
439     EXIT_CODE=$?     EXIT_CODE=$?
440     if [ ! -z $HOSTFILE ]     mpdallexit
441     then     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
        mpdallexit  
        if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi  
    fi  
442  #=============== SGI's MPIMPT ===================================  #=============== SGI's MPIMPT ===================================
443  elif [ "$MPI_FLAVOUR" = "MPT" ]  elif [ "$MPI_FLAVOUR" = "MPT" ]
444  then  then
# Line 419  then Line 447  then
447     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
448     then     then
449        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`
450        CMD="mpirun $HOST_LIST $ESCRIPT_NUM_PROCS $EXEC_CMD"        CMD="mpirun $HOST_LIST -np $ESCRIPT_NUM_PROCS $EXEC_CMD"
451     else     else
452        CMD="mpirun -np $TOTPROC $EXEC_CMD"        CMD="mpirun -np $TOTPROC $EXEC_CMD"
453     fi     fi
# Line 453  then Line 481  then
481           else           else
482               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
483           fi           fi
484       else
485          mpdboot -n 1 -r ssh
486          if [ $? -ne 0 ]
487          then
488             echo "mpdboot failed."
489             exit 1
490          else
491              if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
492          fi
493     fi     fi
494     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"
495     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
496     $CMD     $CMD
497     EXIT_CODE=$?     EXIT_CODE=$?
498     if [ ! -z $HOSTFILE ]     mpdallexit
499     then     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
        mpdallexit  
        if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi  
    fi  
500  else  else
501     echo "unknown MPI flavour '$MPI_FLAVOUR'."     echo "unknown MPI flavour '$MPI_FLAVOUR'."
502  fi  fi

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

  ViewVC Help
Powered by ViewVC 1.1.26