-
Notifications
You must be signed in to change notification settings - Fork 22
/
install_gridpack.sh
executable file
·105 lines (75 loc) · 3.02 KB
/
install_gridpack.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# This script installs GridPACK and python wrappter.GridPACK is built in src/build directory and installed in src/install directory.
# This script should be run from the top-level GridPACK directory.
# Flag for install GridPACK and GridPACK python wrapper
install_gridpack=true
install_gridpack_python=true
# Set your python executable here
python_exe=`which python`
if test -z ${python_exe}
then
python_exe=`which python3`
fi
if test -z ${GRIDPACK_ROOT_DIR}
then
export GRIDPACK_ROOT_DIR=${PWD}
echo "GRIDPACK_ROOT_DIR = ${GRIDPACK_ROOT_DIR}"
fi
# Create directory for installing external packages
if test -z ${GP_EXT_DEPS}
then
export GP_EXT_DEPS=${GRIDPACK_ROOT_DIR}/external-dependencies
fi
cd ${GRIDPACK_ROOT_DIR}
# Set environment variable GRIDPACK_BUILD_DIR and create a build directory
export GRIDPACK_BUILD_DIR=${GRIDPACK_ROOT_DIR}/src/build
GRIDPACK_INSTALL_DIR=${GRIDPACK_ROOT_DIR}/src/install
export GRIDPACK_DIR=${GRIDPACK_INSTALL_DIR}
if ${install_gridpack}
then
rm -rf $GRIDPACK_BUILD_DIR
mkdir $GRIDPACK_BUILD_DIR
rm -rf ${GRIDPACK_INSTALL_DIR}
cd ${GRIDPACK_BUILD_DIR}
## GridPACK installation
echo "Building GridPACK"
# git checkout develop
rm -rf CMake*
cmake_args="-D GA_DIR:STRING=${GP_EXT_DEPS}/ga-5.8/install_for_gridpack \
-D BOOST_ROOT:STRING=${GP_EXT_DEPS}/boost_1_78_0/install_for_gridpack \
-D Boost_DIR:STRING=${GP_EXT_DEPS}/boost_1_78_0/install_for_gridpack/lib/cmake/Boost-1.78.0 \
-D Boost_LIBRARIES:STRING=${GP_EXT_DEPS}/boost_1_78_0/install_for_gridpack/lib \
-D Boost_INCLUDE_DIRS:STRING=${GP_EXT_DEPS}/boost_1_78_0/install_for_gridpack/include \
-D Boost_NO_BOOST_CMAKE:BOOL=TRUE \
-D Boost_NO_SYSTEM_PATHS:BOOL=TRUE \
-D PETSC_DIR:PATH=${GP_EXT_DEPS}/petsc/install_for_gridpack \
-D MPI_CXX_COMPILER:STRING='mpicxx' \
-D MPI_C_COMPILER:STRING='mpicc' \
-D MPIEXEC:STRING='mpiexec' \
-D GRIDPACK_TEST_TIMEOUT:STRING=30 \
-D CMAKE_INSTALL_PREFIX:PATH=${GRIDPACK_INSTALL_DIR} \
-D CMAKE_BUILD_TYPE:STRING=Debug \
-D BUILD_SHARED_LIBS=YES \
-D Boost_NO_SYSTEM_PATHS:BOOL=TRUE \
.. "
cmake ${cmake_args}
echo "Installing GridPACK develop branch"
make -j 10 install
fi
if ${install_gridpack_python}
then
echo "Installing GridPACK python wrapper"
cd ${GRIDPACK_ROOT_DIR}
git submodule update --init
echo ${GRIDPACK_DIR}
cd python
export RHEL_OPENMPI_HACK=yes
rm -rf build
${python_exe} setup.py build
rm -rf ${GRIDPACK_INSTALL_DIR}/lib/python
mkdir ${GRIDPACK_INSTALL_DIR}/lib/python
PYTHONPATH="${GRIDPACK_DIR}/lib/python:${PYTHONPATH}"
export PYTHONPATH
${python_exe} setup.py install --home="$GRIDPACK_DIR"
fi
cd ${GRIDPACK_ROOT_DIR}
echo "Completed GridPACK installation"