/[escript]/trunk/scripts/finley_wrapper_template
ViewVC logotype

Diff of /trunk/scripts/finley_wrapper_template

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

revision 2356 by gross, Wed Apr 1 04:46:22 2009 UTC revision 2357 by gross, Wed Apr 1 06:01:56 2009 UTC
# Line 15  scriptdir="" Line 15  scriptdir=""
15  CURDIR=`pwd`  CURDIR=`pwd`
16    
17  #Environment vars which control operations:  #Environment vars which control operations:
18  # ESCRIPT_NUM_NODES, ESCRIPT_NUM_PROC, ESCRIPT_NUM_THREADS, ESCRIPT_HOSTFILE, ESCRIPT_CREATESTDFILES  # ESCRIPT_NUM_NODES, ESCRIPT_NUM_PROCS, ESCRIPT_NUM_THREADS, ESCRIPT_HOSTFILE, ESCRIPT_CREATESTDFILES
19    
20  HOSTFILE=/tmp/escript.$$  HOSTFILE=/tmp/escript.$$
21    
# Line 103  do Line 103  do
103          ;;          ;;
104        "n")  ESCRIPT_NUM_NODES=$OPTARG        "n")  ESCRIPT_NUM_NODES=$OPTARG
105          ;;          ;;
106        "p")  ESCRIPT_NUM_PROC=$OPTARG        "p")  ESCRIPT_NUM_PROCS=$OPTARG
107          ;;          ;;
108        "t")  ESCRIPT_NUM_THREADS=$OPTARG        "t")  ESCRIPT_NUM_THREADS=$OPTARG
109          ;;          ;;
# Line 179  then Line 179  then
179      echo "PYTHONPATH = $PYTHONPATH "      echo "PYTHONPATH = $PYTHONPATH "
180      if [ ! -z $DYLD_LIBRARY_PATH ]; then echo "DYLD_LIBRARY_PATH = $DYLD_LIBRARY_PATH "; fi      if [ ! -z $DYLD_LIBRARY_PATH ]; then echo "DYLD_LIBRARY_PATH = $DYLD_LIBRARY_PATH "; fi
181  fi  fi
182    set -x
183  #==============================================  #==============================================
184  #  #
185  #  Ensure the variables have sensible values  #  Ensure the variables have sensible values
# Line 205  else Line 206  else
206          if [ -f $ESCRIPT_HOSTFILE ]          if [ -f $ESCRIPT_HOSTFILE ]
207          then          then
208              cat $ESCRIPT_HOSTFILE | sort -u > $HOSTFILE              cat $ESCRIPT_HOSTFILE | sort -u > $HOSTFILE
209              NUM_HOSTS = `wc -l $HOSTFILE`              NUM_HOSTS=`cat $HOSTFILE | wc -l`
210              if [ ! -z $ESCRIPT_NUM_NODES ]              if [ ! -z $ESCRIPT_NUM_NODES ]
211              then              then
212                  if [ $NUM_HOSTS -ne $ESCRIPT_NUM_NODES ]                  if [ $NUM_HOSTS -ne $ESCRIPT_NUM_NODES ]
# Line 214  else Line 215  else
215                      exit 1                      exit 1
216                  fi                  fi
217               else               else
218                  ESCRIPT_NUM_NODES = $NUM_HOSTS                  ESCRIPT_NUM_NODES=$NUM_HOSTS
219               fi               fi
220          else          else
221             echo "cannot find hostfile $ESCRIPT_HOSTFILE."             echo "cannot find hostfile $ESCRIPT_HOSTFILE."
# Line 267  fi Line 268  fi
268  #  #
269  # Test to ensure people aren't trying to combine interactive and multi-process  # Test to ensure people aren't trying to combine interactive and multi-process
270  #  #
271  if [[ ( ( -z $DOINTERACTIVE ) || ( $# -eq 0 ) ) && ( $TOTPROC -gt 1) ]]  if [[ ( ( ! -z $DOINTERACTIVE ) || ( $# -eq 0 ) ) && ( $TOTPROC -gt 1) ]]
272  then  then
273    echo "Interactive mode cannot be used with more than one process"    echo "Interactive mode cannot be used with more than one process"
274    exit 1    exit 1
# Line 310  else Line 311  else
311             EXEC_CMD="$PYTHON_CMD $@"             EXEC_CMD="$PYTHON_CMD $@"
312          fi          fi
313      else      else
314          EXEC_CMD="$PYTHONMPI $@"          EXEC_CMD="$PYTHON_MPI $@"
315      fi      fi
316  fi  fi
317  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 335  then Line 336  then
336     echo "OPENMPI not implemented yet."     echo "OPENMPI not implemented yet."
337    
338  #=============== Intel MPI ===================================  #=============== Intel MPI ===================================
339  elif [ $MPI_FLAVOR == "INTELMPI" ]  elif [ $MPI_FLAVOUR == "INTELMPI" ]
340  then  then
341     if [ -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
342     then     then
343        mpdboot -n $ESCRIPT_NUM_PROCS -r ssh -f $HOSTFILE        mpdboot -n $ESCRIPT_NUM_PROCS -r ssh -f $HOSTFILE
344        if [ $? -ne 0 ]        if [ $? -ne 0 ]
# Line 351  then Line 352  then
352     $CMD="mpiexec -n $ESCRIPT_NUM_PROCS -perhost $ESCRIPT_NUM_PROCS -envall -$EXEC_CMD"     $CMD="mpiexec -n $ESCRIPT_NUM_PROCS -perhost $ESCRIPT_NUM_PROCS -envall -$EXEC_CMD"
353     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is $CMD."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is $CMD."; fi
354     $CMD     $CMD
355     if [ -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
356     then     then
357         mpdallexit         mpdallexit
358         if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi         if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
359     fi     fi
360  #=============== SGI's MPIMPT ===================================  #=============== SGI's MPIMPT ===================================
361  elif [ $MPI_FLAVOR == "MPT" ]  elif [ $MPI_FLAVOUR == "MPT" ]
362  then  then
363     export MPI_NUM_MEMORY_REGIONS=0     export MPI_NUM_MEMORY_REGIONS=0
364     EXPORT_ENV="$EXPORT_ENV, MPI_NUM_MEMORY_REGIONS"     EXPORT_ENV="$EXPORT_ENV, MPI_NUM_MEMORY_REGIONS"
365     if [ -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
366     then     then
367        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`
368        CMD="mpiexec $HOST_LIST $ESCRIPT_NUM_PROCS $EXEC_CMD"        CMD="mpirun $HOST_LIST $ESCRIPT_NUM_PROCS $EXEC_CMD"
369     else     else
370        CMD="mpiexec -np $TOTPROC -$EXEC_CMD"        CMD="mpirun -np $TOTPROC $EXEC_CMD"
371     fi     fi
372     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is $CMD."; fi     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is $CMD."; fi
373     $CMD     $CMD
374  #=============== SGI's MPICH ===================================  #=============== SGI's MPICH ===================================
375  elif [ $MPI_FLAVOR == "MPICH" ]  elif [ $MPI_FLAVOUR == "MPICH" ]
376  then  then
377     echo "MPICH not implemented yet."     echo "MPICH not implemented yet."
378  else  else
379     echo "unknown MPI falvour $MPI_FLAVOR."     echo "unknown MPI falvour $MPI_FLAVOUR."
380     exit 1     exit 1
381  fi  fi
382  exit 0  exit 0

Legend:
Removed from v.2356  
changed lines
  Added in v.2357

  ViewVC Help
Powered by ViewVC 1.1.26