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

Diff of /trunk/bin/run-escript

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

trunk/bin/escript revision 2458 by jfenwick, Wed Jun 3 06:18:21 2009 UTC trunk/bin/run-escript revision 3178 by caltinay, Tue Sep 14 00:31:59 2010 UTC
# Line 6  Line 6 
6  #Extra paths can be configured about a page further down  #Extra paths can be configured about a page further down
7  #Search for EXTRA_PATH=""  #Search for EXTRA_PATH=""
8    
9  #set to 1 if performing this is a standalone build and /packages contains the relevant tools  #set to 1 if performing this is a standalone build and ../../pkg contains the relevant tools
10  STANDALONE=0  STANDALONE=0
11    
12  #set to 1 if this is part of a packaged build (.deb) and files will be installed in standard locations  #set to 1 if this is part of a packaged build (.deb) and files will be installed in standard locations
# 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 != 0 ]  if [ $STDLOCATION -ne 0 ]
30  then  then
31      ESCRIPT_ROOT=/usr/lib/escript      ESCRIPT_ROOT=/usr/lib/escript
32  else  else
# 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
48        fi        fi
49        scriptdir=`dirname $tscriptdir`        scriptdir=`dirname $tscriptdir`
50    fi    fi
# Line 58  else Line 58  else
58  fi  fi
59  ##### End finding ESCRIPT_ROOT  ########  ##### End finding ESCRIPT_ROOT  ########
60    
61    BUILDINFO_FILE=$ESCRIPT_ROOT/lib/buildvars
62    if [ ! -r $BUILDINFO_FILE ]; then
63        echo "Error! Unable to read escript build information. Exiting."
64        exit 1
65    fi
66    
67    function get_buildvar {
68        echo `grep $1 $BUILDINFO_FILE |cut -d= -f2`
69    }
70    
71  PYTHON_MPI_NULL="$ESCRIPT_ROOT/lib/pythonMPI"  PYTHON_MPI_NULL="$ESCRIPT_ROOT/lib/pythonMPI"
72  PYTHON_MPI_REDIRECT="$ESCRIPT_ROOT/lib/pythonMPIredirect"  PYTHON_MPI_REDIRECT="$ESCRIPT_ROOT/lib/pythonMPIredirect"
73  PYTHON_CMD=python  PYTHON_CMD=python
# Line 70  EXTRA_PATH=$ESCRIPT_ROOT/bin Line 80  EXTRA_PATH=$ESCRIPT_ROOT/bin
80  EXTRA_PYTHONPATH=$ESCRIPT_ROOT  EXTRA_PYTHONPATH=$ESCRIPT_ROOT
81  EXTRA_LD_LIBRARY_PATH=$ESCRIPT_ROOT/lib  EXTRA_LD_LIBRARY_PATH=$ESCRIPT_ROOT/lib
82    
83  if [ $STANDALONE == 1 ]  if [ $STANDALONE -eq 1 ]
84  then  then
85      EXTRA_PATH=$ESCRIPT_PARENT/packages/python/bin:$EXTRA_PATH      EXTRA_PATH=$ESCRIPT_PARENT/pkg/python/bin:$EXTRA_PATH
86      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/packages/boost/lib:$ESCRIPT_PARENT/packages/netcdf/lib/:$EXTRA_LD_LIBRARY_PATH      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/boost/lib:$ESCRIPT_PARENT/pkg/netcdf/lib/:$EXTRA_LD_LIBRARY_PATH
87      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/packages/vtk/lib/vtk-5.2:$ESCRIPT_PARENT/packages/mesa/lib:$EXTRA_LD_LIBRARY_PATH      EXTRA_LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH
88      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/packages/python/lib:$EXTRA_LD_LIBRARY_PATH      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/python/lib:$EXTRA_LD_LIBRARY_PATH
89      EXTRA_PYTHONPATH=$ESCRIPT_PARENT/packages/numpy/lib:$ESCRIPT_PARENT/packages/vtk/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
90  fi  fi
91    
92    #
93    #   Add VisIt paths if required
94    #
95    WITH_VISIT=`get_buildvar usevisit`
96    if [ "$WITH_VISIT" = "y" ]; then
97        VISIT_BIN=`which visit`
98        if [ $? -eq 0 ]; then
99            VISIT_PY_PATH=`$VISIT_BIN -env | grep LIBPATH | cut -d= -f2`
100            EXTRA_PYTHONPATH=$EXTRA_PYTHONPATH:$VISIT_PY_PATH
101            EXTRA_LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$VISIT_PY_PATH
102        elif [ ! -z $ESCRIPT_VERBOSE ]; then
103            echo "VisIt module enabled but VisIt not in path!"
104        fi
105    fi
106    
107  HELP_TEXT="  HELP_TEXT="
108  Usage: escript [options] script.py [arguments...]  Usage: escript [options] script.py [arguments...]
# Line 126  do Line 149  do
149        "c")  cat $ESCRIPT_ROOT/lib/buildvars        "c")  cat $ESCRIPT_ROOT/lib/buildvars
150          exit 0          exit 0
151          ;;          ;;
152        "V")  echo "escript-pre2.0(build "`grep svn_revision $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`")"        "V")  echo "escript-development(build "`get_buildvar svn_revision`")"
153          exit 0          exit 0
154          ;;          ;;
155        "h")  echo "$HELPTEXT"        "h")  echo "$HELPTEXT"
# Line 137  do Line 160  do
160        "e")  echo "export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH"        "e")  echo "export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH"
161          echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"          echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"
162          echo "export PATH=$EXTRA_PATH:\$PATH"          echo "export PATH=$EXTRA_PATH:\$PATH"
163          if [ `uname` == Darwin ]          if [ "`uname`" = "Darwin" ]
164          then          then
165              echo "export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:\$DYLD_LIBRARY_PATH"              echo "export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:\$DYLD_LIBRARY_PATH"
166          fi          fi
# Line 158  done Line 181  done
181  shift `expr $OPTIND - 1`  shift `expr $OPTIND - 1`
182  #==============================================  #==============================================
183  #  #
184  #   Read the MPI_FLAVOUR from the buildvars  #   Read MPI_FLAVOUR and WITH_OPENMP from the buildvars
185  #  #
186  MPI_FLAVOUR=`grep mpi_flavour $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`  MPI_FLAVOUR=`get_buildvar mpi_flavour`
187  WITH_OPENMP=`grep useopenmp $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`  WITH_OPENMP=`get_buildvar useopenmp`
188    
189    if [ ! -z $ESCRIPT_VERBOSE ]; then
190        echo "MPI flavour is $MPI_FLAVOUR."
191        if [ "$WITH_OPENMP" = "y" ]; then echo "OpenMP enabled."; fi
192    fi
193    
 if [ ! -z $ESCRIPT_VERBOSE  ]; then echo "MPI flavor is $MPI_FLAVOUR."; fi  
 if [ ! -z $ESCRIPT_VERBOSE ] && [  $WITH_OPENMP == "y"  ]; then echo "OpenMP enabled."; fi  
194  #  #
195  #  extend path variables  #  extend path variables
196  #  #
# Line 172  export PATH=$EXTRA_PATH:$PATH Line 198  export PATH=$EXTRA_PATH:$PATH
198  export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$LD_LIBRARY_PATH  export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$LD_LIBRARY_PATH
199  export PYTHONPATH=$EXTRA_PYTHONPATH:$PYTHONPATH  export PYTHONPATH=$EXTRA_PYTHONPATH:$PYTHONPATH
200  EXPORT_ENV="PATH,LD_LIBRARY_PATH,PYTHONPATH"  EXPORT_ENV="PATH,LD_LIBRARY_PATH,PYTHONPATH"
201  if [ `uname` == Darwin ]  if [ "`uname`" = "Darwin" ]
202  then  then
203      export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH      export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH
204      EXPORT_ENV="$EXPORT_ENV,DYLD_LIBRARY_PATH"      EXPORT_ENV="$EXPORT_ENV,DYLD_LIBRARY_PATH"
205  fi  fi
206  if [ ! -z $ESCRIPT_VERBOSE  ]  if [ ! -z $ESCRIPT_VERBOSE ]
207  then  then
208      echo "PATH = $PATH "      echo "PATH = $PATH "
209      echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH "      echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH "
# Line 188  fi Line 214  fi
214  #  #
215  #  Ensure the variables have sensible values  #  Ensure the variables have sensible values
216  #  #
217  if [ $MPI_FLAVOUR  == "none" ]  if [ "$MPI_FLAVOUR" = "none" ]
218  then  then
219      if [ ! -z $ESCRIPT_NUM_NODES ]      if [ ! -z $ESCRIPT_NUM_NODES ]
220      then      then
# Line 205  then Line 231  then
231      ESCRIPT_NUM_NODES=1      ESCRIPT_NUM_NODES=1
232      ESCRIPT_NUM_PROCS=1      ESCRIPT_NUM_PROCS=1
233  else  else
234        # use the PBS_NODEFILE if not otherwise specified
235        if [[ ( ! -z $PBS_NODEFILE ) && ( -z $ESCRIPT_HOSTFILE ) ]]
236        then
237            ESCRIPT_HOSTFILE=$PBS_NODEFILE
238        fi
239    
240      if [ ! -z $ESCRIPT_HOSTFILE ]      if [ ! -z $ESCRIPT_HOSTFILE ]
241      then      then
242          if [ -f $ESCRIPT_HOSTFILE ]          if [ -f $ESCRIPT_HOSTFILE ]
# Line 231  else Line 263  else
263    
264      if [ -z $ESCRIPT_NUM_NODES ]      if [ -z $ESCRIPT_NUM_NODES ]
265      then      then
266        ESCRIPT_NUM_NODES=1          ESCRIPT_NUM_NODES=1
267      fi      fi
268    
269      if [ -z $ESCRIPT_NUM_PROCS ]      if [ -z $ESCRIPT_NUM_PROCS ]
270      then      then
271        ESCRIPT_NUM_PROCS=1          ESCRIPT_NUM_PROCS=1
272      fi      fi
273    
274      if [ ! -z $ESCRIPT_VERBOSE  ]      if [ ! -z $ESCRIPT_VERBOSE ]
275      then      then
276            echo "ESCRIPT_NUM_NODES = $ESCRIPT_NUM_NODES "          echo "ESCRIPT_NUM_NODES = $ESCRIPT_NUM_NODES "
277            echo "ESCRIPT_NUM_PROCS = $ESCRIPT_NUM_PROCS "          echo "ESCRIPT_NUM_PROCS = $ESCRIPT_NUM_PROCS "
278      fi      fi
279  fi  fi
280    
281  if [  $WITH_OPENMP == "y"  ]  if [ "$WITH_OPENMP" = "y" ]
282  then  then
283     if [ -z $ESCRIPT_NUM_THREADS ]     if [ -z $ESCRIPT_NUM_THREADS ]
284     then     then
# Line 273  fi Line 305  fi
305  (( TOTPROC=$ESCRIPT_NUM_NODES * $ESCRIPT_NUM_PROCS))  (( TOTPROC=$ESCRIPT_NUM_NODES * $ESCRIPT_NUM_PROCS))
306  if [ $? -ne 0 ]     #Some compute error  if [ $? -ne 0 ]     #Some compute error
307  then            #This could happen if the args were not a number  then            #This could happen if the args were not a number
308    echo "expression of total number of processors = $ESCRIPT_NUM_NODES * $ESCRIPT_NUM_PROCS is not numerical."      echo "expression of total number of processors = $ESCRIPT_NUM_NODES * $ESCRIPT_NUM_PROCS is not numerical."
309    exit 1      exit 1
310  fi  fi
311    
312  #  #
# Line 282  fi Line 314  fi
314  #  #
315  if [[ ( ( ! -z $DOINTERACTIVE ) || ( $# -eq 0 ) ) && ( $TOTPROC -gt 1) ]]  if [[ ( ( ! -z $DOINTERACTIVE ) || ( $# -eq 0 ) ) && ( $TOTPROC -gt 1) ]]
316  then  then
317    echo "Interactive mode cannot be used with more than one process"      echo "Interactive mode cannot be used with more than one process"
318    exit 1      exit 1
319  fi  fi
320    
321  if [ $TOTPROC -gt 1 ]  if [ $TOTPROC -gt 1 ]
322  then  then
323     if [ "$ESCRIPT_CREATESTDFILES" == "yes" ]      if [ "$ESCRIPT_CREATESTDFILES" = "yes" ]
324     then      then
325         PYTHON_MPI=$PYTHON_MPI_REDIRECT          PYTHON_MPI=$PYTHON_MPI_REDIRECT
326     else      else
327         PYTHON_MPI=$PYTHON_MPI_NULL          PYTHON_MPI=$PYTHON_MPI_NULL
328     fi      fi
329  else  else
330      PYTHON_MPI=$PYTHON_MPI_NULL      PYTHON_MPI=$PYTHON_MPI_NULL
331  fi  fi
# Line 301  fi Line 333  fi
333  # Must have at least one command-line arg: the python script  # Must have at least one command-line arg: the python script
334  if [ $# -eq 0 ]  if [ $# -eq 0 ]
335  then  then
336    if [ ! -z $DOBINARY ]      if [ ! -z $DOBINARY ]
337    then      then
338      echo "No program to run was specified. Exiting."          echo "No program to run was specified. Exiting."
339      exit 1          exit 1
340    fi      else
341            DOINTERACTIVE="yes"
342        fi
343  fi  fi
344    
345  #=========================================================================================================  #=========================================================================================================
# Line 313  if [ ! -z $DOBINARY ] Line 347  if [ ! -z $DOBINARY ]
347  then  then
348      EXEC_CMD="$@"      EXEC_CMD="$@"
349  else  else
350      if [ $MPI_FLAVOUR  == "none" ]      # Check to see if the python version we were compiled with matches the
351        # one of PYTHON_CMD.
352        compversion=`get_buildvar python`
353        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" ]
355      then      then
356          # Check to see if the python version we were compiled with matches the one of EXEC_CMD          echo "Python versions do not match. Escript was compiled for "$compversion"."
357          # We should only do this check if they are running a python script          echo "Current version of Python appears to be "$intversion"."
358          if [ -f $ESCRIPT_ROOT/lib/pyversion ]          exit 1
359          then      fi
360             compversion=`cat $ESCRIPT_ROOT/lib/pyversion`      if [ "$MPI_FLAVOUR" = "none" ]
361             intversion=`$PYTHON_CMD -V 2>&1`      then
362             if [ "$compversion" != "$intversion" ]          if [ ! -z $DOINTERACTIVE ]
            then  
               echo "Python versions do not match. Escript was compiled for "$compversion"."  
               echo "Current version of Python appears to be "$intversion"."  
               exit 1  
            fi  
         fi  
     if [ ! -z $DOINTERACTIVE ]  
363          then          then
364             EXEC_CMD="$PYTHON_CMD -i $@"             EXEC_CMD="$PYTHON_CMD -i $@"
365          else          else
366             EXEC_CMD="$PYTHON_CMD $@"             EXEC_CMD="$PYTHON_CMD $@"
367          fi          fi
368      else      else
369          EXEC_CMD="$PYTHON_MPI $@"          if [ ! -z $DOINTERACTIVE ]
370            then
371               EXEC_CMD="$PYTHON_MPI -i $@"
372            else
373               EXEC_CMD="$PYTHON_MPI $@"
374            fi
375      fi      fi
376  fi  fi
377  if [ ! -z $ESCRIPT_VERBOSE ]; then echo "Command to be executed is \"$EXEC_CMD\"."; fi  if [ ! -z $ESCRIPT_VERBOSE ]; then echo "Command to be executed is \"$EXEC_CMD\"."; fi
# Line 343  if [ ! -z $ESCRIPT_VERBOSE ]; then echo Line 379  if [ ! -z $ESCRIPT_VERBOSE ]; then echo
379  #  #
380  #   now we start to spwan things:  #   now we start to spwan things:
381  #  #
382  if [  $WITH_OPENMP == "y"  ]  if [ "$WITH_OPENMP" = "y" ]
383  then  then
384     export OMP_NUM_THREADS=$ESCRIPT_NUM_THREADS     export OMP_NUM_THREADS=$ESCRIPT_NUM_THREADS
385     EXPORT_ENV="$EXPORT_ENV,OMP_NUM_THREADS"     EXPORT_ENV="$EXPORT_ENV,OMP_NUM_THREADS"
386  fi  fi
387  EXIT_CODE=1  EXIT_CODE=1
388  #=============== no MPI ===================================  #=============== no MPI ===================================
389  if [ $MPI_FLAVOUR  == "none" ]  if [ "$MPI_FLAVOUR" = "none" ]
390  then  then
391     $EXEC_CMD     $EXEC_CMD
392     EXIT_CODE=$?     EXIT_CODE=$?
393  #=============== OpenMPI ===================================  #=============== OpenMPI ===================================
394  elif [ $MPI_FLAVOUR == "OPENMPI" ]  elif [ "$MPI_FLAVOUR" = "OPENMPI" ]
395  then  then
396     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
397     then     then
398        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`
399        CMD="mpirun  --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"
400     else     else
401        CMD="mpirun -np $TOTPROC $EXEC_CMD"        CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } -np $TOTPROC $EXEC_CMD"
402     fi     fi
403     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
404     $CMD     $CMD
405     EXIT_CODE=$?     EXIT_CODE=$?
406    
407  #=============== Intel MPI ===================================  #=============== Intel MPI ===================================
408  elif [ $MPI_FLAVOUR == "INTELMPI" ]  elif [ "$MPI_FLAVOUR" = "INTELMPI" ]
409  then  then
410    
411       if [ "$WITH_OPENMP" = "y" ]
412       then
413           export I_MPI_PIN_DOMAIN=omp
414           EXPORT_ENV="$EXPORT_ENV, I_MPI_PIN_DOMAIN"
415       fi
416    
417     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
418     then     then
419        mpdboot -n $ESCRIPT_NUM_NODES -r ssh -f $HOSTFILE        mpdboot -n $ESCRIPT_NUM_NODES -r ssh -f $HOSTFILE
# Line 381  then Line 424  then
424        else        else
425            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
426        fi        fi
427       else
428          mpdboot -n 1 -r ssh
429          if [ $? -ne 0 ]
430          then
431             echo "mpdboot failed."
432             exit 1
433          else
434              if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
435          fi
436     fi     fi
437     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"
438     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
439     $CMD     $CMD
440     EXIT_CODE=$?     EXIT_CODE=$?
441     if [ ! -z $HOSTFILE ]     mpdallexit
442     then     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
        mpdallexit  
        if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi  
    fi  
443  #=============== SGI's MPIMPT ===================================  #=============== SGI's MPIMPT ===================================
444  elif [ $MPI_FLAVOUR == "MPT" ]  elif [ "$MPI_FLAVOUR" = "MPT" ]
445  then  then
446     export MPI_NUM_MEMORY_REGIONS=0     export MPI_NUM_MEMORY_REGIONS=0
447     EXPORT_ENV="$EXPORT_ENV,MPI_NUM_MEMORY_REGIONS"     EXPORT_ENV="$EXPORT_ENV,MPI_NUM_MEMORY_REGIONS"
448     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
449     then     then
450        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`
451        CMD="mpirun $HOST_LIST $ESCRIPT_NUM_PROCS $EXEC_CMD"        CMD="mpirun $HOST_LIST -np $ESCRIPT_NUM_PROCS $EXEC_CMD"
452     else     else
453        CMD="mpirun -np $TOTPROC $EXEC_CMD"        CMD="mpirun -np $TOTPROC $EXEC_CMD"
454     fi     fi
# Line 407  then Line 456  then
456     $CMD     $CMD
457     EXIT_CODE=$?     EXIT_CODE=$?
458  #=============== MPICH ===================================  #=============== MPICH ===================================
459  elif [ $MPI_FLAVOUR == "MPICH" ]  elif [ "$MPI_FLAVOUR" = "MPICH" ]
460  then  then
461     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
462     then     then
# Line 421  then Line 470  then
470     $CMD     $CMD
471     EXIT_CODE=$?     EXIT_CODE=$?
472  #=============== MPICH2 ===================================  #=============== MPICH2 ===================================
473  elif [ $MPI_FLAVOUR == "MPICH2" ]  elif [ "$MPI_FLAVOUR" = "MPICH2" ]
474  then  then
475     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
476     then     then
# Line 433  then Line 482  then
482           else           else
483               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
484           fi           fi
485       else
486          mpdboot -n 1 -r ssh
487          if [ $? -ne 0 ]
488          then
489             echo "mpdboot failed."
490             exit 1
491          else
492              if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
493          fi
494     fi     fi
495     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"
496     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
497     $CMD     $CMD
498     EXIT_CODE=$?     EXIT_CODE=$?
499     if [ ! -z $HOSTFILE ]     mpdallexit
500     then     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
        mpdallexit  
        if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi  
    fi  
501  else  else
502     echo "unknown MPI falvour $MPI_FLAVOUR."     echo "unknown MPI flavour '$MPI_FLAVOUR'."
503  fi  fi
504  exit $EXIT_CODE  exit $EXIT_CODE

Legend:
Removed from v.2458  
changed lines
  Added in v.3178

  ViewVC Help
Powered by ViewVC 1.1.26