-
Notifications
You must be signed in to change notification settings - Fork 3
/
bout.dkr
160 lines (140 loc) · 5.33 KB
/
bout.dkr
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
# ================================================================================
# Dockerfile to setup build environment for BOUT++ master branch
#
# Build example: sudo docker build -t boutproject/release:4.2 -f bout.dkr .
#
# ================================================================================
FROM centos:centos7
MAINTAINER Jarrod Leddy "[email protected]"
# ----------------------------------------------------------------
# Convenient network/system tools, python, dependencies
# ----------------------------------------------------------------
RUN yum install -y emacs-nox vim nano git gfortran g++ gcc \
mpich fftw-devel hdf5 blas-devel lapack-devel cmake zlib-devel hdf5-devel sudo \
&& yum clean all \
&& rm -rf /var/cache/yum
# ----------------------------------------------------------------
# Python
# ----------------------------------------------------------------
RUN yum install -y https://centos7.iuscommunity.org/ius-release.rpm \
&& yum install -y python36u python36u-pip python36u-devel \
&& ln -s /usr/bin/python3.6 /usr/bin/python3 \
&& python3 -m pip install numpy scipy netcdf4 matplotlib
# ----------------------------------------------------------------
# Get BOUT++ dependencies
# ----------------------------------------------------------------
#####################
# Install mpich
WORKDIR /
RUN yum install -y wget make file gcc-c++ \
&& wget https://www.mpich.org/static/tarballs/3.2.1/mpich-3.2.1.tar.gz \
&& tar -xzvf mpich-3.2.1.tar.gz \
&& rm mpich-3.2.1.tar.gz \
&& cd mpich-3.2.1 \
&& ./configure --enable-shared \
&& make \
&& make install \
&& cd / \
&& rm -r mpich-3.2.1
#####################
# Install SUNDIALS
WORKDIR /
RUN wget https://computation.llnl.gov/projects/sundials/download/sundials-2.7.0.tar.gz \
&& tar -xvzf sundials-2.7.0.tar.gz \
&& rm sundials-2.7.0.tar.gz \
&& cd sundials-2.7.0 \
&& mkdir build \
&& mkdir -p /usr/examples \
&& cd build/ \
&& cmake \
-DCMAKE_INSTALL_PREFIX=/usr/ \
-DEXAMPLES_INSTALL_PATH=/usr/examples \
-DCMAKE_LINKER=/usr/lib \
-DLAPACK_ENABLE=ON \
-DOPENMP_ENABLE=ON \
-DBUILD_SHARED_LIBS=ON \
-DMPI_ENABLE=ON \
../ \
&& make \
&& make install \
&& cd / \
&& rm -r sundials-2.7.0
#####################
# Install PETSC
WORKDIR /
RUN yum install -y bison flex \
&& wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.9.3.tar.gz \
&& tar -xvzf petsc-lite-3.9.3.tar.gz \
&& cd petsc-3.9.3/ \
&& ./configure --with-clanguage=cxx --with-mpi=yes --with-shared-libraries --with-precision=double --with-scalar-type=real \
--download-mumps=1 --download-scalapack=1 --download-blacs=1 --download-fblas-lapack=1 \
--download-parmetis=1 --download-ptscotch=1 --download-metis=1 --with-sundials-dir=/usr \
&& make -f /petsc-3.9.3/makefile all \
&& make -f /petsc-3.9.3/makefile PETSC_DIR=/petsc-3.9.3 PETSC_ARCH=arch-linux2-cxx-debug test \
&& ln -s /petsc-3.9.3/arch-linux2-cxx-debug/include/* /usr/include/ \
&& ln -s /petsc-3.9.3/arch-linux2-cxx-debug/lib/*a /usr/lib/ \
&& ln -s /petsc-3.9.3/arch-linux2-cxx-debug/lib/modules/* /usr/lib/modules/ \
&& cd /petsc-3.9.3/arch-linux2-cxx-debug/ \
&& rm -r externalpackages obj \
&& cd /petsc-3.9.3/ \
&& rm -r src
ENV PETSC_DIR=/petsc-3.9.3/
ENV PETSC_ARCH=arch-linux2-cxx-debug
#####################
# Install SLEPC
WORKDIR /
RUN wget http://slepc.upv.es/download/distrib/slepc-3.9.2.tar.gz \
&& tar xzf slepc-3.9.2.tar.gz \
&& rm slepc-3.9.2.tar.gz \
&& cd slepc-3.9.2/ \
&& ./configure \
&& make SLEPC_DIR=$PWD PETSC_DIR=/petsc-3.9.3/ PETSC_ARCH=arch-linux2-cxx-debug \
&& export SLEPC_DIR=/slepc-3.9.2 \
&& make test \
&& rm -r /slepc-3.9.2/arch-linux2-cxx-debug/obj \
&& rm -r /slepc-3.9.2/src
ENV SLEPC_DIR=/slepc-3.9.2
#####################
# Install NETCDF
WORKDIR /
RUN yum install -y zlib-devel hdf5-devel \
&& wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.6.1.tar.gz \
&& tar -xzvf netcdf-4.6.1.tar.gz \
&& rm netcdf-4.6.1.tar.gz \
&& cd /netcdf-4.6.1/ \
&& ./configure --prefix=/usr/local --disable-dap --enable-parallel --enable-shared \
&& make \
&& make install \
&& cd / \
&& rm -r netcdf-4.6.1
#####################
# Install NETCDF-cxx
WORKDIR /
RUN wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-cxx4-4.3.0.tar.gz \
&& tar -xzvf netcdf-cxx4-4.3.0.tar.gz \
&& rm netcdf-cxx4-4.3.0.tar.gz \
&& cd netcdf-cxx4-4.3.0/ \
&& ./configure --prefix=/usr/local --enable-shared \
&& make \
&& make install \
&& cd / \
&& rm -r netcdf-cxx4-4.3.0
####################
# Cython
RUN python3 -m pip install cython ipython
# ----------------------------------------------------------------
# Build and install BOUT++
# ----------------------------------------------------------------
WORKDIR /opt
RUN git clone -b v4.2.2 --depth 1 git://github.com/boutproject/BOUT-dev.git BOUT-dev
WORKDIR /opt/BOUT-dev
RUN ./configure --with-petsc PETSC_DIR=/petsc-3.9.3 PETSC_ARCH=arch-linux2-cxx-debug --with-sundials=/usr/ --with-fftw --with-netcdf --enable-openmp --with-cvode --with-arkode --with-slepc --with-lapack LIBS="-llapack -lblas" --localedir=$PWD/locale --enable-shared \
&& make \
&& make python \
&& make clean-remove-object-files
ENV PYTHONPATH=/opt/BOUT-dev/tools/pylib/:$PYTHONPATH
ENV PYTHONIOENCODING=utf-8
RUN git submodule update --init --recursive \
&& make check-unit-tests \
&& make clean-unit-tests \
&& rm tests/unit/serial_tests