-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
160 lines (131 loc) · 4.25 KB
/
install.sh
File metadata and controls
160 lines (131 loc) · 4.25 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#! /bin/bash
BASE_DIR=`pwd`
TEMP_DIR=/tmp
LOGFILE=$BASE_DIR/pyop2_install.log
if [ -f $LOGFILE ]; then
mv $LOGFILE $LOGFILE.old
fi
echo "PyOP2 installation started at `date`" | tee -a $LOGFILE
echo " on `uname -a`" | tee -a $LOGFILE
echo | tee -a $LOGFILE
if (( EUID != 0 )); then
echo "*** Unprivileged installation ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
PIP="pip install --user"
PREFIX=$HOME/.local
PATH=$PREFIX/bin:$PATH
else
echo "*** Privileged installation ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
PIP="pip install"
PREFIX=/usr/local
fi
echo "*** Preparing system ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
if (( EUID != 0 )); then
echo "PyOP2 requires the following packages to be installed:
build-essential python-dev bzr git-core mercurial
cmake cmake-curses-gui python-pip swig
libopenmpi-dev openmpi-bin libblas-dev liblapack-dev gfortran"
else
apt-get update >> $LOGFILE 2>&1
apt-get install -y build-essential python-dev bzr git-core mercurial \
cmake cmake-curses-gui python-pip swig \
libopenmpi-dev openmpi-bin libblas-dev liblapack-dev gfortran >> $LOGFILE 2>&1
fi
echo "*** Installing OP2-Common ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
if [ -d OP2-Common/.git ]; then
(
cd OP2-Common
git checkout master >> $LOGFILE 2>&1
git pull origin master >> $LOGFILE 2>&1
)
else
git clone git://github.com/OP2/OP2-Common.git >> $LOGFILE 2>&1
fi
cd OP2-Common/op2/c
./cmake.local -DOP2_WITH_CUDA=0 -DOP2_WITH_HDF5=0 -DOP2_WITH_MPI=0 -DOP2_WITH_OPENMP=0 >> $LOGFILE 2>&1
cd ..
export OP2_DIR=`pwd`
cd $BASE_DIR
echo "*** Installing dependencies ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
${PIP} Cython decorator instant numpy pyyaml >> $LOGFILE 2>&1
PETSC_CONFIGURE_OPTIONS="--with-fortran --with-fortran-interfaces --with-c++-support --with-openmp" \
${PIP} hg+https://bitbucket.org/ggorman/petsc-3.3-omp#egg=petsc-3.3 >> $LOGFILE 2>&1
${PIP} hg+https://bitbucket.org/mapdes/petsc4py#egg=petsc4py >> $LOGFILE 2>&1
echo "*** Installing FEniCS dependencies ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
${PIP} \
git+https://bitbucket.org/mapdes/ffc@pyop2#egg=ffc \
bzr+http://bazaar.launchpad.net/~florian-rathgeber/ufc/python-setup#egg=ufc_utils \
git+https://bitbucket.org/fenics-project/ufl#egg=ufl \
git+https://bitbucket.org/fenics-project/fiat#egg=fiat \
hg+https://bitbucket.org/khinsen/scientificpython >> $LOGFILE 2>&1
echo "*** Installing PyOP2 ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
cd $BASE_DIR
if [ -d PyOP2/.git ]; then
(
cd PyOP2
git checkout master >> $LOGFILE 2>&1
git pull origin master >> $LOGFILE 2>&1
)
else
git clone git://github.com/OP2/PyOP2.git >> $LOGFILE 2>&1
fi
cd PyOP2
make ext >> $LOGFILE 2>&1
export PYOP2_DIR=`pwd`
export PYTHONPATH=`pwd`:$PYTHONPATH
if [ ! -f .env ]; then
cat > .env <<EOF
export PYOP2_DIR=${PYOP2_DIR}
export OP2_DIR=${OP2_DIR}
export PYTHONPATH=`pwd`:\$PYTHONPATH
EOF
fi
python -c 'from pyop2 import op2'
if [ $? != 0 ]; then
echo "PyOP2 installation failed" 1>&2
echo " See ${LOGFILE} for details" 1>&2
exit 1
fi
echo "
Congratulations! PyOP2 installed successfully!
To use PyOP2, make sure the following environment variables are set:
export PYOP2_DIR=${PYOP2_DIR}
export OP2_DIR=${OP2_DIR}
export PYTHONPATH=`pwd`:\$PYTHONPATH
or source the '.env' script with '. ${PYOP2_DIR}/.env'
"
echo "*** Installing PyOP2 testing dependencies ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
${PIP} pytest >> $LOGFILE 2>&1
if (( EUID != 0 )); then
echo "PyOP2 tests require the following packages to be installed:"
echo " gmsh unzip"
else
apt-get install -y gmsh unzip >> $LOGFILE 2>&1
fi
if [ ! `which triangle` ]; then
mkdir -p $TMPDIR/triangle
cd $TMPDIR/triangle
wget -q http://www.netlib.org/voronoi/triangle.zip >> $LOGFILE 2>&1
unzip triangle.zip >> $LOGFILE 2>&1
make triangle >> $LOGFILE 2>&1
cp triangle $PREFIX/bin
fi
echo "*** Testing PyOP2 ***" | tee -a $LOGFILE
echo | tee -a $LOGFILE
cd $PYOP2_DIR
make test BACKENDS="sequential openmp mpi_sequential" >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
echo "PyOP2 testing failed" 1>&2
echo " See ${LOGFILE} for details" 1>&2
exit 1
fi
echo "Congratulations! PyOP2 tests finished successfully!"
echo | tee -a $LOGFILE
echo "PyOP2 installation finished at `date`" | tee -a $LOGFILE