-
-
Notifications
You must be signed in to change notification settings - Fork 186
/
Copy pathDockerfile.test-env
371 lines (348 loc) · 12.8 KB
/
Dockerfile.test-env
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# Dockerfile describing development and testing environments of FEniCSx
#
# Authors:
# Jack S. Hale <jack.hale@uni.lu>
# Lizao Li <lzlarryli@gmail.com>
# Garth N. Wells <gnw20@cam.ac.uk>
# Jan Blechta <blechta@karlin.mff.cuni.cz>
#
# You can build an optimised version of the FEniCS development environment
# (without the FEniCS components) for your platform using the command:
#
# docker build --target dev-env --file dolfinx/docker/Dockerfile.test-env --build-arg PETSC_SLEPC_OPTFLAGS="-O2 -march=native" .
#
ARG ADIOS2_VERSION=2.10.2
ARG DOXYGEN_VERSION=1_13_1
ARG GMSH_VERSION=4_13_1
ARG HDF5_VERSION=1.14.5
ARG KAHIP_VERSION=3.17
# NOTE: The NumPy version (https://pypi.org/project/numpy/#history)
# should be pinned to the most recent NumPy release that is supported by
# the most recent Numba release, see
# https://numba.readthedocs.io/en/stable/user/installing.html#version-support-information
ARG NUMPY_VERSION=2.0.2
ARG PETSC_VERSION=3.22.2
ARG SLEPC_VERSION=3.22.2
ARG MPICH_VERSION=4.2.3
ARG OPENMPI_SERIES=5.0
ARG OPENMPI_PATCH=6
########################################
FROM ubuntu:24.04 AS dev-env
LABEL maintainer="FEniCS Steering Council <fenics-steering-council@googlegroups.com>"
LABEL description="FEniCS testing and development environment with PETSc real, complex, 32-bit and 64-bit modes"
ARG DOXYGEN_VERSION
ARG GMSH_VERSION
ARG HDF5_VERSION
ARG PETSC_VERSION
ARG SLEPC_VERSION
ARG ADIOS2_VERSION
ARG KAHIP_VERSION
ARG NUMPY_VERSION
ARG MPICH_VERSION
ARG OPENMPI_SERIES
ARG OPENMPI_PATCH
# The following ARGS are used in the dev-env layer.
# They are safe defaults. They can be overridden by the user.
# Compiler optimisation flags for SLEPc and PETSc, all languages.
ARG PETSC_SLEPC_OPTFLAGS="-O2"
# Turn on PETSc and SLEPc debugging. "yes" or "no".
ARG PETSC_SLEPC_DEBUGGING="no"
# MPI variant. "mpich" or "openmpi".
ARG MPI="mpich"
# Number of build threads to use with make
ARG BUILD_NP=4
WORKDIR /tmp
# Environment variables
ENV OPENBLAS_NUM_THREADS=1 \
OPENBLAS_VERBOSE=0
# Install dependencies available via apt-get.
# - First set of packages are required to build and run FEniCS.
# - Second set of packages are recommended and/or required to build
# documentation or tests.
# - Third set of packages are optional, but required to run gmsh
# pre-built binaries.
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get -qq update && \
apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \
apt-get -y install \
cmake \
g++ \
gfortran \
libboost-dev \
liblapack-dev \
libopenblas-dev \
libpugixml-dev \
libspdlog-dev \
ninja-build \
pkg-config \
python3-dev \
python3-pip \
python3-venv && \
#
apt-get -y install \
catch2 \
git \
graphviz \
libeigen3-dev \
valgrind \
wget && \
#
apt-get -y install \
libglu1 \
libxcursor-dev \
libxft2 \
libxinerama1 \
libfltk1.3-dev \
libfreetype6-dev \
libgl1-mesa-dev \
libocct-foundation-dev \
libocct-data-exchange-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Doxygen
RUN apt-get -qq update && \
apt-get -y install bison flex && \
wget -nc --quiet https://github.com/doxygen/doxygen/archive/refs/tags/Release_${DOXYGEN_VERSION}.tar.gz && \
tar xfz Release_${DOXYGEN_VERSION}.tar.gz && \
cd doxygen-Release_${DOXYGEN_VERSION} && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B build-dir . && \
cmake --build build-dir -j 2 && \
cmake --install build-dir && \
apt-get -y purge bison flex && \
apt-get -y autoremove && \
apt-get clean && \
rm -rf /tmp/*
# Install MPI
RUN if [ "$MPI" = "mpich" ]; then \
wget https://www.mpich.org/static/downloads/${MPICH_VERSION}/mpich-${MPICH_VERSION}.tar.gz && \
tar xfz mpich-${MPICH_VERSION}.tar.gz && \
cd mpich-${MPICH_VERSION} && \
./configure && \
make -j${BUILD_NP} install; \
else \
wget https://download.open-mpi.org/release/open-mpi/v${OPENMPI_SERIES}/openmpi-${OPENMPI_SERIES}.${OPENMPI_PATCH}.tar.gz && \
tar xfz openmpi-${OPENMPI_SERIES}.${OPENMPI_PATCH}.tar.gz && \
cd openmpi-${OPENMPI_SERIES}.${OPENMPI_PATCH} && \
./configure && \
make -j${BUILD_NP} install; \
fi && \
ldconfig && \
rm -rf /tmp/*
ENV VIRTUAL_ENV=/dolfinx-env
ENV PATH=/dolfinx-env/bin:$PATH
RUN python3 -m venv ${VIRTUAL_ENV}
# Install Python packages (via pip)
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
pip install --no-cache-dir cython numpy==${NUMPY_VERSION} && \
pip install --no-cache-dir mpi4py
# Install KaHIP
RUN wget -nc --quiet https://github.com/kahip/kahip/archive/v${KAHIP_VERSION}.tar.gz && \
tar -xf v${KAHIP_VERSION}.tar.gz && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DNONATIVEOPTIMIZATIONS=on -B build-dir -S KaHIP-${KAHIP_VERSION} && \
cmake --build build-dir && \
cmake --install build-dir && \
rm -rf /tmp/*
# Install HDF5
# Note: HDF5 CMake install has numerous bugs and inconsistencies. Test carefully.
# HDF5 overrides CMAKE_INSTALL_PREFIX by default, hence it is set
# below to ensure that HDF5 is installed into a path where it can be
# found.
RUN wget -nc --quiet https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_${HDF5_VERSION}.tar.gz && \
tar xfz hdf5_${HDF5_VERSION}.tar.gz && \
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DHDF5_ENABLE_PARALLEL=on -DHDF5_ENABLE_Z_LIB_SUPPORT=on -B build-dir -S hdf5-hdf5_${HDF5_VERSION} && \
cmake --build build-dir && \
cmake --install build-dir && \
rm -rf /tmp/*
# Install ADIOS2 (Python interface in /usr/local/lib), same as GMSH
RUN wget -nc --quiet https://github.com/ornladios/ADIOS2/archive/v${ADIOS2_VERSION}.tar.gz -O adios2-v${ADIOS2_VERSION}.tar.gz && \
mkdir -p adios2-v${ADIOS2_VERSION} && \
tar -xf adios2-v${ADIOS2_VERSION}.tar.gz -C adios2-v${ADIOS2_VERSION} --strip-components 1 && \
cmake -G Ninja -DADIOS2_USE_HDF5=on -DCMAKE_INSTALL_PYTHONDIR=/usr/local/lib/ -DADIOS2_USE_Fortran=off -DBUILD_TESTING=off -DADIOS2_BUILD_EXAMPLES=off -DADIOS2_USE_ZeroMQ=off -B build-dir -S ./adios2-v${ADIOS2_VERSION} && \
cmake --build build-dir && \
cmake --install build-dir && \
rm -rf /tmp/*
# Install GMSH
RUN git clone -b gmsh_${GMSH_VERSION} --single-branch --depth 1 https://gitlab.onelab.info/gmsh/gmsh.git && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_BUILD_DYNAMIC=1 -DENABLE_OPENMP=1 -B build-dir -S gmsh && \
cmake --build build-dir && \
cmake --install build-dir && \
rm -rf /tmp/*
# GMSH installs python library in /usr/local/lib, see: https://gitlab.onelab.info/gmsh/gmsh/-/issues/1414
ENV PYTHONPATH=/usr/local/lib:$PYTHONPATH
# Install PETSc and petsc4py with real and complex types
ENV PETSC_DIR=/usr/local/petsc SLEPC_DIR=/usr/local/slepc
RUN apt-get -qq update && \
apt-get -y install bison flex && \
git clone --depth=1 -b v${PETSC_VERSION} https://gitlab.com/petsc/petsc.git ${PETSC_DIR} && \
cd ${PETSC_DIR} && \
# Real32, 32-bit int
./configure \
PETSC_ARCH=linux-gnu-real32-32 \
--COPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--CXXOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--FOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--with-64-bit-indices=no \
--with-debugging=${PETSC_SLEPC_DEBUGGING} \
--with-fortran-bindings=no \
--with-shared-libraries \
--download-metis \
--download-mumps-avoid-mpi-in-place \
--download-mumps \
--download-ptscotch \
--download-scalapack \
--download-superlu \
--download-superlu_dist \
--with-scalar-type=real \
--with-precision=single && \
make PETSC_ARCH=linux-gnu-real32-32 ${MAKEFLAGS} all && \
# Complex64, 32-bit int
./configure \
PETSC_ARCH=linux-gnu-complex64-32 \
--COPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--CXXOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--FOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--with-64-bit-indices=no \
--with-debugging=${PETSC_SLEPC_DEBUGGING} \
--with-fortran-bindings=no \
--with-shared-libraries \
--download-metis \
--download-mumps-avoid-mpi-in-place \
--download-mumps \
--download-ptscotch \
--download-scalapack \
--download-superlu \
--download-superlu_dist \
--with-scalar-type=complex \
--with-precision=single && \
make PETSC_ARCH=linux-gnu-complex64-32 ${MAKEFLAGS} all && \
# Real64, 32-bit int
./configure \
PETSC_ARCH=linux-gnu-real64-32 \
--COPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--CXXOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--FOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--with-64-bit-indices=no \
--with-debugging=${PETSC_SLEPC_DEBUGGING} \
--with-fortran-bindings=no \
--with-shared-libraries \
--download-hypre \
--download-metis \
--download-mumps-avoid-mpi-in-place \
--download-mumps \
--download-ptscotch \
--download-scalapack \
--download-spai \
--download-suitesparse \
--download-superlu \
--download-superlu_dist \
--with-scalar-type=real \
--with-precision=double && \
make PETSC_ARCH=linux-gnu-real64-32 ${MAKEFLAGS} all && \
# Complex128, 32-bit int
./configure \
PETSC_ARCH=linux-gnu-complex128-32 \
--COPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--CXXOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--FOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--with-64-bit-indices=no \
--with-debugging=${PETSC_SLEPC_DEBUGGING} \
--with-fortran-bindings=no \
--with-shared-libraries \
--download-hypre \
--download-metis \
--download-mumps-avoid-mpi-in-place \
--download-mumps \
--download-ptscotch \
--download-scalapack \
--download-suitesparse \
--download-superlu \
--download-superlu_dist \
--with-scalar-type=complex \
--with-precision=double && \
make PETSC_ARCH=linux-gnu-complex128-32 ${MAKEFLAGS} all && \
# Real64, 64-bit int
./configure \
PETSC_ARCH=linux-gnu-real64-64 \
--COPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--CXXOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--FOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--with-64-bit-indices=yes \
--with-debugging=${PETSC_SLEPC_DEBUGGING} \
--with-fortran-bindings=no \
--with-shared-libraries \
--download-hypre \
--download-mumps-avoid-mpi-in-place \
--download-mumps \
--download-ptscotch \
--download-scalapack \
--download-suitesparse \
--download-superlu_dist \
--with-scalar-type=real \
--with-precision=double && \
make PETSC_ARCH=linux-gnu-real64-64 ${MAKEFLAGS} all && \
# Complex128, 64-bit int
./configure \
PETSC_ARCH=linux-gnu-complex128-64 \
--COPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--CXXOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--FOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" \
--with-64-bit-indices=yes \
--with-debugging=${PETSC_SLEPC_DEBUGGING} \
--with-fortran-bindings=no \
--with-shared-libraries \
--download-hypre \
--download-mumps-avoid-mpi-in-place \
--download-mumps \
--download-ptscotch \
--download-scalapack \
--download-suitesparse \
--download-superlu_dist \
--with-scalar-type=complex \
--with-precision=double && \
make PETSC_ARCH=linux-gnu-complex128-64 ${MAKEFLAGS} all && \
# Install petsc4py
cd src/binding/petsc4py && \
PETSC_ARCH=linux-gnu-real32-32:linux-gnu-complex64-32:linux-gnu-real64-32:linux-gnu-complex128-32:linux-gnu-real64-64:linux-gnu-complex128-64 pip -v install --no-cache-dir --no-build-isolation . && \
# Cleanup
apt-get -y purge bison flex && \
apt-get -y autoremove && \
apt-get clean && \
rm -rf \
${PETSC_DIR}/**/tests/ \
${PETSC_DIR}/**/obj/ \
${PETSC_DIR}/**/externalpackages/ \
${PETSC_DIR}/CTAGS \
${PETSC_DIR}/RDict.log \
${PETSC_DIR}/TAGS \
${PETSC_DIR}/docs/ \
${PETSC_DIR}/share/ \
${PETSC_DIR}/src/ \
${PETSC_DIR}/systems/ \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install SLEPc
RUN git clone --depth=1 -b v${SLEPC_VERSION} https://gitlab.com/slepc/slepc.git ${SLEPC_DIR} && \
cd ${SLEPC_DIR} && \
export PETSC_ARCH=linux-gnu-real32-32 && \
./configure && \
make && \
export PETSC_ARCH=linux-gnu-complex64-32 && \
./configure && \
make && \
export PETSC_ARCH=linux-gnu-real64-32 && \
./configure && \
make && \
export PETSC_ARCH=linux-gnu-complex128-32 && \
./configure && \
make && \
export PETSC_ARCH=linux-gnu-real64-64 && \
./configure && \
make && \
export PETSC_ARCH=linux-gnu-complex128-64 && \
./configure && \
make && \
# Install slepc4py
cd src/binding/slepc4py && \
PETSC_ARCH=linux-gnu-real32-32:linux-gnu-complex64-32:linux-gnu-real64-32:linux-gnu-complex128-32:linux-gnu-real64-64:linux-gnu-complex128-64 pip -v install --no-cache-dir --no-build-isolation . && \
rm -rf ${SLEPC_DIR}/CTAGS ${SLEPC_DIR}/TAGS ${SLEPC_DIR}/docs ${SLEPC_DIR}/src/ ${SLEPC_DIR}/**/obj/ ${SLEPC_DIR}/**/test/ && \
rm -rf /tmp/*
WORKDIR /root