Skip to content

Commit a84d5cc

Browse files
committed
docker: more cleanup and reorga
1 parent 1c87881 commit a84d5cc

8 files changed

+70
-77
lines changed

.github/workflows/docker-bases.yml

+23-5
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,39 @@ on:
1313
- '/docker/Dockerfile.intel'
1414
workflow_dispatch:
1515
inputs:
16+
cpu:
17+
type: boolean
18+
default: false
19+
nvidia:
20+
type: boolean
21+
default: false
22+
amd:
23+
type: boolean
24+
default: false
25+
intel:
26+
type: boolean
27+
default: false
28+
1629
tags:
1730
description: 'Build compiler bases'
1831
schedule:
19-
# Run once a week
32+
# Run once a month
2033
- cron: "0 0 1 * *"
2134

2235
jobs:
2336
#######################################################
2437
############## Basic gcc CPU ##########################
2538
#######################################################
2639
deploy-cpu-bases:
40+
if: inputs.cpu
2741
name: "cpu-base"
2842
runs-on: ubuntu-latest
2943
env:
3044
DOCKER_BUILDKIT: "1"
45+
3146
strategy:
32-
matrix:
33-
version: ['', '14']
47+
matrix:
48+
gcc: ["", "14"]
3449

3550
steps:
3651
- name: Checkout devito
@@ -60,14 +75,15 @@ jobs:
6075
context: .
6176
file: './docker/Dockerfile.cpu'
6277
push: true
63-
build-args: 'gcc=${{ matrix.version }}'
64-
tags: 'devitocodes/bases:cpu-gcc${{ matrix.version }}'
78+
build-args: 'gcc=${{ matrix.gcc }}'
79+
tags: 'devitocodes/bases:cpu-gcc${{ matrix.gcc }}'
6580

6681

6782
#######################################################
6883
############## Intel OneApi CPU #######################
6984
#######################################################
7085
deploy-oneapi-bases:
86+
if: inputs.intel
7187
name: "oneapi-base"
7288
runs-on: ubuntu-latest
7389
env:
@@ -129,6 +145,7 @@ jobs:
129145
################### Nvidia nvhpc ######################
130146
#######################################################
131147
deploy-nvidia-bases:
148+
if: inputs.nvidia
132149
name: "nvidia-bases"
133150
runs-on: ["self-hosted", "nvidiagpu"]
134151
env:
@@ -190,6 +207,7 @@ jobs:
190207
##################### AMD #############################
191208
#######################################################
192209
deploy-amd-bases:
210+
if: inputs.amd
193211
name: "amd-base"
194212
runs-on: ["self-hosted", "amdgpu"]
195213
env:

.github/workflows/tutorials.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
- name: Build docker image
7171
if: "contains(matrix.name, 'docker')"
7272
run: |
73-
docker build . --file docker/Dockerfile.devito --tag devito_img
73+
docker build . --pull --file docker/Dockerfile.devito --tag devito_img
7474
7575
- name: Set run prefix
7676
run: |

docker/Dockerfile.amd

+8-23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
ARG ROCM_VERSION=6.3.2
77

8-
FROM rocm/dev-ubuntu-22.04:${ROCM_VERSION}-complete as sdk-base
8+
FROM rocm/dev-ubuntu-22.04:${ROCM_VERSION}-complete AS sdk-base
99

1010
ARG UCX_BRANCH="v1.16.0"
1111
ARG OMPI_BRANCH="v5.0.x"
@@ -14,16 +14,12 @@ ARG OMPI_BRANCH="v5.0.x"
1414
RUN rm /etc/apt/sources.list.d/* \
1515
&& apt-get update \
1616
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
17-
ca-certificates git ssh make vim libtinfo* initramfs-tools libelf-dev \
18-
numactl wget tmux build-essential autoconf automake libtool \
19-
pkg-config libnuma* gfortran flex hwloc && \
20-
apt-get clean
17+
dh-autoreconf python3-venv python3-dev python3-pip git \
18+
ca-certificates ssh make libtinfo* initramfs-tools libelf-dev \
19+
wget build-essential autoconf automake libtool \
20+
pkg-config libnuma* gfortran flex hwloc cmake
2121

22-
# Requires cmake > 3.22
23-
RUN mkdir -p /opt/cmake \
24-
&& wget --no-check-certificate --quiet -O - https://cmake.org/files/v3.22/cmake-3.22.2-linux-x86_64.tar.gz | tar --strip-components=1 -xz -C /opt/cmake
25-
26-
ENV ROCM_HOME=/opt/rocm \
22+
ENV ROCM_HOME=/opt/rocm\
2723
UCX_HOME=/opt/ucx \
2824
OMPI_HOME=/opt/ompi
2925

@@ -34,9 +30,6 @@ ENV PATH=$ROCM_HOME/bin:$PATH \
3430
# Until rocm base has it fixed
3531
RUN ln -s /opt/rocm/llvm/bin/offload-arch /opt/rocm/bin/offload-arch | echo "offload-arch already exis"
3632

37-
# Install tmpi
38-
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi
39-
4033
# Install UCX
4134
RUN cd /tmp/ \
4235
&& git clone --depth 1 https://github.com/openucx/ucx.git -b ${UCX_BRANCH} \
@@ -101,14 +94,6 @@ ENV PATH=$OMPI_HOME/bin:$UCX_HOME/bin:$PATH \
10194
ENV OMPI_ALLOW_RUN_AS_ROOT=1
10295
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
10396

104-
##############################################################
105-
# Additional Devito requirements
106-
##############################################################
107-
108-
# Additional utils and python3
109-
RUN apt-get update && \
110-
apt-get install -y dh-autoreconf python3-venv python3-dev python3-pip
111-
11297
RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && \
11398
rm -rf /var/lib/apt/lists/*
11499

@@ -119,7 +104,7 @@ CMD ["/bin/bash"]
119104
# AOMP for GPUs (OpenMP offloading)
120105
########################################################################
121106
# This will only trigger if arch is aomp since the final stage depends on it
122-
FROM sdk-base as amdclang
107+
FROM sdk-base AS amdclang
123108

124109
# MPI env
125110
ENV OMPI_CC="amdclang"
@@ -134,7 +119,7 @@ ENV DEVITO_LANGUAGE="openmp"
134119
# HIPCC for GPUs (HIP)
135120
########################################################################
136121
# This will only trigger if arch is hip since the final stage depends on it
137-
FROM sdk-base as hip
122+
FROM sdk-base AS hip
138123

139124
# MPI env
140125
ENV OMPI_CC="hipcc"

docker/Dockerfile.cpu

+6-12
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,18 @@ RUN apt-get update && \
1616
apt-get install -y software-properties-common dh-autoreconf python3-venv python3-dev python3-pip
1717

1818
# Install for basic base not containing it
19-
RUN apt-get install -y vim wget git flex libnuma-dev tmux \
20-
numactl hwloc curl \
19+
RUN apt-get install -y wget flex libnuma-dev hwloc curl cmake git \
2120
autoconf libtool build-essential procps software-properties-common
2221

23-
# Install compilersx
22+
# Install gcc
2423
RUN if [ -n "$gcc" ]; then \
2524
apt-get install libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils texinfo -y && \
2625
cd /tmp && mkdir gcc && \
2726
git clone git://gcc.gnu.org/git/gcc.git gcc && \
2827
cd gcc && git checkout releases/gcc-${gcc} && \
2928
mkdir build && cd build && \
3029
../configure --prefix=/opt/gcc-${gcc} --enable-languages=c,c++,fortran --disable-multilib \
31-
--enable-shared --enable-lto --enable-threads=posix --enable-libstdcxx-time=yes --enable-libgomp && \
30+
--enable-shared --enable-lto --enable-libstdcxx-time=yes --enable-libgomp && \
3231
make -j $(nproc) && make install-strip && \
3332
# Update alternatives
3433
update-alternatives --install /usr/bin/gcc gcc /opt/gcc-${gcc}/bin/gcc 60 && \
@@ -37,14 +36,6 @@ RUN if [ -n "$gcc" ]; then \
3736
rm -rf /tmp/gcc; \
3837
fi;
3938

40-
# Install tmpi
41-
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi
42-
43-
# Install OpenGL library, necessary for the installation of GemPy
44-
RUN apt-get install -y libgl1-mesa-glx && \
45-
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
46-
rm -rf /var/lib/apt/lists/*
47-
4839
ARG OMPI_BRANCH="v5.0.x"
4940
# Install OpenMPI
5041
RUN cd /tmp && mkdir openmpi && \
@@ -62,6 +53,9 @@ RUN cd /tmp && mkdir openmpi && \
6253
ENV PATH=${PATH}:/opt/openmpi/bin
6354
ENV LD_LIBRARY_PATH=/opt/openmpi/lib
6455

56+
# Cleanup
57+
RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
58+
6559
EXPOSE 8888
6660
CMD ["/bin/bash"]
6761

docker/Dockerfile.devito

+20-14
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@
55
# Base image with compilers
66
ARG base=devitocodes/bases:cpu-gcc
77

8-
FROM $base as builder
8+
FROM $base AS builder
99

1010
# User/Group Ids
1111
ARG USER_ID=1000
1212
ARG GROUP_ID=1000
1313

1414
################## Install devito ############################################
1515

16-
# Usefull utilities
17-
# Nvtop
18-
RUN git clone https://github.com/Syllo/nvtop.git /app/nvtop && \
19-
mkdir -p /app/nvtop/build && cd /app/nvtop/build && \
20-
cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON -DINTEL_SUPPORT=ON && \
21-
make && make install
22-
2316
# Install pip dependencies
2417
RUN python3 -m venv /venv && \
2518
/venv/bin/pip install --no-cache-dir --upgrade pip && \
@@ -41,17 +34,29 @@ RUN /venv/bin/pip install --no-cache-dir -e /app/devito[extras,tests] && rm -rf
4134

4235
FROM $base AS utilities
4336

37+
# tmpi
38+
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi
39+
4440
# Update if outdated and install extras
45-
RUN apt-get update && apt-get install -y git cmake \
41+
RUN apt-get update && apt-get install -y \
4642
libncurses5-dev libncursesw5-dev libdrm-dev libsystemd-dev \
47-
python3-gdb gdb
43+
python3-dbg gdb numactl tmux vim
44+
45+
# Install OpenGL library, necessary for the installation of GemPy
46+
RUN apt-get install -y libgl1-mesa-glx
47+
48+
# Nvtop
49+
RUN export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH && \
50+
git clone https://github.com/Syllo/nvtop.git /app/nvtop && \
51+
mkdir -p /app/nvtop/build && cd /app/nvtop/build && \
52+
cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON -DINTEL_SUPPORT=ON && \
53+
make && make install
4854

49-
# Last installs (such as gdb needed in user mode) and cleanup
50-
RUN apt-get update && apt install gdb -y && \
51-
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
55+
# cleanup
56+
RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && \
5257
rm -rf /var/lib/apt/lists/*
5358

54-
FROM utilities as user
59+
FROM utilities AS user
5560
# COPY is much faster than RUN chown by order of magnitude so we have a final step that
5661
# just copies the built image into the user.
5762

@@ -73,6 +78,7 @@ RUN groupadd -g ${GROUP_ID} app && \
7378
chown -R app:app $APP_HOME
7479

7580
COPY --from=builder --chown=app:app /app /app
81+
COPY --from=utilities --chown=app:app /app/nvtop /app/nvtop
7682

7783
ADD --chown=app:app docker/run-jupyter.sh /jupyter
7884
ADD --chown=app:app docker/run-tests.sh /tests

docker/Dockerfile.intel

+6-13
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,16 @@ RUN apt-get update && \
1313
apt-get install -y dh-autoreconf python3-venv python3-dev python3-pip
1414

1515
# Install for basic base not containing it
16-
RUN apt-get install -y vim wget git flex libnuma-dev tmux \
17-
numactl hwloc curl \
18-
autoconf libtool build-essential procps
19-
20-
# Install tmpi
21-
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi
22-
23-
# Install OpenGL library, necessary for the installation of GemPy
24-
RUN apt-get install -y libgl1-mesa-glx
16+
RUN apt-get install -y wget flex libnuma-dev hwloc curl cmake \
17+
autoconf libtool build-essential procps git
2518

2619
EXPOSE 8888
2720
CMD ["/bin/bash"]
2821

2922
##############################################################
3023
# Intel OneAPI standard image
3124
##############################################################
32-
FROM base as oneapi
25+
FROM base AS oneapi
3326

3427
# Download the key to system keyring
3528
# https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html#apt
@@ -67,7 +60,7 @@ RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && rm -rf /var/l
6760
# ICC image
6861
# This is a legacy setup that is not built anymore but kept for reference
6962
##############################################################
70-
FROM oneapi as icc
63+
FROM oneapi AS icc
7164

7265
RUN apt-get update -y && apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-mpi-devel && \
7366
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
@@ -85,7 +78,7 @@ ENV MPICC=mpiicc
8578
##############################################################
8679
# ICX OpenMP image
8780
##############################################################
88-
FROM oneapi as icx
81+
FROM oneapi AS icx
8982

9083
RUN apt-get update -y && apt-get install -y intel-oneapi-compiler-dpcpp-cpp intel-oneapi-mpi-devel && \
9184
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
@@ -102,7 +95,7 @@ ENV MPICC=mpiicc
10295
##############################################################
10396
# ICX SYCL CPU image
10497
##############################################################
105-
FROM icx as cpu-sycl
98+
FROM icx AS cpu-sycl
10699

107100
# Devito config
108101
ENV DEVITO_ARCH="sycl"

docker/Dockerfile.nvidia

+5-8
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,22 @@ ARG arch="nvc"
77
########################################################################
88
# Build base image with apt setup and common env
99
########################################################################
10-
FROM ubuntu:22.04 as sdk-base
10+
FROM ubuntu:22.04 AS sdk-base
1111

1212
SHELL ["/bin/bash", "-c"]
1313

1414
ENV DEBIAN_FRONTEND noninteractive
1515

1616
# Install python
1717
RUN apt-get update && \
18-
apt-get install -y -q gpg apt-utils curl wget vim libnuma-dev tmux numactl \
18+
apt-get install -y -q gpg apt-utils curl wget libnuma-dev cmake git \
1919
dh-autoreconf python3-venv python3-dev python3-pip
2020

2121
# nodesource: nvdashboard requires nodejs>=10
2222
RUN curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | gpg --yes --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
2323
RUN echo 'deb [trusted=yes, signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | tee /etc/apt/sources.list.d/nvhpc.list
2424
RUN apt-key update *&& apt-get update -y
2525

26-
# Install tmpi
27-
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi
28-
2926
# Install nvhpc. `nvhpc` is the alias for the latest avaialble version
3027
ARG ver=nvhpc
3128
# We use the standard apt-get for the default latest nvhpc. For earlier version, apt has a bug that it will always
@@ -133,7 +130,7 @@ CMD ["/bin/bash"]
133130
########################################################################
134131
# NVC for GPUs via OpenACC config
135132
########################################################################
136-
FROM sdk-base as nvc
133+
FROM sdk-base AS nvc
137134

138135
# Make devito env vars file and extras
139136
ADD docker/nvdashboard.json /app/nvdashboard.json
@@ -148,7 +145,7 @@ ENV DEVITO_LANGUAGE="openacc"
148145
########################################################################
149146
# NVC for GPUs via CUDA config
150147
########################################################################
151-
FROM nvc as nvcc
148+
FROM nvc AS nvcc
152149

153150
ENV DEVITO_ARCH="cuda"
154151
ENV DEVITO_PLATFORM="nvidiaX"
@@ -157,7 +154,7 @@ ENV DEVITO_LANGUAGE="cuda"
157154
########################################################################
158155
# NVC for CPUs config
159156
########################################################################
160-
FROM nvc as nvc-host
157+
FROM nvc AS nvc-host
161158

162159
ENV DEVITO_ARCH="nvc"
163160
ENV DEVITO_PLATFORM="cpu64"

requirements-testing.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ codecov
55
flake8>=2.1.0
66
nbval
77
scipy
8-
pooch; python_version >= "3.8"
8+
pooch

0 commit comments

Comments
 (0)