-
Notifications
You must be signed in to change notification settings - Fork 3
/
bout-3.1.dkr
150 lines (129 loc) · 4.66 KB
/
bout-3.1.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
# ================================================================================
# Dockerfile to setup build environment for BOUT-next build
#
# Build example: sudo docker build -t boutproject/bout-next:9f4c663 -f bout-next.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 python python-devel wget \
&& wget https://bootstrap.pypa.io/get-pip.py \
&& python get-pip.py \
&& rm get-pip.py
RUN pip install numpy scipy netcdf4 matplotlib ipython
# ----------------------------------------------------------------
# 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 \
&& 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 \
-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.5.4.tar.gz \
&& tar -xvzf petsc-lite-3.5.4.tar.gz \
&& cd petsc-3.5.4/ \
&& ./configure --with-clanguage=cxx --with-mpi=yes --with-precision=double --with-scalar-type=real \
--download-hypre=1 --with-shared-libraries=0 --with-sundials-dir=/usr \
&& make -f /petsc-3.5.4/makefile all \
&& make -f /petsc-3.5.4/makefile PETSC_DIR=/petsc-3.5.4 PETSC_ARCH=arch-linux2-cxx-debug test \
&& ln -s /petsc-3.5.4/arch-linux2-cxx-debug/include/* /usr/include/ \
&& ln -s /petsc-3.5.4/arch-linux2-cxx-debug/lib/*a /usr/lib/ \
&& ln -s /petsc-3.5.4/arch-linux2-cxx-debug/lib/modules/* /usr/lib/modules/ \
&& cd /petsc-3.5.4/arch-linux2-cxx-debug/ \
&& rm -r externalpackages obj \
&& cd /petsc-3.5.4/ \
&& rm -r src
ENV PETSC_DIR=/petsc-3.5.4/
ENV PETSC_ARCH=arch-linux2-cxx-debug
#####################
# Install NETCDF
WORKDIR /
RUN yum install -y zlib-devel hdf5-devel m4 \
&& wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.4.1.tar.gz \
&& tar -xzvf netcdf-4.4.1.tar.gz \
&& rm netcdf-4.4.1.tar.gz \
&& cd /netcdf-4.4.1/ \
&& ./configure --prefix=/usr/local --disable-netcdf-4 --disable-dap --enable-parallel \
&& make \
&& make install \
&& cd / \
&& rm -r netcdf-4.4.1
#####################
# Install NETCDF-cxx
# WORKDIR /
RUN wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-cxx-4.2.tar.gz \
&& tar -xzvf netcdf-cxx-4.2.tar.gz \
&& rm netcdf-cxx-4.2.tar.gz \
&& cd netcdf-cxx-4.2/ \
&& ./configure --prefix=/usr/local \
&& make \
&& make install \
&& cd / \
&& rm -r netcdf-cxx-4.2
# ----------------------------------------------------------------
# Build and install BOUT++
# ----------------------------------------------------------------
# configure and build BOUT++ source code
RUN useradd -ms /bin/bash boutuser \
&& echo -e "boutforever\nboutforever" | passwd boutuser \
&& usermod -aG wheel boutuser
USER boutuser
WORKDIR /home/boutuser
RUN wget https://github.com/boutproject/BOUT-dev/archive/v3.1.tar.gz \
&& tar -xzf v3.1.tar.gz \
&& chown boutuser /home/boutuser/BOUT-dev-3.1 \
&& rm v3.1.tar.gz
WORKDIR /home/boutuser/BOUT-dev-3.1
RUN ./configure --with-petsc=/petsc-3.5.4 --with-sundials=/usr \
&& make
ENV PYTHONPATH=/home/boutuser/BOUT-dev-3.1/tools/pylib/:$PYTHONPATH
ENV PYTHONIOENCODING=utf-8
ENV PATH=/home/boutuser/BOUT-dev-3.1/bin/:$PATH
#####################
# Make common folder for moving data to/from host
WORKDIR /home/boutuser
RUN mkdir bout-img-shared