/[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 2867 by gross, Fri Jan 22 06:28:02 2010 UTC trunk/bin/run-escript revision 3162 by jfenwick, Tue Sep 7 05:29:32 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
 if [ -z $@ ]  
 then  
    if [ ! -z $DOBINARY ]  
    then  
        echo "Program must be given."  
        exit 1  
    else  
       DOINTERACTIVE="yes"  
    fi  
 fi  
340    
341  #=========================================================================================================  #=========================================================================================================
342  if [ ! -z $DOBINARY ]  if [ ! -z $DOBINARY ]
# Line 338  else Line 350  else
350          if [ -f $ESCRIPT_ROOT/lib/pyversion ]          if [ -f $ESCRIPT_ROOT/lib/pyversion ]
351          then          then
352             compversion=`cat $ESCRIPT_ROOT/lib/pyversion`             compversion=`cat $ESCRIPT_ROOT/lib/pyversion`
353             intversion=`$PYTHON_CMD -V 2>&1`         intversion=`$PYTHON_CMD -c 'import sys;print "%d.%d.%d"%(sys.version_info[0], sys.version_info[1], sys.version_info[2])'`
354             if [ "$compversion" != "$intversion" ]             if [ "$compversion" != "$intversion" ]
355             then             then
356                echo "Python versions do not match. Escript was compiled for "$compversion"."                echo "Python versions do not match. Escript was compiled for "$compversion"."
# Line 383  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

Legend:
Removed from v.2867  
changed lines
  Added in v.3162

  ViewVC Help
Powered by ViewVC 1.1.26