-
Notifications
You must be signed in to change notification settings - Fork 25
/
ubuntu.sh
executable file
·201 lines (168 loc) · 5.27 KB
/
ubuntu.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/bin/bash
# list of package installed through apt-get
# (required to run this scripts and/or as dependancies for PyNE and its depedancies)
apt_package_list="software-properties-common \
python3-pip \
wget \
build-essential \
git \
cmake \
gfortran \
libblas-dev \
liblapack-dev \
libeigen3-dev \
libhdf5-dev \
hdf5-tools"
# list of python package required for PyNE and its depedencies (installed using pip3 python package manager)
pip_package_list="numpy \
scipy \
cython \
nose \
tables \
matplotlib \
jinja2 \
setuptools \
future"
# hdf5 std directory
hdf5_libdir=/usr/lib/x86_64-linux-gnu/hdf5/serial
# function to check if build folder already exists
function check_repo() {
repo_name=$1
if [ -d ${repo_name} ] ; then
read -p "Delete the existing ${repo_name} directory and all contents? (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]] ; then
rm -rf ${repo_name}
fi
fi
}
# system update
sudo apt-get -y update
sudo apt-get install -y ${apt_package_list}
pip3 install --user ${pip_package_list}
install_dir=${HOME}/opt
mkdir -p ${install_dir}
# need to put libhdf5.so on LD_LIBRARY_PATH (Making sure that LD_LIBRARY_PATH is defined first)
if [ -z $LD_LIBRARY_PATH ]; then
export LD_LIBRARY_PATH="${hdf5_libdir}"
else
export LD_LIBRARY_PATH="${hdf5_libdir}:$LD_LIBRARY_PATH"
fi
############
### MOAB ###
############
# pre-setup
cd ${install_dir}
check_repo moab
mkdir -p moab
cd moab
# clone and version
git clone --branch Version5.1.0 --single-branch https://bitbucket.org/fathomteam/moab moab-repo
cd moab-repo
mkdir -p build
cd build
# cmake, build and install
cmake ../ -DENABLE_HDF5=ON -DHDF5_ROOT=${hdf5_libdir} \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_PYMOAB=ON \
-DENABLE_BLASLAPACK=OFF \
-DENABLE_FORTRAN=OFF \
-DCMAKE_INSTALL_PREFIX=${install_dir}/moab
make
make install
# Adding MOAB/lib to $LD_LIBRARY_PATH and $LIBRARY_PATH
export LD_LIBRARY_PATH="${install_dir}/moab/lib:$LD_LIBRARY_PATH"
# Adding pymoab to $PYTHONPATH
PYTHON_VERSION=$(python -c 'import sys; print(sys.version.split('')[0][0:3])')
if [ -z $PYTHONPATH ]; then
export PYTHONPATH="$install_dir/moab/lib/python${PYTHON_VERSION}/site-packages"
else
export PYTHONPATH="$install_dir/moab/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH"
fi
#############
### DAGMC ###
#############
# pre-setup check that the directory we need are in place
cd ${install_dir}
check_repo dagmc
mkdir -p dagmc
cd dagmc
# clone and version
git clone https://github.com/svalinn/DAGMC.git dagmc-repo
cd dagmc-repo
git checkout develop
mkdir build
cd build
# cmake, build and install
cmake .. -DMOAB_DIR=${install_dir}/moab \
-DBUILD_STATIC_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=${install_dir}/dagmc
make
make install
# Adding DAGMC/lib to $LD_LIBRARY_PATH and $LIBRARY_PATH
export LD_LIBRARY_PATH="${install_dir}/dagmc/lib:$LD_LIBRARY_PATH"
# Adding dagmc/bin to $PATH
export PATH="${install_dir}/dagmc/bin:$PATH"
####################
### OpenMC API #####
####################
cd ${install_dir}
git clone https://github.com/openmc-dev/openmc.git
cd openmc
git checkout develop
mkdir bld
cd bld
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local
make
make install
cd ..
pip3 install .
############
### PyNE ###
############
# pre-setup
cd ${install_dir}
check_repo pyne
mkdir -p pyne
cd pyne
# clone and version
git clone https://github.com/pyne/pyne.git pyne-repo
cd pyne-repo
if [ $1 == 'stable' ] ; then
TAG=$(git describe --abbrev=0 --tags)
git checkout tags/`echo ${TAG}` -b `echo ${TAG}`
fi
python setup.py install --user \
--moab ${install_dir}/moab \
--dagmc ${install_dir}/dagmc \
--clean
# Adding .local/lib to $LD_LIBRARY_PATH and $LIBRARY_PATH
export LD_LIBRARY_PATH="${HOME}/.local/lib:$LD_LIBRARY_PATH"
# Adding .local//bin to $PATH
export PATH="${HOME}/.local/bin:$PATH"
# Make Pyne Nuclear Data
cd # cd without argument will take you back to your $HOME directory
nuc_data_make
# Run tests
cd ${install_dir}/pyne/pyne-repo/tests
./travis-run-tests.sh
echo " \
# Add HDF5
if [ -z \$LD_LIBRARY_PATH ]; then
export LD_LIBRARY_PATH=\"${hdf5_libdir}\"
else
export LD_LIBRARY_PATH=\"${hdf5_libdir}:\$LD_LIBRARY_PATH\"
fi
# Adding MOAB/lib to \$LD_LIBRARY_PATH and \$LIBRARY_PATH
export LD_LIBRARY_PATH=\"${install_dir}/moab/lib:\$LD_LIBRARY_PATH\"
# Adding pymoab to \$PYTHONPATH
PYTHON_VERSION=\$(python -c 'import sys; print(sys.version.split('')[0][0:3])')
if [ -z \$PYTHONPATH ]; then
export PYTHONPATH=\"${install_dir}/moab/lib/python\${PYTHON_VERSION}/site-packages\"
else
export PYTHONPATH=\"${install_dir}/moab/lib/python\${PYTHON_VERSION}/site-packages:\$PYTHONPATH\"
fi
export LD_LIBRARY_PATH=\"${install_dir}/dagmc/lib:\$LD_LIBRARY_PATH\"
# Adding dagmc/bin to \$PATH
export PATH=\"${install_dir}/dagmc/bin:\$PATH\"
" >> .bashrc
echo "Run 'source ~/.bashrc' to update environment variables. PyNE may not function correctly without doing so."