diff --git a/devito/arch/compiler.py b/devito/arch/compiler.py index edb7bbe8327..8d9babbb5d7 100644 --- a/devito/arch/compiler.py +++ b/devito/arch/compiler.py @@ -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'): @@ -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') @@ -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') diff --git a/docker/Dockerfile.amd b/docker/Dockerfile.amd index 629054fd305..bdcc1c5a269 100644 --- a/docker/Dockerfile.amd +++ b/docker/Dockerfile.amd @@ -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 diff --git a/docker/Dockerfile.cpu b/docker/Dockerfile.cpu index 5f9762a3354..238ab4ff5e0 100644 --- a/docker/Dockerfile.cpu +++ b/docker/Dockerfile.cpu @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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"' \ No newline at end of file diff --git a/docker/Dockerfile.devito b/docker/Dockerfile.devito index 9c5578844e9..703964e45e6 100644 --- a/docker/Dockerfile.devito +++ b/docker/Dockerfile.devito @@ -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 @@ -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 && \ @@ -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 diff --git a/docker/Dockerfile.nvidia b/docker/Dockerfile.nvidia index 8b0086a8ca7..c2d6d074a5e 100644 --- a/docker/Dockerfile.nvidia +++ b/docker/Dockerfile.nvidia @@ -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 @@ -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