forked from PyORBIT-Collaboration/py-orbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupEnvironment.sh
44 lines (33 loc) · 1.5 KB
/
setupEnvironment.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
command_exists () {
type "$1" &> /dev/null ;
}
export ORBIT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "ORBIT installed in $ORBIT_ROOT"
export ORBIT_ARCH=`uname -s`
export PYTHON_VERSION=`python -c "from distutils import sysconfig; print sysconfig.get_config_var('VERSION');"`
echo "Python version is $PYTHON_VERSION"
PYTHON_LIB_DIR=`python -c "from distutils import sysconfig; print sysconfig.get_config_var('LIBPL');"`
if [ -f $PYTHON_LIB_DIR/libpython${PYTHON_VERSION}.a ]
then
export PYTHON_ROOT_LIB=$PYTHON_LIB_DIR/libpython${PYTHON_VERSION}.a
LIB_TYPE=static
else
export PYTHON_ROOT_LIB="-L $PYTHON_LIB_DIR -lpython${PYTHON_VERSION}"
LIB_TYPE=dynamic
fi
echo "Found python library: ${PYTHON_LIB_DIR} will use $LIB_TYPE library"
# export PYTHON_ROOT_LIB="$PYTHON_LIB_DIR/libpython${PYTHON_VERSION}.a $PYTHON_LIB_DIR/libpython${PYTHON_VERSION}.a"
export PYTHON_ROOT_INC=`python -c "from distutils import sysconfig; print sysconfig.get_config_var('INCLUDEPY');"`
echo "Found Python include directory: $PYTHON_ROOT_INC"
export PYTHONPATH=${PYTHONPATH}:${ORBIT_ROOT}/py:${ORBIT_ROOT}/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORBIT_ROOT}/lib
if command_exists mpirun ; then
echo "Found mpirun at: `which mpirun`"
MPI_RUN_DIR=`dirname $(which mpirun)`
else
MPI_RUN_DIR=`dirname $(find /usr 2>/dev/null| fgrep bin/mpirun | head -n1)`
export PATH=$PATH:$MPI_RUN_DIR
echo "Added $MPI_RUN_DIR to PATH"
fi
export MPI_CPP=$MPI_RUN_DIR/mpicxx
echo "MPI_CPP set to $MPI_CPP"