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

Diff of /trunk/bin/run-escript

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

revision 2530 by jfenwick, Thu Jul 9 06:08:44 2009 UTC revision 2806 by caltinay, Fri Dec 4 06:46:13 2009 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 26  HOSTFILE=/tmp/escript.$$ Line 26  HOSTFILE=/tmp/escript.$$
26  HOSTFILE2=/tmp/escript2.$$  HOSTFILE2=/tmp/escript2.$$
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 43  else Line 43  else
43        tscriptdir=`which $0`        tscriptdir=`which $0`
44        if [ $? != 0 ]        if [ $? != 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    if [ ! -r $ESCRIPT_ROOT/lib/buildvars ]; then
62        echo "Error! Unable to read escript build information. Exiting."
63        exit 1
64    fi
65    
66  PYTHON_MPI_NULL="$ESCRIPT_ROOT/lib/pythonMPI"  PYTHON_MPI_NULL="$ESCRIPT_ROOT/lib/pythonMPI"
67  PYTHON_MPI_REDIRECT="$ESCRIPT_ROOT/lib/pythonMPIredirect"  PYTHON_MPI_REDIRECT="$ESCRIPT_ROOT/lib/pythonMPIredirect"
68  PYTHON_CMD=python  PYTHON_CMD=python
# Line 70  EXTRA_PATH=$ESCRIPT_ROOT/bin Line 75  EXTRA_PATH=$ESCRIPT_ROOT/bin
75  EXTRA_PYTHONPATH=$ESCRIPT_ROOT  EXTRA_PYTHONPATH=$ESCRIPT_ROOT
76  EXTRA_LD_LIBRARY_PATH=$ESCRIPT_ROOT/lib  EXTRA_LD_LIBRARY_PATH=$ESCRIPT_ROOT/lib
77    
78  if [ $STANDALONE == 1 ]  if [ $STANDALONE -eq 1 ]
79  then  then
80      EXTRA_PATH=$ESCRIPT_PARENT/pkg/python/bin:$EXTRA_PATH      EXTRA_PATH=$ESCRIPT_PARENT/pkg/python/bin:$EXTRA_PATH
81      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/boost/lib:$ESCRIPT_PARENT/pkg/netcdf/lib/:$EXTRA_LD_LIBRARY_PATH      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/boost/lib:$ESCRIPT_PARENT/pkg/netcdf/lib/:$EXTRA_LD_LIBRARY_PATH
82      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/vtk/lib/vtk-5.2:$ESCRIPT_PARENT/pkg/mesa/lib:$EXTRA_LD_LIBRARY_PATH      EXTRA_LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH
83      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/python/lib:$EXTRA_LD_LIBRARY_PATH      EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/python/lib:$EXTRA_LD_LIBRARY_PATH
84      EXTRA_PYTHONPATH=$ESCRIPT_PARENT/pkg/numpy/lib/python2.6/site-packages:$ESCRIPT_PARENT/pkg/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
85  fi  fi
86    
87    
# Line 126  do Line 131  do
131        "c")  cat $ESCRIPT_ROOT/lib/buildvars        "c")  cat $ESCRIPT_ROOT/lib/buildvars
132          exit 0          exit 0
133          ;;          ;;
134        "V")  echo "escript-pre2.0(build "`grep svn_revision $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`")"        "V")  echo "escript-pre4.0(build "`grep svn_revision $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`")"
135          exit 0          exit 0
136          ;;          ;;
137        "h")  echo "$HELPTEXT"        "h")  echo "$HELPTEXT"
# Line 137  do Line 142  do
142        "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"
143          echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"          echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"
144          echo "export PATH=$EXTRA_PATH:\$PATH"          echo "export PATH=$EXTRA_PATH:\$PATH"
145          if [ `uname` == Darwin ]          if [ "`uname`" = "Darwin" ]
146          then          then
147              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"
148          fi          fi
# Line 163  shift `expr $OPTIND - 1` Line 168  shift `expr $OPTIND - 1`
168  MPI_FLAVOUR=`grep mpi_flavour $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`  MPI_FLAVOUR=`grep mpi_flavour $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`
169  WITH_OPENMP=`grep useopenmp $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`  WITH_OPENMP=`grep useopenmp $ESCRIPT_ROOT/lib/buildvars |cut -d= -f2`
170    
171  if [ ! -z $ESCRIPT_VERBOSE  ]; then echo "MPI flavor is $MPI_FLAVOUR."; fi  if [ ! -z $ESCRIPT_VERBOSE ]; then
172  if [ ! -z $ESCRIPT_VERBOSE ] && [  $WITH_OPENMP == "y"  ]; then echo "OpenMP enabled."; fi      echo "MPI flavour is $MPI_FLAVOUR."
173        if [ "$WITH_OPENMP" = "y" ]; then echo "OpenMP enabled."; fi
174    fi
175    
176  #  #
177  #  extend path variables  #  extend path variables
178  #  #
# Line 172  export PATH=$EXTRA_PATH:$PATH Line 180  export PATH=$EXTRA_PATH:$PATH
180  export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$LD_LIBRARY_PATH  export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$LD_LIBRARY_PATH
181  export PYTHONPATH=$EXTRA_PYTHONPATH:$PYTHONPATH  export PYTHONPATH=$EXTRA_PYTHONPATH:$PYTHONPATH
182  EXPORT_ENV="PATH,LD_LIBRARY_PATH,PYTHONPATH"  EXPORT_ENV="PATH,LD_LIBRARY_PATH,PYTHONPATH"
183  if [ `uname` == Darwin ]  if [ "`uname`" = "Darwin" ]
184  then  then
185      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
186      EXPORT_ENV="$EXPORT_ENV,DYLD_LIBRARY_PATH"      EXPORT_ENV="$EXPORT_ENV,DYLD_LIBRARY_PATH"
187  fi  fi
188  if [ ! -z $ESCRIPT_VERBOSE  ]  if [ ! -z $ESCRIPT_VERBOSE ]
189  then  then
190      echo "PATH = $PATH "      echo "PATH = $PATH "
191      echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH "      echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH "
# Line 188  fi Line 196  fi
196  #  #
197  #  Ensure the variables have sensible values  #  Ensure the variables have sensible values
198  #  #
199  if [ $MPI_FLAVOUR  == "none" ]  if [ "$MPI_FLAVOUR" = "none" ]
200  then  then
201      if [ ! -z $ESCRIPT_NUM_NODES ]      if [ ! -z $ESCRIPT_NUM_NODES ]
202      then      then
# Line 239  else Line 247  else
247        ESCRIPT_NUM_PROCS=1        ESCRIPT_NUM_PROCS=1
248      fi      fi
249    
250      if [ ! -z $ESCRIPT_VERBOSE  ]      if [ ! -z $ESCRIPT_VERBOSE ]
251      then      then
252            echo "ESCRIPT_NUM_NODES = $ESCRIPT_NUM_NODES "            echo "ESCRIPT_NUM_NODES = $ESCRIPT_NUM_NODES "
253            echo "ESCRIPT_NUM_PROCS = $ESCRIPT_NUM_PROCS "            echo "ESCRIPT_NUM_PROCS = $ESCRIPT_NUM_PROCS "
254      fi      fi
255  fi  fi
256    
257  if [  $WITH_OPENMP == "y"  ]  if [ "$WITH_OPENMP" = "y" ]
258  then  then
259     if [ -z $ESCRIPT_NUM_THREADS ]     if [ -z $ESCRIPT_NUM_THREADS ]
260     then     then
# Line 288  fi Line 296  fi
296    
297  if [ $TOTPROC -gt 1 ]  if [ $TOTPROC -gt 1 ]
298  then  then
299     if [ "$ESCRIPT_CREATESTDFILES" == "yes" ]     if [ "$ESCRIPT_CREATESTDFILES" = "yes" ]
300     then     then
301         PYTHON_MPI=$PYTHON_MPI_REDIRECT         PYTHON_MPI=$PYTHON_MPI_REDIRECT
302     else     else
# Line 313  if [ ! -z $DOBINARY ] Line 321  if [ ! -z $DOBINARY ]
321  then  then
322      EXEC_CMD="$@"      EXEC_CMD="$@"
323  else  else
324      if [ $MPI_FLAVOUR  == "none" ]      if [ "$MPI_FLAVOUR" = "none" ]
325      then      then
326          # Check to see if the python version we were compiled with matches the one of EXEC_CMD          # Check to see if the python version we were compiled with matches the one of EXEC_CMD
327          # We should only do this check if they are running a python script          # We should only do this check if they are running a python script
# Line 343  if [ ! -z $ESCRIPT_VERBOSE ]; then echo Line 351  if [ ! -z $ESCRIPT_VERBOSE ]; then echo
351  #  #
352  #   now we start to spwan things:  #   now we start to spwan things:
353  #  #
354  if [  $WITH_OPENMP == "y"  ]  if [ "$WITH_OPENMP" = "y" ]
355  then  then
356     export OMP_NUM_THREADS=$ESCRIPT_NUM_THREADS     export OMP_NUM_THREADS=$ESCRIPT_NUM_THREADS
357     EXPORT_ENV="$EXPORT_ENV,OMP_NUM_THREADS"     EXPORT_ENV="$EXPORT_ENV,OMP_NUM_THREADS"
358  fi  fi
359  EXIT_CODE=1  EXIT_CODE=1
360  #=============== no MPI ===================================  #=============== no MPI ===================================
361  if [ $MPI_FLAVOUR  == "none" ]  if [ "$MPI_FLAVOUR" = "none" ]
362  then  then
363     $EXEC_CMD     $EXEC_CMD
364     EXIT_CODE=$?     EXIT_CODE=$?
365  #=============== OpenMPI ===================================  #=============== OpenMPI ===================================
366  elif [ $MPI_FLAVOUR == "OPENMPI" ]  elif [ "$MPI_FLAVOUR" = "OPENMPI" ]
367  then  then
368     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
369     then     then
# Line 369  then Line 377  then
377     EXIT_CODE=$?     EXIT_CODE=$?
378    
379  #=============== Intel MPI ===================================  #=============== Intel MPI ===================================
380  elif [ $MPI_FLAVOUR == "INTELMPI" ]  elif [ "$MPI_FLAVOUR" = "INTELMPI" ]
381  then  then
382    
383     if [  $WITH_OPENMP == "y"  ]     if [ "$WITH_OPENMP" = "y" ]
384     then     then
385         export I_MPI_PIN_DOMAIN=omp         export I_MPI_PIN_DOMAIN=omp
386         EXPORT_ENV="$EXPORT_ENV, I_MPI_PIN_DOMAIN"         EXPORT_ENV="$EXPORT_ENV, I_MPI_PIN_DOMAIN"
# Line 399  then Line 407  then
407         if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi         if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
408     fi     fi
409  #=============== SGI's MPIMPT ===================================  #=============== SGI's MPIMPT ===================================
410  elif [ $MPI_FLAVOUR == "MPT" ]  elif [ "$MPI_FLAVOUR" = "MPT" ]
411  then  then
412     export MPI_NUM_MEMORY_REGIONS=0     export MPI_NUM_MEMORY_REGIONS=0
413     EXPORT_ENV="$EXPORT_ENV,MPI_NUM_MEMORY_REGIONS"     EXPORT_ENV="$EXPORT_ENV,MPI_NUM_MEMORY_REGIONS"
# Line 414  then Line 422  then
422     $CMD     $CMD
423     EXIT_CODE=$?     EXIT_CODE=$?
424  #=============== MPICH ===================================  #=============== MPICH ===================================
425  elif [ $MPI_FLAVOUR == "MPICH" ]  elif [ "$MPI_FLAVOUR" = "MPICH" ]
426  then  then
427     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
428     then     then
# Line 428  then Line 436  then
436     $CMD     $CMD
437     EXIT_CODE=$?     EXIT_CODE=$?
438  #=============== MPICH2 ===================================  #=============== MPICH2 ===================================
439  elif [ $MPI_FLAVOUR == "MPICH2" ]  elif [ "$MPI_FLAVOUR" = "MPICH2" ]
440  then  then
441     if [ ! -z $HOSTFILE ]     if [ ! -z $HOSTFILE ]
442     then     then
# Line 451  then Line 459  then
459         if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi         if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
460     fi     fi
461  else  else
462     echo "unknown MPI falvour $MPI_FLAVOUR."     echo "unknown MPI flavour '$MPI_FLAVOUR'."
463  fi  fi
464  exit $EXIT_CODE  exit $EXIT_CODE

Legend:
Removed from v.2530  
changed lines
  Added in v.2806

  ViewVC Help
Powered by ViewVC 1.1.26