/[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 2298 by jfenwick, Sun Mar 8 23:45:29 2009 UTC revision 2299 by jfenwick, Wed Mar 11 03:14:41 2009 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/bash
2    
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
# 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
10    STANDALONE=0
11    
12  #Now we find the location of this script  #Now we find the location of this script
13  #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 32  fi Line 34  fi
34    
35  cd $scriptdir/..  cd $scriptdir/..
36  ESCRIPT_ROOT=`pwd`  ESCRIPT_ROOT=`pwd`
37    cd ..
38    ESCRIPT_PARENT=`pwd`
39  cd $CURDIR  cd $CURDIR
40    
41  ##### End finding ESCRIPT_ROOT  ########  ##### End finding ESCRIPT_ROOT  ########
# Line 44  EXTRA_LD_LIBRARY_PATH="" Line 48  EXTRA_LD_LIBRARY_PATH=""
48  EXTRA_DYLD_LIBRARY_PATH=""  EXTRA_DYLD_LIBRARY_PATH=""
49  EXTRA_PYTHONPATH=""  EXTRA_PYTHONPATH=""
50    
51    if [ $STANDALONE == 1 ]
52    then
53        EXTRA_PATH=$ESCRIPT_PARENT/packages/python-2.6.1/bin:$EXTRA_PATH
54        EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/packages/boost_1_37_0/lib:$ESCRIPT_PARENT/packages/netcdf-4.0/lib/:$EXTRA_LD_LIBRARY_PATH
55        EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/packages/vtk-5.2.1/lib/vtk-5.2:$ESCRIPT_PARENT/packages/Mesa-7.2/lib:$EXTRA_LD_LIBRARY_PATH
56        EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/packages/python-2.6.1/lib:$EXTRA_LD_LIBRARY_PATH
57        EXTRA_PYTHONPATH=$ESCRIPT_PARENT/packages/numarray-1.5.2/lib:$ESCRIPT_PARENT/packages/vtk-5.2.1/lib/python2.6/site-packages:$EXTRA_PYTHONPATH
58    fi
59    
60  # For stand-alone builds this will need to be changed  # For stand-alone builds this will need to be changed
61  PYTHON_CMD=python  PYTHON_CMD=python
62    
# Line 68  if [ "$1" = "--help" ]; then Line 81  if [ "$1" = "--help" ]; then
81    exit 0    exit 0
82  fi  fi
83    
84  # Check to see if the python version we were compiled with matches the one of PYTHON_CMD  
 if [ -f $ESCRIPT_ROOT/lib/pyversion ]  
 then  
    compversion=`cat $ESCRIPT_ROOT/lib/pyversion`  
    intversion=`python --version 2>&1`  
    if [ "$compversion" != "$intversion" ]  
    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  
85    
86  # Avoid bug in hybrid runs with MPT MPI  # Avoid bug in hybrid runs with MPT MPI
87  export MPI_NUM_MEMORY_REGIONS=0  export MPI_NUM_MEMORY_REGIONS=0
# Line 101  MPI_NUM_PROCS=1 Line 103  MPI_NUM_PROCS=1
103  while getopts 'L:P:O:M:l:e' option  while getopts 'L:P:O:M:l:e' option
104  do  do
105      case "$option" in      case "$option" in
106        "L")  export LD_LIBRARY_PATH="$OPTARG:$LD_LIBRARY_PATH"        "L")  EXTRA_LD_LIBRARY_PATH="$OPTARG:$EXTRA_LD_LIBRARY_PATH"
107          ;;          ;;
108        "P")  export PYTHONPATH="$OPTARG:$PYTHONPATH"        "P")  EXTRA_PYTHONPATH="$OPTARG:$EXTRA_PYTHONPATH"
109          ;;          ;;
110        "O")  OMP_NUM_THREADS="$OPTARG"        "O")  OMP_NUM_THREADS="$OPTARG"
111          ;;          ;;
# Line 135  then Line 137  then
137      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
138  fi  fi
139    
140    # Check to see if the python version we were compiled with matches the one of PYTHON_CMD
141    if [ -f $ESCRIPT_ROOT/lib/pyversion ]
142    then
143       compversion=`cat $ESCRIPT_ROOT/lib/pyversion`
144       intversion=`python --version 2>&1`
145       if [ "$compversion" != "$intversion" ]
146       then
147          echo "Python versions do not match. Escript was compiled for "$compversion"."
148          echo "Current version of Python appears to be "$intversion"."
149          exit 1
150       fi
151    fi
152    
153  # Must have at least one command-line arg: the python script  # Must have at least one command-line arg: the python script
154  if [ $# -eq 0 ]; then  if [ $# -eq 0 ]; then

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

  ViewVC Help
Powered by ViewVC 1.1.26