/[escript]/trunk/run-escript.in
ViewVC logotype

Diff of /trunk/run-escript.in

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

revision 4078 by jfenwick, Fri Nov 16 07:50:49 2012 UTC revision 4362 by caltinay, Tue Apr 16 04:37:13 2013 UTC
# Line 87  then Line 87  then
87  fi  fi
88    
89    
90  BUILDINFO_FILE=$ESCRIPT_ROOT/lib/buildvars  BUILDINFO_FILE="$ESCRIPT_ROOT/lib/buildvars"
91  if [ "$STDLOCATION" = "1" ]  if [ "$STDLOCATION" = "1" ]
92  then  then
93      BUILDINFO_FILE=/usr/lib/escript/buildvars      BUILDINFO_FILE=/usr/lib/escript/buildvars
94  fi  fi
95  if [ ! -r $BUILDINFO_FILE ]; then  if [ ! -r "$BUILDINFO_FILE" ]; then
96      if [ "$1" = "-e" ]; then      if [ "$1" = "-e" ]; then
97          echo "export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH"          echo "export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH"
98          echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"          echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"
# Line 108  if [ ! -r $BUILDINFO_FILE ]; then Line 108  if [ ! -r $BUILDINFO_FILE ]; then
108  fi  fi
109    
110  get_buildvar () {  get_buildvar () {
111      echo `grep "^$1=" $BUILDINFO_FILE |cut -d= -f2`      echo `grep "^$1=" "$BUILDINFO_FILE" |cut -d= -f2`
112  }  }
113    
114  #  #
# Line 165  do Line 165  do
165          ;;          ;;
166        "f")  ESCRIPT_HOSTFILE=$OPTARG        "f")  ESCRIPT_HOSTFILE=$OPTARG
167          ;;          ;;
168        "c")  cat $BUILDINFO_FILE        "c")  cat "$BUILDINFO_FILE"
169          exit 0          exit 0
170          ;;          ;;
171        "V")  echo "escript-development(build "`get_buildvar svn_revision`")"        "V")  echo "escript-development(build "`get_buildvar svn_revision`")"
# Line 242  then Line 242  then
242      then      then
243          echo "Warning: MPI disabled but number of processors per node set. Option ignored."          echo "Warning: MPI disabled but number of processors per node set. Option ignored."
244      fi      fi
245      if [ ! -z $ESCRIPT_HOSTFILE ]      if [ ! -z "$ESCRIPT_HOSTFILE" ]
246      then      then
247          echo "Warning: MPI disabled but host file is given. Option ignored."          echo "Warning: MPI disabled but host file is given. Option ignored."
248      fi      fi
# Line 250  then Line 250  then
250      ESCRIPT_NUM_PROCS=1      ESCRIPT_NUM_PROCS=1
251  else  else
252      # use the PBS_NODEFILE if not otherwise specified      # use the PBS_NODEFILE if not otherwise specified
253      if [ ! -z $PBS_NODEFILE ] && [ -z $ESCRIPT_HOSTFILE ]      if [ ! -z "$PBS_NODEFILE" ] && [ -z "$ESCRIPT_HOSTFILE" ]
254      then      then
255          ESCRIPT_HOSTFILE=$PBS_NODEFILE          ESCRIPT_HOSTFILE=$PBS_NODEFILE
256      fi      fi
257    
258      if [ ! -z $ESCRIPT_HOSTFILE ]      if [ ! -z "$ESCRIPT_HOSTFILE" ]
259      then      then
260          if [ -f $ESCRIPT_HOSTFILE ]          if [ -f "$ESCRIPT_HOSTFILE" ]
261          then          then
262              cat $ESCRIPT_HOSTFILE | sort -u > $HOSTFILE              cat "$ESCRIPT_HOSTFILE" | sort -u > $HOSTFILE
263              NUM_HOSTS=`cat $HOSTFILE | wc -l`              NUM_HOSTS=`cat "$HOSTFILE" | wc -l`
264              if [ ! -z $ESCRIPT_NUM_NODES ]              if [ ! -z $ESCRIPT_NUM_NODES ]
265              then              then
266                  if [ $NUM_HOSTS -ne $ESCRIPT_NUM_NODES ]                  if [ $NUM_HOSTS -ne $ESCRIPT_NUM_NODES ]
# Line 338  fi Line 338  fi
338    
339  if [ $TOTPROC -gt 1 ]  if [ $TOTPROC -gt 1 ]
340  then  then
341      if [ "$ESCRIPT_CREATESTDFILES" = "yes" ]      if [ "$ESCRIPT_CREATESTDFILES" = "y" ]
342      then      then
343          PYTHON_MPI=$PYTHON_MPI_REDIRECT          PYTHON_MPI=$PYTHON_MPI_REDIRECT
344      else      else
# Line 427  then Line 427  then
427  #=============== OpenMPI ===================================  #=============== OpenMPI ===================================
428  elif [ "$MPI_FLAVOUR" = "OPENMPI" ]  elif [ "$MPI_FLAVOUR" = "OPENMPI" ]
429  then  then
430     if [ ! -z $HOSTFILE ]     if [ ! -z "$HOSTFILE" ]
431     then     then
432        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"`
433        CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } --bynode -np $TOTPROC --bind-to-socket --cpus-per-rank $ESCRIPT_NUM_THREADS --host $HOST_LIST $EXEC_CMD"        CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } --bynode -np $TOTPROC --bind-to-socket --cpus-per-rank $ESCRIPT_NUM_THREADS --host $HOST_LIST $EXEC_CMD"
434     else     else
435        CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } --cpus-per-rank $ESCRIPT_NUM_THREADS -np $TOTPROC $EXEC_CMD"        CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } --cpus-per-rank $ESCRIPT_NUM_THREADS -np $TOTPROC $EXEC_CMD"
# Line 448  then Line 448  then
448         EXPORT_ENV="$EXPORT_ENV, I_MPI_PIN_DOMAIN"         EXPORT_ENV="$EXPORT_ENV, I_MPI_PIN_DOMAIN"
449     fi     fi
450    
451     if [ ! -z $HOSTFILE ]     if [ ! -z "$HOSTFILE" ]
452     then     then
453        mpdboot -n $ESCRIPT_NUM_NODES -r ssh -f $HOSTFILE        mpdboot -n $ESCRIPT_NUM_NODES -r ssh -f "$HOSTFILE"
454        if [ $? -ne 0 ]        if [ $? -ne 0 ]
455        then        then
456           echo "mpdboot with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes failed."           echo "mpdboot with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes failed."
# Line 479  elif [ "$MPI_FLAVOUR" = "MPT" ] Line 479  elif [ "$MPI_FLAVOUR" = "MPT" ]
479  then  then
480     export MPI_NUM_MEMORY_REGIONS=0     export MPI_NUM_MEMORY_REGIONS=0
481     EXPORT_ENV="$EXPORT_ENV,MPI_NUM_MEMORY_REGIONS"     EXPORT_ENV="$EXPORT_ENV,MPI_NUM_MEMORY_REGIONS"
482     if [ ! -z $HOSTFILE ]     if [ ! -z "$HOSTFILE" ]
483     then     then
484        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"`
485        CMD="mpirun $HOST_LIST -np $ESCRIPT_NUM_PROCS $EXEC_CMD"        CMD="mpirun $HOST_LIST -np $ESCRIPT_NUM_PROCS $EXEC_CMD"
486     else     else
487        CMD="mpirun -np $TOTPROC $EXEC_CMD"        CMD="mpirun -np $TOTPROC $EXEC_CMD"
# Line 492  then Line 492  then
492  #=============== MPICH ===================================  #=============== MPICH ===================================
493  elif [ "$MPI_FLAVOUR" = "MPICH" ]  elif [ "$MPI_FLAVOUR" = "MPICH" ]
494  then  then
495     if [ ! -z $HOSTFILE ]     if [ ! -z "$HOSTFILE" ]
496     then     then
497        touch $HOSTFILE2        touch "$HOSTFILE2"
498        for (( i=1;i<=$ESCRIPT_NUM_PROCS;i+=1 )) ; do cat $HOSTFILE >> $HOSTFILE2  ; done        for (( i=1;i<=$ESCRIPT_NUM_PROCS;i+=1 )) ; do cat "$HOSTFILE" >> "$HOSTFILE2"  ; done
499        CMD="mpirun -machinefile $HOSTFILE2  -np $TOTPROC $EXEC_CMD"        CMD="mpirun -machinefile \"$HOSTFILE2\"  -np $TOTPROC $EXEC_CMD"
500     else     else
501        CMD="mpirun -np $TOTPROC $EXEC_CMD"        CMD="mpirun -np $TOTPROC $EXEC_CMD"
502     fi     fi
# Line 506  then Line 506  then
506  #=============== MPICH2 ===================================  #=============== MPICH2 ===================================
507  elif [ "$MPI_FLAVOUR" = "MPICH2" ]  elif [ "$MPI_FLAVOUR" = "MPICH2" ]
508  then  then
509     if [ ! -z $HOSTFILE ]     if [ ! -z "$HOSTFILE" ]
510     then     then
511           mpdboot -n $ESCRIPT_NUM_NODES -r ssh -f $HOSTFILE           mpdboot -n $ESCRIPT_NUM_NODES -r ssh -f "$HOSTFILE"
512           if [ $? -ne 0 ]           if [ $? -ne 0 ]
513           then           then
514              echo "mpdboot with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes failed."              echo "mpdboot with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes failed."

Legend:
Removed from v.4078  
changed lines
  Added in v.4362

  ViewVC Help
Powered by ViewVC 1.1.26