/[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 2297 by jfenwick, Fri Mar 6 04:46:14 2009 UTC revision 2298 by jfenwick, Sun Mar 8 23:45:29 2009 UTC
# Line 3  Line 3 
3  # Escript/Finley wrapper for python  # Escript/Finley wrapper for python
4  # Sets LD_LIBRARY_PATH and PYTHONPATH and then runs either python or the MPI launcher  # Sets LD_LIBRARY_PATH and PYTHONPATH and then runs either python or the MPI launcher
5    
6    #Extra paths can be configured about a page further down
7    #Search for EXTRA_PATH=""
8    
 EXTRAPATH=""  
 EXTRALDLIBRARYPATH=""  
 EXTRADYLDLIBRARYPATH=""  
 EXTRAPYTHONPATH=""  
   
 #@@SET_ADDITIONAL_REQUIRED_VARS_HERE@@  
   
   
 HELP_TEXT="  
 Usage: escript [options] script.py [arguments...]  
     -O N        Use N OpenMP threads (OMP_NUM_THREADS=N)  
     -M K        Use K MPI processes  
     -l 'launcher'   MPI launcher, usually -l 'mpirun -np' or -l 'mpiexec -n'  
     -L /path    Prepend /path to library search path  
     -P /path    Prepend /path to python module search path  
     -e      Print export statements for environment and exit  
     script.py   Your python script  
     arguments...    The optional command-line arguments to your python script  
 "  
   
 if [ "$1" = "--help" ]; then  
   echo "$HELP_TEXT"  
   exit 0  
 fi  
9    
10  #Now we find the location of this script  #Now we find the location of this script
11  #Note that this location should be absolute but does not need to be unique  #Note that this location should be absolute but does not need to be unique
# Line 56  cd $scriptdir/.. Line 34  cd $scriptdir/..
34  ESCRIPT_ROOT=`pwd`  ESCRIPT_ROOT=`pwd`
35  cd $CURDIR  cd $CURDIR
36    
37  # PYTHON_CMD="@@PYTHON_CMD@@"  ##### End finding ESCRIPT_ROOT  ########
38    
39    # if possible please express paths relative to $ESCRIPT_ROOT unless
40    # they are in an unrelated location
41    
42    EXTRA_PATH=""
43    EXTRA_LD_LIBRARY_PATH=""
44    EXTRA_DYLD_LIBRARY_PATH=""
45    EXTRA_PYTHONPATH=""
46    
47  # For stand-alone builds this will need to be changed  # For stand-alone builds this will need to be changed
48  PYTHON_CMD=python  PYTHON_CMD=python
49    
50    EXTRA_PYTHONPATH=$ESCRIPT_ROOT:$EXTRA_PYTHONPATH
51    EXTRA_LD_LIBRARY_PATH=$ESCRIPT_ROOT/lib:$EXTRA_LD_LIBRARY_PATH
52    
53    
54    HELP_TEXT="
55    Usage: escript [options] script.py [arguments...]
56        -O N        Use N OpenMP threads (OMP_NUM_THREADS=N)
57        -M K        Use K MPI processes
58        -l 'launcher'   MPI launcher, usually -l 'mpirun -np' or -l 'mpiexec -n'
59        -L /path    Prepend /path to library search path
60        -P /path    Prepend /path to python module search path
61        -e      Print export statements for environment and exit
62        script.py   Your python script
63        arguments...    The optional command-line arguments to your python script
64    "
65    
66    if [ "$1" = "--help" ]; then
67      echo "$HELP_TEXT"
68      exit 0
69    fi
70    
71  # Check to see if the python version we were compiled with matches the one of PYTHON_CMD  # Check to see if the python version we were compiled with matches the one of PYTHON_CMD
72  if [ -f $ESCRIPT_ROOT/lib/pyversion ]  if [ -f $ESCRIPT_ROOT/lib/pyversion ]
73  then  then
# Line 73  then Line 81  then
81     fi     fi
82  fi  fi
83    
 #ESCRIPT_ROOT="@@ESCRIPT_ROOT@@"  
   
 export PATH="@@PATH@@"  
   
 export LD_LIBRARY_PATH="@@LD_LIBRARY_PATH@@"  
   
 if [ `uname` == Darwin ]  
 then  
     export DYLD_LIBRARY_PATH="@@LD_LIBRARY_PATH@@"  
 fi  
   
 export PYTHONPATH="@@PYTHONPATH@@"  
   
84  # Avoid bug in hybrid runs with MPT MPI  # Avoid bug in hybrid runs with MPT MPI
85  export MPI_NUM_MEMORY_REGIONS=0  export MPI_NUM_MEMORY_REGIONS=0
86    
# Line 116  do Line 111  do
111          ;;          ;;
112        "l")  mpi_launcher="$OPTARG"        "l")  mpi_launcher="$OPTARG"
113          ;;          ;;
114        "e")  echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"        "e")  echo "export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH"
115          echo "export PYTHONPATH=$PYTHONPATH"          echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"
116          echo "export PATH=$PATH"          echo "export PATH=$EXTRA_PATH:\$PATH"
117          if [ `uname` == Darwin ]          if [ `uname` == Darwin ]
118          then          then
119              echo "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH"              echo "export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:\$DYLD_LIBRARY_PATH"
120          fi          fi
121          exit 0          exit 0
122          ;;          ;;
# Line 132  do Line 127  do
127  done  done
128  shift `expr $OPTIND - 1`  shift `expr $OPTIND - 1`
129    
130    export PATH=$EXTRA_PATH:$PATH
131    export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$LD_LIBRARY_PATH
132    export PYTHONPATH=$EXTRA_PYTHONPATH:$PYTHONPATH
133    if [ `uname` == Darwin ]
134    then
135        export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH
136    fi
137    
138    
139    
140  # Must have at least one command-line arg: the python script  # Must have at least one command-line arg: the python script
141  if [ $# -eq 0 ]; then  if [ $# -eq 0 ]; then
142    echo "No python script specified. Starting python interpreter."    echo "No python script specified. Starting python interpreter."

Legend:
Removed from v.2297  
changed lines
  Added in v.2298

  ViewVC Help
Powered by ViewVC 1.1.26