Skip to content

Commit

Permalink
misc: Split Dockerfile.cpu into .cpu and .intel
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioLuporini committed Dec 19, 2023
1 parent cff2c7a commit 213d3a6
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 115 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/docker-bases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- '/docker/Dockerfile.nvidia'
- '/docker/Dockerfile.cpu'
- '/docker/Dockerfile.amd'
- '/docker/Dockerfile.intel'
workflow_dispatch:
inputs:
tags:
Expand Down Expand Up @@ -95,7 +96,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.cpu'
file: './docker/Dockerfile.intel'
push: true
target: 'icx'
build-args: 'arch=icx'
Expand All @@ -105,7 +106,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.cpu'
file: './docker/Dockerfile.intel'
push: true
target: 'cpu-sycl'
build-args: 'arch=cpu-sycl'
Expand All @@ -115,7 +116,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.cpu'
file: './docker/Dockerfile.intel'
push: true
target: 'gpu-sycl'
build-args: 'arch=gpu-sycl'
Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile.amd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
##############################################################

ARG ROCM_VERSION=5.5.1
ARG arch="aomp"

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

Expand Down
112 changes: 2 additions & 110 deletions docker/Dockerfile.cpu
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# syntax=docker/dockerfile:1
##############################################################
# This Dockerfile contains the Devito codes and can be built using different base images.
# This Dockerfile builds a base image to run Devito on generic CPU
# architectures using GCC compilers and OpenMPI.
##############################################################

ARG arch=gcc
ARG OMPI_BRANCH="v4.1.4"

# Base image
Expand Down Expand Up @@ -56,111 +56,3 @@ ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/openmpi/lib
# Env vars defaults
ENV DEVITO_ARCH="gcc"
ENV DEVITO_LANGUAGE="openmp"

##############################################################
# Intel Oneapi base
##############################################################
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
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

# Intel advisor and drivers
RUN apt-get update -y && \
# advisor
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
# This is a legacy setup that is not built anymore but kept for reference
##############################################################
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 && \
rm -rf /var/lib/apt/lists/*

# Devito config
ENV DEVITO_ARCH="icc"
ENV DEVITO_LANGUAGE="openmp"
ENV DEVITO_PLATFORM="intel64"
# MPICC compiler for mpi4py
ENV MPICC=mpiicc
ENV MPI4PY_FLAGS='. /opt/intel/oneapi/setvars.sh && CFLAGS="-cc=icc"'

##############################################################
# ICX image
##############################################################
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 && \
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"'

##############################################################
# 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"'

##############################################################
# ICX SYCL CPU image
##############################################################
FROM icx as cpu-sycl

# Devito config
ENV DEVITO_ARCH="sycl"
ENV DEVITO_LANGUAGE="sycl"
ENV DEVITO_PLATFORM="intel64"

##############################################################
# ICX SYCL GPU image
##############################################################
FROM icx as gpu-sycl

# NOTE: the name of this file ends with ".cpu" but this is a GPU image.
# It then feels a bit akward, so some restructuring might be needed

# Devito config
ENV DEVITO_ARCH="sycl"
ENV DEVITO_LANGUAGE="sycl"
ENV DEVITO_PLATFORM="intelgpuX"
2 changes: 1 addition & 1 deletion docker/Dockerfile.devito
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##############################################################
# This Dockerfile contains the Devito codes and can be built using different base images.
# This Dockerfile contains Devito and can be built using different base images.
##############################################################

# Base image with compilers
Expand Down
109 changes: 109 additions & 0 deletions docker/Dockerfile.intel
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# syntax=docker/dockerfile:1
##############################################################
# This Dockerfile contains the Intel OneAPI toolkit for Devito
##############################################################

# Base image
FROM ubuntu:22.04 as base

ENV DEBIAN_FRONTEND noninteractive

# Install python
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 \
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

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

EXPOSE 8888
CMD ["/bin/bash"]

##############################################################
# Intel OneAPI standard image
##############################################################
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
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

# Intel advisor and drivers
RUN apt-get update -y && \
# advisor
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
# This is a legacy setup that is not built anymore but kept for reference
##############################################################
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 && \
rm -rf /var/lib/apt/lists/*

# Devito config
ENV DEVITO_ARCH="icc"
ENV DEVITO_LANGUAGE="openmp"
ENV DEVITO_PLATFORM="intel64"
# MPICC compiler for mpi4py
ENV MPICC=mpiicc
ENV MPI4PY_FLAGS='. /opt/intel/oneapi/setvars.sh && CFLAGS="-cc=icc"'

##############################################################
# ICX OpenMP image
##############################################################
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 && \
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"'

##############################################################
# ICX SYCL CPU image
##############################################################
FROM icx as cpu-sycl

# Devito config
ENV DEVITO_ARCH="sycl"
ENV DEVITO_LANGUAGE="sycl"
ENV DEVITO_PLATFORM="intel64"

##############################################################
# ICX SYCL GPU image
##############################################################
FROM icx as gpu-sycl

# Devito config
ENV DEVITO_ARCH="sycl"
ENV DEVITO_LANGUAGE="sycl"
ENV DEVITO_PLATFORM="intelgpuX"

0 comments on commit 213d3a6

Please sign in to comment.