forked from ukaea/paramak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfileDependencies
202 lines (181 loc) · 6.86 KB
/
DockerfileDependencies
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
202
# This Dockerfile creates an enviroment with the optional dependancies
# This dockerfile can be built in a few different ways.
# Docker build commands must be run from within the base repository directory
#
# There are build args availalbe for specifying the:
# - cq_version
# The version of CadQuery to use master or 2.
# Default is 2.
# Options: [master, 2]
#
# - include_neutronics
# If software dependencies needed for neutronics simulations should be
# included true or false.
# Default is false.
# Options: [true, false]
#
# - compile_cores
# The number of CPU cores to compile the image with.
# Default is 1.
# Options: [1, 2, 3, 4, 5, 6...]
#
# Example builds:
# Building using the defaults (cq_version 2, no neutronics and 1 core compile)
# docker build -t ukaea/paramak .
#
# Building to include cadquery master, neutronics dependencies and use 8 cores.
# Run command from within the base repository directory
# docker build -t ukaea/paramak --build-arg include_neutronics=true --build-arg compile_cores=8 --build-arg cq_version=master .
# Once build the dockerimage can be run in a few different ways.
#
# Run with the following command for a terminal notebook interface
# docker run -it ukaea/paramak .
#
# Run with the following command for a jupyter notebook interface
# docker run -p 8888:8888 ukaea/paramak /bin/bash -c "jupyter notebook --notebook-dir=/examples --ip='*' --port=8888 --no-browser --allow-root"
# Once built, the docker image can be tested with either of the following commands
# docker run --rm ukaea/paramak pytest /tests
# docker run --rm ukaea/paramak /bin/bash -c "cd .. && bash run_tests.sh"
FROM continuumio/miniconda3:4.9.2
# By default this Dockerfile builds with the latest release of CadQuery 2
ARG cq_version=2
ARG include_neutronics=false
ARG compile_cores=1
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \
PATH=/opt/openmc/bin:/opt/NJOY2016/build:$PATH \
LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \
CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \
apt-get upgrade -y
RUN apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev \
freeglut3-dev libosmesa6 libosmesa6-dev \
libgles2-mesa-dev curl && \
apt-get clean
# Installing CadQuery
# jupyter is installed before cadquery to avoid a conflict
RUN echo installing CadQuery version $cq_version && \
conda install jupyter -y --quiet && \
conda install -c cadquery -c conda-forge cadquery="$cq_version" && \
conda clean -afy
# Install neutronics dependencies from Debian package manager
RUN if [ "$include_neutronics" = "true" ] ; \
then echo installing with include_neutronics=true ; \
apt-get install -y \
wget git gfortran g++ cmake \
mpich libmpich-dev libhdf5-serial-dev libhdf5-mpich-dev \
imagemagick ; \
fi
# install addition packages required for MOAB
RUN if [ "$include_neutronics" = "true" ] ; \
then echo installing with include_neutronics=true ; \
apt-get --yes install libeigen3-dev ; \
apt-get --yes install libblas-dev ; \
apt-get --yes install liblapack-dev ; \
apt-get --yes install libnetcdf-dev ; \
apt-get --yes install libtbb-dev ; \
apt-get --yes install libglfw3-dev ; \
fi
# Clone and install NJOY2016
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone --single-branch --branch master https://github.com/njoy/NJOY2016.git /opt/NJOY2016 ; \
cd /opt/NJOY2016 ; \
mkdir build ; \
cd build ; \
cmake -Dstatic=on .. ; \
make 2>/dev/null ; \
make install ; \
fi
# Clone and install Embree
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone --single-branch --branch master https://github.com/embree/embree.git ; \
cd embree ; \
mkdir build ; \
cd build ; \
cmake .. -DCMAKE_INSTALL_PREFIX=.. \
-DEMBREE_ISPC_SUPPORT=OFF ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
fi
# Clone and install MOAB
RUN if [ "$include_neutronics" = "true" ] ; \
then pip install --upgrade numpy cython ; \
mkdir MOAB ; \
cd MOAB ; \
mkdir build ; \
git clone --single-branch --branch develop https://bitbucket.org/fathomteam/moab.git ; \
cd build ; \
cmake ../moab -DENABLE_HDF5=ON \
-DENABLE_NETCDF=ON \
-DENABLE_FORTRAN=OFF \
-DENABLE_BLASLAPACK=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=/MOAB ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
rm -rf * ; \
cmake ../moab -DENABLE_HDF5=ON \
-DENABLE_PYMOAB=ON \
-DENABLE_FORTRAN=OFF \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_BLASLAPACK=OFF \
-DCMAKE_INSTALL_PREFIX=/MOAB ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
cd pymoab ; \
bash install.sh ; \
python setup.py install ; \
fi
# Clone and install Double-Down
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone --single-branch --branch main https://github.com/pshriwise/double-down.git ; \
cd double-down ; \
mkdir build ; \
cd build ; \
cmake .. -DMOAB_DIR=/MOAB \
-DCMAKE_INSTALL_PREFIX=.. \
-DEMBREE_DIR=/embree ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
fi
# Clone and install DAGMC
RUN if [ "$include_neutronics" = "true" ] ; \
then mkdir DAGMC ; \
cd DAGMC ; \
git clone --single-branch --branch develop https://github.com/svalinn/DAGMC.git ; \
mkdir build ; \
cd build ; \
cmake ../DAGMC -DBUILD_TALLY=ON \
-DMOAB_DIR=/MOAB \
-DDOUBLE_DOWN=ON \
-DBUILD_STATIC_EXE=OFF \
-DBUILD_STATIC_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=/DAGMC/ \
-DDOUBLE_DOWN_DIR=/double-down ; \
make -j"$compile_cores" install ; \
rm -rf /DAGMC/DAGMC /DAGMC/build ; \
fi
# Clone and install OpenMC with DAGMC
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone --recurse-submodules https://github.com/openmc-dev/openmc.git /opt/openmc ; \
cd /opt/openmc ; \
mkdir build ; \
cd build ; \
cmake -Doptimize=on \
-Ddagmc=ON \
-DDAGMC_DIR=/DAGMC/ \
-DHDF5_PREFER_PARALLEL=on .. ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
cd .. ; \
pip install -e .[test] ; \
/opt/openmc/tools/ci/download-xs.sh ; \
fi
ENV OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml
RUN if [ "$include_neutronics" = "true" ] ; \
then pip install vtk ; \
pip install parametric_plasma_source ; \
pip install neutronics_material_maker ; \
fi
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt