Skip to content

Commit

Permalink
docker: add some tweaks from Ken
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jul 28, 2023
1 parent 44ee680 commit 36c6715
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 67 deletions.
43 changes: 1 addition & 42 deletions .github/workflows/docker-bases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,47 +162,6 @@ jobs:
build-args: 'arch=nvc-host'
tags: 'devitocodes/bases:cpu-nvc'

#######################################################
################### Nvidia clang ######################
#######################################################
deploy-nvidia-clang-base:
name: "nvidia-clang-base"
runs-on: ["self-hosted", "nvidiagpu"]
env:
DOCKER_BUILDKIT: "1"

steps:
- name: Checkout devito
uses: actions/checkout@v3

- name: Check event name
run: echo ${{ github.event_name }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: cleanup
run: docker system prune -a -f

- name: Nvidia clang image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.nvidia'
push: true
target: 'clang'
build-args: 'arch=clang'
tags: 'devitocodes/bases:nvidia-clang'

#######################################################
##################### AMD #############################
#######################################################
Expand Down Expand Up @@ -252,4 +211,4 @@ jobs:
target: 'hip'
build-args: |
arch=hip
tags: devitocodes/bases:amd-hip
tags: devitocodes/bases:amd-hip
6 changes: 3 additions & 3 deletions .github/workflows/docker-devito.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
test: 'tests/test_gpu_openacc.py tests/test_gpu_common.py'
runner: ["self-hosted", "nvidiagpu"]

- base: 'bases:nvidia-clang'
tag: 'nvidia-clang'
flag: '--gpus all'
- base: 'bases:nvidia-nvc'
tag: 'nvidia-nvc-omp'
flag: '--gpus all --env DEVITO_LABGUAGE=openmp'
test: 'tests/test_gpu_openmp.py tests/test_gpu_common.py'
runner: ["self-hosted", "nvidiagpu"]

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pytest-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ jobs:
test_examples: ["examples/seismic/tti/tti_example.py examples/seismic/acoustic/acoustic_example.py examples/seismic/viscoacoustic/viscoacoustic_example.py examples/seismic/viscoelastic/viscoelastic_example.py examples/seismic/elastic/elastic_example.py"]

include:
- name: pytest-gpu-omp-nvidia
test_files: "tests/test_adjoint.py tests/test_gpu_common.py tests/test_gpu_openmp.py"
base: "devitocodes/bases:nvidia-clang"
tags: ["self-hosted", "nvidiagpu"]
test_drive_cmd: "nvidia-smi"
flags: '--gpus all --rm --name testrun-clang-nvidia'

- name: pytest-gpu-acc-nvidia
test_files: "tests/test_adjoint.py tests/test_gpu_common.py tests/test_gpu_openacc.py"
base: "devitocodes/bases:nvidia-nvc"
tags: ["self-hosted", "nvidiagpu"]
test_drive_cmd: "nvidia-smi"
flags: '--gpus all --rm --name testrun-nvc'

# - name: pytest-gpu-omp-nvidia
# test_files: "tests/test_adjoint.py tests/test_gpu_common.py tests/test_gpu_openmp.py"
# base: "devitocodes/bases:nvidia-nvc"
# tags: ["self-hosted", "nvidiagpu"]
# test_drive_cmd: "nvidia-smi"
# flags: '--gpus all --rm --name testrun-nvc-omp-nvidia --env DEVITO_LANGUAGE=openmp'

- name: pytest-gpu-omp-amd
test_files: "tests/test_adjoint.py tests/test_gpu_common.py tests/test_gpu_openmp.py"
tags: ["self-hosted", "amdgpu"]
Expand Down
11 changes: 8 additions & 3 deletions docker/Dockerfile.nvidia
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ 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

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

#Install python
RUN apt-get update && \
apt-get install -y 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
Expand Down Expand Up @@ -81,7 +86,7 @@ RUN export NVARCH=$(ls -1 /opt/nvidia/hpc_sdk/Linux_x86_64/ | grep '\.' | head -
ln -sf /opt/nvidia/hpc_sdk/Linux_x86_64/comm_libs/${CUDA_V}/nccl /opt/nvhpc/comm_libs/nccl

# Starting nvhpc 23.5 and cuda 12.1, hpcx and openmpi are inside the cuda version folder, only the bin is in the comm_libs path
RUN export CUDA_V=$(ls /opt/nvhpc/${NVARCH}/cuda/ | grep '\.') && \
RUN export CUDA_V=$(nvcc --version | sed -n 's/^.*release \([0-9]\+\.[0-9]\+\).*$/\1/p') && \
ls /opt/nvhpc/comm_libs/${CUDA_V}/hpcx/ &&\
if [ -d /opt/nvhpc/comm_libs/${CUDA_V}/hpcx ]; then \
rm -rf /opt/nvhpc/comm_libs/hpcx && rm -rf /opt/nvhpc/comm_libs/openmpi4 && \
Expand Down
14 changes: 3 additions & 11 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Devito provides several images that target different architectures and compilers

We provide two CPU images:
- `devito:gcc-*` with the standard GNU gcc compiler.
- `devito:icx-*` with the Intel C compiler for Intel architectures.
- `devito:icx-*` with the Intel C compiler for Intel architectures also configured with `intelpython3`.

These images provide a working environment for any CPU architecture and come with [Devito], `gcc/icx` and `mpi` preinstalled, and utilities such as `jupyter` for usability and exploration of the package.

Expand Down Expand Up @@ -40,10 +40,9 @@ In addition, the following legacy tags are available:

### [Devito] on GPU

Second, we provide three images to run [Devito] on GPUs, tagged `devito:nvidia-nvc-*`, `devito:nvidia-clang-*`, and `devito:amd-*`.
Second, we provide three images to run [Devito] on GPUs, tagged `devito:nvidia-nvc-*`, and `devito:amd-*`.

- `devito:nvidia-nvc-*` is intended to be used on NVidia GPUs. It comes with the configuration to use the `nvc` compiler for `openacc` offloading. This image also comes with CUDA-aware MPI for multi-GPU deployment.
- `devito:nvidia-clang-*` is intended to be used on NVidia GPUs. It comes with the configuration to use the `clang` compiler for `openmp` offloading. This image also comes with CUDA-aware MPI for multi-GPU deployment.
- `devito:amd-*` is intended to be used on AMD GPUs. It comes with the configuration to use the `aoompcc` compiler for `openmp` offloading. This image also comes with ROCm-aware MPI for multi-GPU deployment. This image can also be used on AMD CPUs since the ROCm compilers are preinstalled.

#### NVidia
Expand Down Expand Up @@ -93,19 +92,12 @@ To build the GPU image with `openacc` offloading and the `nvc` compiler, run:
docker build --build-arg base=devitocodes/bases:nvidia-nvc --network=host --file docker/Dockerfile.devito --tag devito .
```

or if you wish to use the `clang` compiler with `openmp` offloading:

```bash
docker build --build-arg base=devitocodes/bases:nvidia-clang --network=host --file docker/Dockerfile --tag devito .
```

and finally, for AMD architectures:
or if you wish to use the `amdclang` compiler with `openmp` offloading for AMD architectures:

```bash
docker build --build-arg base=devitocodes/bases:amd --network=host --file docker/Dockerfile --tag devito .
```


## Debugging a base image

To build the base image yourself locally, you need to run the standard build command using the provided Dockerfile.
Expand Down
2 changes: 1 addition & 1 deletion requirements-nvidia.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cupy-cuda110
cupy-cuda12x
dask-cuda
jupyterlab>=3
jupyterlab-nvdashboard
Expand Down

0 comments on commit 36c6715

Please sign in to comment.