Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
239 lines (210 loc) · 8.45 KB
/
Copy pathDockerfile
File metadata and controls
239 lines (210 loc) · 8.45 KB
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
# ==========================================
# STAGE 0: Build Environment (Ubuntu 26.04 LTS)
# ==========================================
FROM ubuntu:26.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Installs compilation tools (heavyweight workspace)
RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
cmake \
g++ \
gcc \
gfortran \
git \
make \
libnuma-dev \
libopenblas-dev \
libopenmpi-dev \
libreadline-dev \
libtbb-dev \
libyaml-cpp-dev \
openmpi-bin \
pkg-config \
python3 \
python3-pip \
python3-setuptools \
wget \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /home/tools/bin /home/tools/lib /home/tools/include
WORKDIR /tmp
ENV PATH="/home/tools/bin:${PATH:-}"
ENV LD_LIBRARY_PATH="/home/tools/lib:${LD_LIBRARY_PATH:-}"
ENV PKG_CONFIG_PATH="/home/tools/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
ENV CMAKE_PREFIX_PATH="/home/tools:${CMAKE_PREFIX_PATH:-}"
ENV CPATH="/home/tools/include:${CPATH:-}"
# 1. Compile HDF5
RUN wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.3/src/hdf5-1.12.3.tar.bz2 \
&& tar -xvf hdf5-1.12.3.tar.bz2 \
&& cd hdf5-1.12.3 \
&& CFLAGS="-fPIC -Wno-error=format-security" CPPFLAGS="-fPIC" CC=mpicc CXX=mpicxx ./configure \
--enable-parallel \
--prefix=/home/tools \
--with-zlib \
--disable-shared \
--disable-dependency-tracking \
&& make -j$(nproc) && make install
# 2. Build libxsmm (Compiled ONLY on amd64 hosts, cleanly skipped on ARM)
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then \
git clone --depth=1 --single-branch --branch 1.17 https://github.com/libxsmm/libxsmm \
&& cd libxsmm \
&& make -j$(nproc) generator \
&& cp bin/libxsmm_gemm_generator /home/tools/bin/; \
else \
echo "Skipping libxsmm compilation: target architecture is ARM64 (Apple Silicon). Matrix acceleration will fall back cleanly to PSPaMM."; \
fi
# 3. Build NetCDF
RUN wget --progress=bar:force:noscroll https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz \
&& tar -xvf netcdf-c-4.9.2.tar.gz \
&& cd netcdf-c-4.9.2 \
&& CFLAGS="-fPIC" CC=h5pcc ./configure \
--enable-shared=no \
--prefix=/home/tools \
--disable-dap \
--disable-byterange \
--disable-libxml2 \
&& make -j$(nproc) && make install
# 4. Build ParMETIS
RUN wget --progress=bar:force:noscroll https://deb.debian.org/debian/pool/non-free/p/parmetis/parmetis_4.0.3.orig.tar.gz \
&& tar -xvf parmetis_4.0.3.orig.tar.gz \
&& cd parmetis-4.0.3 \
&& sed -i 's/IDXTYPEWIDTH 32/IDXTYPEWIDTH 64/g' ./metis/include/metis.h \
# Modernize the obsolete CMake version requirement across all internal trees
&& sed -i 's/cmake_minimum_required(VERSION 2.8)/cmake_minimum_required(VERSION 3.5)/g' CMakeLists.txt \
&& sed -i 's/cmake_minimum_required(VERSION 2.8)/cmake_minimum_required(VERSION 3.5)/g' metis/CMakeLists.txt \
# Force the policy bypass engine into the configuration line
&& CC=mpicc CXX=mpicxx make config prefix=/home/tools flags="-DCMAKE_POLICY_VERSION_MINIMUM=3.5" \
&& make -j$(nproc) && make install \
# Use architecture-independent wildcards to handle both x86_64 and aarch64 output trees cleanly
&& cp build/Linux-*/libmetis/libmetis.a /home/tools/lib \
&& cp metis/include/metis.h /home/tools/include
# 5. Build Lua
RUN wget --progress=bar:force:noscroll https://www.lua.org/ftp/lua-5.3.6.tar.gz \
&& tar -xzvf lua-5.3.6.tar.gz \
&& cd lua-5.3.6 && make linux CC=mpicc && make local \
&& cp -r install/* /home/tools && cd ..
# 6. Build Eigen
RUN wget --progress=bar:force:noscroll https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz \
&& tar -xf eigen-3.4.0.tar.gz \
&& cd eigen-3.4.0 && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/home/tools \
&& make -j$(nproc) install
# 7. Build PROJ
RUN git clone --depth 1 --single-branch --branch 4.9.3 https://github.com/OSGeo/PROJ.git \
&& cd PROJ \
# 1. Modernize the root CMake requirements
&& sed -i 's/cmake_minimum_required(VERSION 2.8.11)/cmake_minimum_required(VERSION 3.5)/g' CMakeLists.txt \
# 2. Patch the obsolete link policy to use current standards instead of OLD
&& sed -i 's/cmake_policy(SET CMP0022 OLD)/cmake_policy(SET CMP0022 NEW)/g' cmake/policies.cmake \
&& mkdir build && cd build \
&& CC=mpicc CXX=mpicxx cmake .. \
-DCMAKE_INSTALL_PREFIX=/home/tools \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
&& make -j$(nproc) && make install
# 8. Build ASAGI
RUN git clone --recursive https://github.com/TUM-I5/ASAGI.git \
&& cd ASAGI \
&& mkdir build && cd build \
&& CC=mpicc CXX=mpicxx cmake .. -DCMAKE_INSTALL_PREFIX=/home/tools -DCMAKE_PREFIX_PATH=/home/tools -DSHARED_LIB=off -DSTATIC_LIB=on -DNONUMA=on \
&& make -j$(nproc) && make install
# 9. Build easi
RUN git clone https://github.com/SeisSol/easi \
&& cd easi \
&& mkdir build && cd build \
&& CC=mpicc CXX=mpicxx cmake .. -DEASICUBE=OFF -DLUA=ON -DCMAKE_PREFIX_PATH=/home/tools -DCMAKE_INSTALL_PREFIX=/home/tools -DASAGI=ON -DIMPALAJIT=OFF \
&& make -j$(nproc) && make install
# Install PSpaMM via pip3 securely using system bypass flags
RUN pip3 install --no-cache-dir --break-system-packages numpy \
&& pip3 install --no-cache-dir --break-system-packages git+https://github.com/SeisSol/PSpaMM.git
# 10. Build SeisSol (Adaptive Multi-Architecture Evaluator)
ARG TARGETARCH
RUN git clone --recursive --depth 1 https://github.com/SeisSol/SeisSol.git \
&& cd SeisSol \
&& mkdir build_workspace && cd build_workspace \
&& if [ "$TARGETARCH" = "arm64" ]; then \
GEMM_TOOLS="PSpaMM"; \
HOST_ARCH="neon"; \
else \
GEMM_TOOLS=auto; \
HOST_ARCH="hsw"; \
fi \
&& PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 CC=mpicc CXX=mpicxx cmake .. \
-DCMAKE_PREFIX_PATH=/home/tools \
-DCMAKE_LIBRARY_PATH=/home/tools/lib \
-DCMAKE_INCLUDE_PATH=/home/tools/include \
-DGEMM_TOOLS_LIST="$GEMM_TOOLS" \
-DHOST_ARCH="$HOST_ARCH" \
-DNEW_BINARY_NAMING=ON \
-DASAGI=on -DNETCDF=on -DORDER=4 -DDR_QUAD_RULE_OPTIONS=dunavant \
&& make -j$(nproc) \
&& cmake .. -DEQUATIONS=viscoelastic2 -DNUMBER_OF_MECHANISMS=3 \
&& make -j$(nproc) \
&& cp seissol-* /home/tools/bin
# 11. Build rconv
RUN cd SeisSol/preprocessing/science/rconv \
&& mkdir build && cd build \
&& echo "find_package(HDF5 REQUIRED COMPONENTS C HL)" >> ../CMakeLists.txt \
&& echo "target_link_libraries(SeisSol-rconv PUBLIC \${HDF5_C_HL_LIBRARIES} \${HDF5_C_LIBRARIES})" >> ../CMakeLists.txt \
&& CC=mpicc CXX=mpicxx cmake .. -DCMAKE_INSTALL_PREFIX=/home/tools -DCMAKE_PREFIX_PATH=/home/tools \
&& make -j$(nproc) && cp rconv /home/tools/bin/
# 12. Build PUMGen
RUN git clone --recursive --branch v1.1.0 https://github.com/SeisSol/PUMGen.git \
&& cd PUMGen \
&& mkdir build && cd build \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/home/tools -DCMAKE_PREFIX_PATH=/home/tools -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_BUILD_TYPE=Release \
&& make -j$(nproc) && make install
# ==========================================
# STAGE 1: Final Lightweight Runtime Image
# ==========================================
FROM ubuntu:26.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
gmsh \
python3-gmsh \
python-is-python3 \
libgomp1 \
libnuma1 \
libopenblas-dev \
libopenmpi-dev \
libtbb12 \
libxrender1 \
libyaml-cpp-dev \
openmpi-bin \
python3 \
python3-pip \
tini \
xvfb \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir --break-system-packages \
panel \
ipyvtklink \
vtk \
pyvista \
ipywidgets \
scipy \
pyproj \
matplotlib \
sympy \
pandas
WORKDIR /home
COPY --from="builder" /home/tools tools
ENV PATH="/home/tools/bin:${PATH:-}"
ENV LD_LIBRARY_PATH="/home/tools/lib:${LD_LIBRARY_PATH:-}"
ENV PYTHONPATH="/home/tools/lib:${PYTHONPATH:-}"
ENV OMP_PLACES="cores"
ENV OMP_PROC_BIND="spread"
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
WORKDIR /home/training
COPY tpv13/ tpv13/
COPY sulawesi/ sulawesi/
COPY northridge/ northridge/
COPY kaikoura/ kaikoura/
RUN chmod -R 777 /home/training
VOLUME ["/shared"]
WORKDIR /shared
ENTRYPOINT ["tini", "-s", "-g", "/entrypoint.sh", "--"]