Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: revamp base deployment #2162

Merged
merged 6 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
271 changes: 207 additions & 64 deletions .github/workflows/docker-bases.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build base compilers docker images

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
paths:
Expand All @@ -15,68 +19,96 @@ on:
- cron: "0 13 * * 1"

jobs:
deploy-docker-bases:
name: ${{ matrix.tag }}
runs-on: ${{ matrix.runner }}
#######################################################
############## Basic gcc CPU ##########################
#######################################################
deploy-cpu-bases:
name: "cpu-base"
runs-on: ubuntu-latest
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: GCC image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.cpu'
push: true
target: 'gcc'
build-args: 'arch=gcc'
tags: 'devitocodes/bases:cpu-gcc'

#######################################################
############## Intel OneApi CPU #######################
#######################################################
deploy-oneapi-bases:
name: "oneapi-base"
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"

strategy:
fail-fast: false
matrix:
include:
- tag: 'devitocodes/bases:nvidia-nvc'
arch: 'arch=nvc'
version: 'ver=nvhpc-22-7'
dockerfile: './docker/Dockerfile.nvidia'
runner: ["self-hosted", "nvidiagpu"]

- tag: 'devitocodes/bases:nvidia-nvcc'
arch: 'arch=nvcc'
version: 'ver=nvhpc-22-7'
dockerfile: './docker/Dockerfile.nvidia'
runner: ["self-hosted", "nvidiagpu"]

- tag: 'devitocodes/bases:nvidia-clang'
arch: 'arch=clang'
# clang is only officialy supporting cuda<11.5. The latest nvidia sdk with cuda 11.5 is 21.11 (last of 2021)
# We cannot use newer ones such as 22-1 because the package manager automatically installs the latest 2022
# that re-install the latest (11.7) version on top of it.
# For more info check https://llvm.org/docs/CompileCudaWithLLVM.html and the Prerequisites
version: 'ver=nvhpc-21-11'
dockerfile: './docker/Dockerfile.nvidia'
runner: ["self-hosted", "nvidiagpu"]

- tag: 'devitocodes/bases:amd'
arch: ''
version: ''
dockerfile: './docker/Dockerfile.amd'
runner: ["self-hosted", "amdgpu"]

- tag: 'devitocodes/bases:amd-hip'
arch: 'arch=hip'
version: ''
dockerfile: './docker/Dockerfile.amd'
runner: ["self-hosted", "amdgpu"]

# These ones are tiny runs on default
- tag: 'devitocodes/bases:cpu-gcc'
arch: 'arch=gcc'
version: ''
dockerfile: './docker/Dockerfile.cpu'
runner: ubuntu-latest

- tag: 'devitocodes/bases:cpu-icc, devitocodes/bases:cpu-icx'
arch: 'arch=icc'
version: ''
dockerfile: './docker/Dockerfile.cpu'
runner: ubuntu-latest

- tag: 'devitocodes/bases:cpu-nvc'
arch: 'arch=nvc-host'
version: ''
dockerfile: './docker/Dockerfile.nvidia'
runner: ["self-hosted", "nvidiagpu"]
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we actually need to prune everything? can we not just prune ourselves?

this might kill for example my local docker images 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not touch your images only the 'action" user one, always been there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, I was pretty sure "docker system prune" were a system-level action, that is as if it were issued by the docker group?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uhmmm


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

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

steps:
- name: Checkout devito
Expand All @@ -100,13 +132,124 @@ jobs:
- name: cleanup
run: docker system prune -a -f

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

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

- name: NVC host image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.nvidia'
push: true
target: 'nvc-host'
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 #############################
#######################################################
deploy-amd-bases:
name: "amd-base"
runs-on: ["self-hosted", "amdgpu"]
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: AMD image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.amd'
push: true
target: 'amdclang'
tags: devitocodes/bases:amd

- name: AMD HIP image
uses: docker/build-push-action@v3
with:
context: .
file: ${{ matrix.dockerfile }}
file: './docker/Dockerfile.amd'
push: true
target: 'hip'
build-args: |
${{ matrix.arch }}
${{ matrix.version }}
tags: ${{ matrix.tag }}
arch=hip
tags: devitocodes/bases:amd-hip
4 changes: 2 additions & 2 deletions .github/workflows/docker-devito.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
test: 'tests/test_operator.py'
runner: ubuntu-latest

- base: 'bases:cpu-icc'
tag: "icc"
- base: 'bases:cpu-icx'
tag: "icx"
flag: ''
test: 'tests/test_operator.py'
runner: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ jobs:

- name: Install dependencies
run: |
pip install -e .[tests]
pip install matplotlib pyrevolve
pip install -e .[tests,extras]

- name: Tests in examples
run: py.test --cov --cov-config=.coveragerc --cov-report=xml examples/
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/pytest-core-mpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- master

jobs:
build:
test-mpi-basic:
name: pytest-mpi
runs-on: ubuntu-20.04
strategy:
Expand All @@ -25,6 +25,7 @@ jobs:
env:
DEVITO_LANGUAGE: "openmp"
DEVITO_ARCH: "gcc-9"
OMP_NUM_THREADS: "1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid unnecessary thread concurency sonce this is mpi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in retrospect, I'm not sure about this one. Don't we want to test the numerical accuracy of MPI+OpenMP tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the MPI+openmp is tested with the mpi examples but this is a small 2 core machine that is already oversubscribed with MPI, adding threads only make things slower for no reason

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough

for another day: use some kind of self-hosted runner for MPI+OpenMP build? if agree, maybe add to issue list

CC: "gcc-9"
CXX: "g++-9"

Expand Down Expand Up @@ -52,3 +53,22 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: pytest-mpi

test-mpi-docker:
name: pytest-mpi
runs-on: ubuntu-latest
strategy:
matrix:
arch: [gcc, icx]

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

- name: Build docker image
run: |
docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=devitocodes/bases:cpu-${{ matrix.arch }}

- name: Test with pytest
run: |
docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e OMP_NUM_THREADS=1 --name testrun devito_img pytest tests/test_mpi.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Loading