Skip to content

Commit

Permalink
docker: more cleanup and reorga
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Feb 12, 2025
1 parent 1c87881 commit c4f626c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 73 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-bases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
tags:
description: 'Build compiler bases'
schedule:
# Run once a week
# Run once a month
- cron: "0 0 1 * *"

jobs:
Expand All @@ -30,7 +30,7 @@ jobs:
DOCKER_BUILDKIT: "1"
strategy:
matrix:
version: ['', '14']
version: ['11', '14']

steps:
- name: Checkout devito
Expand Down
25 changes: 7 additions & 18 deletions docker/Dockerfile.amd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

ARG ROCM_VERSION=6.3.2

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

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

# Requires cmake > 3.22
RUN mkdir -p /opt/cmake \
Expand All @@ -34,9 +34,6 @@ ENV PATH=$ROCM_HOME/bin:$PATH \
# Until rocm base has it fixed
RUN ln -s /opt/rocm/llvm/bin/offload-arch /opt/rocm/bin/offload-arch | echo "offload-arch already exis"

# Install tmpi
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi

# Install UCX
RUN cd /tmp/ \
&& git clone --depth 1 https://github.com/openucx/ucx.git -b ${UCX_BRANCH} \
Expand Down Expand Up @@ -101,14 +98,6 @@ ENV PATH=$OMPI_HOME/bin:$UCX_HOME/bin:$PATH \
ENV OMPI_ALLOW_RUN_AS_ROOT=1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

##############################################################
# Additional Devito requirements
##############################################################

# Additional utils and python3
RUN apt-get update && \
apt-get install -y dh-autoreconf python3-venv python3-dev python3-pip

RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

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

# MPI env
ENV OMPI_CC="amdclang"
Expand All @@ -134,7 +123,7 @@ ENV DEVITO_LANGUAGE="openmp"
# HIPCC for GPUs (HIP)
########################################################################
# This will only trigger if arch is hip since the final stage depends on it
FROM sdk-base as hip
FROM sdk-base AS hip

# MPI env
ENV OMPI_CC="hipcc"
Expand Down
34 changes: 5 additions & 29 deletions docker/Dockerfile.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# architectures using GCC compilers and OpenMPI.
##############################################################

# Base image
FROM ubuntu:22.04 AS base
ARG gcc="11"

ARG gcc=""
# Base image
FROM gcc:${gcc}-bookworm AS base

ENV DEBIAN_FRONTEND=noninteractive

Expand All @@ -16,32 +16,8 @@ RUN apt-get update && \
apt-get install -y software-properties-common dh-autoreconf python3-venv python3-dev python3-pip

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

# Install compilersx
RUN if [ -n "$gcc" ]; then \
apt-get install libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils texinfo -y && \
cd /tmp && mkdir gcc && \
git clone git://gcc.gnu.org/git/gcc.git gcc && \
cd gcc && git checkout releases/gcc-${gcc} && \
mkdir build && cd build && \
../configure --prefix=/opt/gcc-${gcc} --enable-languages=c,c++,fortran --disable-multilib \
--enable-shared --enable-lto --enable-threads=posix --enable-libstdcxx-time=yes --enable-libgomp && \
make -j $(nproc) && make install-strip && \
# Update alternatives
update-alternatives --install /usr/bin/gcc gcc /opt/gcc-${gcc}/bin/gcc 60 && \
update-alternatives --install /usr/bin/g++ g++ /opt/gcc-${gcc}/bin/g++ 60 && \
update-alternatives --install /usr/bin/gfortran gfortran /opt/gcc-${gcc}/bin/gfortran 60 && \
rm -rf /tmp/gcc; \
fi;

# Install tmpi
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi

# Install OpenGL library, necessary for the installation of GemPy
RUN apt-get install -y libgl1-mesa-glx && \
RUN apt-get install -y wget flex libnuma-dev hwloc curl cmake \
autoconf libtool build-essential procps software-properties-common && \
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

Expand Down
14 changes: 10 additions & 4 deletions docker/Dockerfile.devito
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Base image with compilers
ARG base=devitocodes/bases:cpu-gcc

FROM $base as builder
FROM $base AS builder

# User/Group Ids
ARG USER_ID=1000
Expand Down Expand Up @@ -41,17 +41,23 @@ RUN /venv/bin/pip install --no-cache-dir -e /app/devito[extras,tests] && rm -rf

FROM $base AS utilities

# tmpi
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi

# Update if outdated and install extras
RUN apt-get update && apt-get install -y git cmake \
RUN apt-get update && apt-get install -y git \
libncurses5-dev libncursesw5-dev libdrm-dev libsystemd-dev \
python3-gdb gdb
python3-dbg gdb numactl tmux vim git

# Install OpenGL library, necessary for the installation of GemPy
RUN apt-get install -y libgl1-mesa-glx

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

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

Expand Down
17 changes: 5 additions & 12 deletions docker/Dockerfile.intel
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,16 @@ RUN apt-get update && \
apt-get install -y dh-autoreconf python3-venv python3-dev python3-pip

# Install for basic base not containing it
RUN apt-get install -y vim wget git flex libnuma-dev tmux \
numactl hwloc curl \
RUN apt-get install -y wget flex libnuma-dev hwloc curl cmake \
autoconf libtool build-essential procps

# Install tmpi
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi

# Install OpenGL library, necessary for the installation of GemPy
RUN apt-get install -y libgl1-mesa-glx

EXPOSE 8888
CMD ["/bin/bash"]

##############################################################
# Intel OneAPI standard image
##############################################################
FROM base as oneapi
FROM base AS oneapi

# Download the key to system keyring
# 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
Expand Down Expand Up @@ -67,7 +60,7 @@ RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && rm -rf /var/l
# ICC image
# This is a legacy setup that is not built anymore but kept for reference
##############################################################
FROM oneapi as icc
FROM oneapi AS icc

RUN apt-get update -y && apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-mpi-devel && \
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
Expand All @@ -85,7 +78,7 @@ ENV MPICC=mpiicc
##############################################################
# ICX OpenMP image
##############################################################
FROM oneapi as icx
FROM oneapi AS icx

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

# Devito config
ENV DEVITO_ARCH="sycl"
Expand Down
13 changes: 5 additions & 8 deletions docker/Dockerfile.nvidia
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@ ARG arch="nvc"
########################################################################
# Build base image with apt setup and common env
########################################################################
FROM ubuntu:22.04 as sdk-base
FROM ubuntu:22.04 AS sdk-base

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

ENV DEBIAN_FRONTEND noninteractive

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

# nodesource: nvdashboard requires nodejs>=10
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
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
RUN apt-key update *&& apt-get update -y

# Install tmpi
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi

# Install nvhpc. `nvhpc` is the alias for the latest avaialble version
ARG ver=nvhpc
# We use the standard apt-get for the default latest nvhpc. For earlier version, apt has a bug that it will always
Expand Down Expand Up @@ -133,7 +130,7 @@ CMD ["/bin/bash"]
########################################################################
# NVC for GPUs via OpenACC config
########################################################################
FROM sdk-base as nvc
FROM sdk-base AS nvc

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

ENV DEVITO_ARCH="cuda"
ENV DEVITO_PLATFORM="nvidiaX"
Expand All @@ -157,7 +154,7 @@ ENV DEVITO_LANGUAGE="cuda"
########################################################################
# NVC for CPUs config
########################################################################
FROM nvc as nvc-host
FROM nvc AS nvc-host

ENV DEVITO_ARCH="nvc"
ENV DEVITO_PLATFORM="cpu64"
Expand Down

0 comments on commit c4f626c

Please sign in to comment.