Skip to content

Commit

Permalink
deps: add hpc oneapi image
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Nov 1, 2023
1 parent b7e3872 commit 956570b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 26 deletions.
12 changes: 6 additions & 6 deletions devito/arch/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def __init__(self, *args, **kwargs):
self.cflags.append("-qopt-zmm-usage=high")

if language == 'openmp':
self.cflags.append('-fiopenmp')
self.ldflags.append('-qopenmp')

# Make sure the MPI compiler uses `icc` underneath -- whatever the MPI distro is
if kwargs.get('mpi'):
Expand Down Expand Up @@ -792,8 +792,8 @@ def __init__(self, *args, **kwargs):

# Earlier versions to OneAPI 2023.2.0 (clang17 underneath), have an OpenMP bug
if self.version < Version('17.0.0') and language == 'openmp':
self.cflags.remove('-fiopenmp')
self.cflags.append('-fopenmp')
self.ldflags.remove('-qopenmp')
self.ldflags.append('-fopenmp')

if language == 'sycl':
self.cflags.append('-fsycl')
Expand All @@ -805,10 +805,10 @@ def __init__(self, *args, **kwargs):
if platform is NVIDIAX:
self.cflags.append('-fopenmp-targets=nvptx64-cuda')
if platform in [INTELGPUX, PVC]:
self.cflags.append('-fopenmp-targets=spir64')
self.cflags.append('-fopenmp-target-simd')
self.ldflags.append('-fiopenmp')
self.ldflags.append('-fopenmp-targets=spir64')
self.ldflags.append('-fopenmp-target-simd')

if platform is INTELGPUX:
self.cflags.remove('-g') # -g disables some optimizations in IGC
self.cflags.append('-gline-tables-only')
self.cflags.append('-fdebug-info-for-profiling')
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.amd
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
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 && \
RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

EXPOSE 8888
Expand Down
60 changes: 46 additions & 14 deletions docker/Dockerfile.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
# This Dockerfile contains the Devito codes and can be built using different base images.
##############################################################

ARG pyversion=python:3.9
ARG arch=gcc
ARG OMPI_BRANCH="v4.1.4"

# Base image
FROM ${pyversion}-slim-bullseye as base
FROM ubuntu:22.04 as base

ENV DEBIAN_FRONTEND noninteractive

# Install for basic base not containing it
# Install python
RUN apt-get update && \
apt-get install -y vim wget git flex libnuma-dev tmux \
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 \
autoconf libtool build-essential procps

Expand All @@ -24,7 +26,7 @@ RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/l
# Install OpenGL library, necessary for the installation of GemPy
RUN apt-get install -y libgl1-mesa-glx

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

EXPOSE 8888
Expand Down Expand Up @@ -65,16 +67,20 @@ FROM base as oneapi
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list

# Drivers mandatory for intel gpus
RUN curl -fsSL https://repositories.intel.com/graphics/intel-graphics.key | apt-key add -
RUN echo "deb [trusted=yes arch=amd64] https://repositories.intel.com/graphics/ubuntu all main" > /etc/apt/sources.list.d/intel-graphics.list

# Intel advisor and drivers
RUN apt-get update -y && \
# advisor
apt-get install -y intel-oneapi-advisor && \
# drivers
apt-get install -y intel-opencl-icd intel-level-zero-gpu level-zero level-zero-dev
apt-get install -y intel-oneapi-advisor

# Drivers mandatory for intel gpu
# https://dgpu-docs.intel.com/installation-guides/ubuntu/ubuntu-focal.html#ubuntu-20-04-focal
RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor > /usr/share/keyrings/intel-graphics.gpg
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu focal main" > /etc/apt/sources.list.d/intel.list

RUN apt-get update -y && apt-get dist-upgrade -y && \
apt-get install -y intel-opencl-icd intel-level-zero-gpu level-zero level-zero-dev \
intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2 \
libigc-dev intel-igc-cm libigdfcl-dev libigfxcmrt-dev level-zero-dev

##############################################################
# ICC image
Expand All @@ -83,7 +89,7 @@ RUN apt-get update -y && \
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 && \
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

# Devito config
Expand All @@ -99,7 +105,7 @@ ENV MPI4PY_FLAGS='. /opt/intel/oneapi/setvars.sh && CFLAGS="-cc=icc"'
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 && \
apt-get clean && apt-get autoclean && apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

# Devito config
Expand All @@ -108,3 +114,29 @@ ENV DEVITO_LANGUAGE="openmp"
# MPICC compiler for mpi4py
ENV MPICC=mpiicc
ENV MPI4PY_FLAGS='. /opt/intel/oneapi/setvars.sh && CFLAGS="-cc=icx"'

##############################################################
# ICX hpc image
##############################################################
FROM oneapi as icx-hpc

# Install both icc and icx to avoid missing dependencies
RUN apt-get update -y && \
apt-get install -y intel-oneapi-compiler-dpcpp-cpp intel-oneapi-mpi-devel && \
apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic

# Missig components
# https://www.intel.com/content/www/us/en/developer/tools/oneapi/hpc-toolkit-download.html?operatingsystem=linux&distributions=aptpackagemanager
RUN curl -f "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/ebf5d9aa-17a7-46a4-b5df-ace004227c0e/l_dpcpp-cpp-compiler_p_2023.2.1.8.sh" -O && \
chmod +x l_dpcpp-cpp-compiler_p_2023.2.1.8.sh && ./l_dpcpp-cpp-compiler_p_2023.2.1.8.sh -a -s --eula accept && \
rm l_dpcpp-cpp-compiler_p_2023.2.1.8.sh

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

# Devito config
ENV DEVITO_ARCH="icx"
ENV DEVITO_LANGUAGE="openmp"
# MPICC compiler for mpi4py
ENV MPICC=mpiicc
ENV MPI4PY_FLAGS='. /opt/intel/oneapi/setvars.sh && CFLAGS="-cc=icx"'
7 changes: 5 additions & 2 deletions docker/Dockerfile.devito
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ ARG GROUP_ID=1000
# Copy Devito
ADD . /app/devito

# Update if outdated
RUN apt-get update && apt-get upgrade -y

# Remove git files
RUN rm -rf /app/devito/.git

Expand All @@ -29,7 +32,7 @@ RUN python3 -m venv /venv && \

# Usefull utilities
# Nvtop
RUN apt update && apt install -y git cmake libncurses5-dev libncursesw5-dev libdrm-dev libsystemd-dev cmake && \
RUN apt-get install -y git cmake libncurses5-dev libncursesw5-dev libdrm-dev libsystemd-dev cmake && \
git clone https://github.com/Syllo/nvtop.git /app/nvtop && \
mkdir -p /app/nvtop/build && cd /app/nvtop/build && \
cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON -DINTEL_SUPPORT=ON && \
Expand All @@ -38,7 +41,7 @@ RUN apt update && apt install -y git cmake libncurses5-dev libncursesw5-dev libd
ln -fs /app/nvtop/build/src/nvtop /venv/bin/nvtop

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

FROM $base as user
Expand Down
9 changes: 6 additions & 3 deletions docker/Dockerfile.nvidia
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
# This Dockerfile contains the NVidia HPC SDK (nvc, cuda, OpenMPI) for Devito
##############################################################
ARG ver
ARG pyversion=python:3.9
ARG arch="nvc"

########################################################################
# Build base image with apt setup and common env
########################################################################
FROM ${pyversion}-slim-bullseye as sdk-base
FROM ubuntu:22.04 as sdk-base

ENV DEBIAN_FRONTEND noninteractive

# Install python
RUN apt-get update && \
apt-get install -y dh-autoreconf python3-venv python3-dev python3-pip

RUN apt-get update -y && \
apt-get install -y -q gpg apt-utils curl wget vim libnuma-dev tmux numactl

Expand Down Expand Up @@ -131,7 +134,7 @@ RUN python3 -m venv /venv && \
/venv/bin/jupyter serverextension enable dask_labextension && \
rm -rf ~/.cache/pip

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

EXPOSE 8888
Expand Down

0 comments on commit 956570b

Please sign in to comment.