forked from shimwell/openmc_workshop_dependencies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_openmc_dagmc
164 lines (124 loc) · 4.72 KB
/
Dockerfile_openmc_dagmc
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
# build with the following command
# sudo docker build -f Dockerfile_openmc_dagmc -t openmcworkshop/openmc_dagmc .
FROM ubuntu:18.04
RUN apt-get --yes update && apt-get --yes upgrade
RUN apt-get -y install locales
RUN locale-gen en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
RUN apt-get --yes update && apt-get --yes upgrade
# Python installation
RUN apt-get install -y python3-pip
RUN apt-get install -y python3-dev
RUN apt-get install -y python3-setuptools
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get install -y ipython3
RUN apt-get update
RUN apt-get install -y python3-tk
# required pacakges identified from openmc travis.yml
RUN apt-get --yes install mpich
RUN apt-get --yes install libmpich-dev
RUN apt-get --yes install libhdf5-serial-dev
RUN apt-get --yes install libhdf5-mpich-dev
RUN apt-get --yes install libblas-dev
RUN apt-get --yes install liblapack-dev
# needed to allow NETCDF on MOAB which helps with tet meshes in OpenMC
RUN apt-get --yes install libnetcdf-dev
RUN apt-get --yes install libnetcdf13
RUN apt-get -y install sudo # needed as the install NJOY script has a sudo make install command
RUN apt-get -y install git
RUN apt-get -y install cmake
#RUN rm /usr/bin/python
RUN ln -s /usr/bin/python3 /usr/bin/python
# global enviromental varibles set in th travis.yml
ENV HOME=/root
ENV MPI_DIR=/usr
ENV HDF5_ROOT=/usr
#ENV OMP_NUM_THREADS=2 #commented out for users with more than 2 threads
ENV OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml
ENV OPENMC_ENDF_DATA=$HOME/endf-b-vii.1
ENV LD_LIBRARY_PATH=$HOME/MOAB/lib:$HOME/DAGMC/lib
ENV PATH=$PATH:$HOME/NJOY2016/build
ENV COVERALLS_PARALLEL=true
ENV NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=0
#these are used in the travis install scripts to decide what to install
ENV OMP=y
ENV MPI=n
ENV PHDF5=n
ENV DAGMC=y
# installs OpenMc from source
RUN cd /opt && \
git clone https://github.com/openmc-dev/openmc.git && \
cd openmc && \
git checkout develop
# pip install is used in some of the travis scripts but pip3 is installed, this alias makes pip and pip3 the same
RUN ln -s /usr/bin/pip3 /usr/bin/pip
# newer CMake version allows us to set libraries, includes of the
# imported DAGMC target in CMake
RUN apt remove -y cmake
RUN pip install cmake==3.12.0
RUN apt install wget
# these travis scripts include NJOY, DAGMC, MOAB
# RUN cd /opt/openmc && \
# ./tools/ci/travis-install-njoy.sh
#ENV DAGMC_DIR=$HOME/DAGMC/
# MOAB Variables
ENV MOAB_BRANCH='Version5.1.0'
ENV MOAB_REPO='https://bitbucket.org/fathomteam/moab/'
ENV MOAB_INSTALL_DIR=$HOME/MOAB/
# DAGMC Variables
ENV DAGMC_BRANCH='develop'
ENV DAGMC_REPO='https://github.com/svalinn/dagmc'
ENV DAGMC_INSTALL_DIR=$HOME/DAGMC/
# MOAB Install
RUN cd $HOME && \
mkdir MOAB && \
cd MOAB && \
git clone -b $MOAB_BRANCH $MOAB_REPO && \
mkdir build && cd build && \
cmake ../moab -DENABLE_HDF5=ON -DENABLE_NETCDF=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$MOAB_INSTALL_DIR && \
make -j8 && make -j8 install && \
cmake ../moab -DBUILD_SHARED_LIBS=OFF && \
make -j8 install && \
rm -rf $HOME/MOAB/moab $HOME/MOAB/build
# DAGMC Install
RUN cd $HOME && \
mkdir DAGMC && cd DAGMC && \
git clone -b $DAGMC_BRANCH $DAGMC_REPO && \
mkdir build && \
cd build && \
cmake ../dagmc -DBUILD_TALLY=ON -DCMAKE_INSTALL_PREFIX=$DAGMC_INSTALL_DIR -DMOAB_DIR=$MOAB_INSTALL_DIR && \
make -j8 install && \
rm -rf $HOME/DAGMC/dagmc $HOME/DAGMC/build
RUN pip install --upgrade numpy
# install openmc
RUN cd /opt/openmc && \
mkdir build && cd build && \
cmake -Ddagmc=ON -DDAGMC_ROOT=$DAGMC_INSTALL_DIR -DHDF5_PREFER_PARALLEL=OFF .. && \
make -j8 && \
make install && \
cd /opt/openmc/ && \
pip install .
RUN git clone https://github.com/openmc-dev/plotter.git
# dependancies for the occ_faceter
RUN apt-get --yes update && apt-get --yes upgrade
RUN apt-get --yes install libcgal-dev
RUN apt-get --yes install software-properties-common
RUN add-apt-repository ppa:freecad-maintainers/freecad-stable
RUN apt-get --yes install libocc*dev
RUN apt-get --yes install occ*
RUN apt-get --yes install libtbb-dev
# install the occ_faceter, this currently uses a branch that could be merged
RUN git clone https://github.com/makeclean/occ_faceter.git && \
cd occ_faceter && \
mkdir build && cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=.. && \
make && \
make install
# there can be only one
RUN echo 'alias python="python3"' >> ~/.bashrc
RUN echo 'export PATH=$PATH:~/MOAB/bin' >> ~/.bashrc
RUN echo 'export PATH=$PATH:/plotter/' >> ~/.bashrc
RUN echo 'export PATH=$PATH:~/DAGMC/bin' >> ~/.bashrc
RUN echo 'export PATH=$PATH:/occ_faceter/bin/' >> ~/.bashrc