devito-xdsl: Update devito-xdsl master #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runner information: | |
# OpenACC on NVidia runs on `nvidiagpu` | |
# OpenMP on NVidia runs on `nvidiagpu` | |
# OpenMP on AMD runs on `amdgpu` | |
name: CI-gpu | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
OUTPUT_PATH: ${{ github.workspace }} | |
RESOURCE_GROUP: CI-gpu | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the master branch | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
# Push-button activation | |
workflow_dispatch: | |
inputs: | |
tags: | |
description: 'Run GPU tests' | |
jobs: | |
build: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.tags }} | |
env: | |
DEVITO_ARCH: ${{ matrix.arch }} | |
DEVITO_PLATFORM: ${{ matrix.platform }} | |
DEVITO_LANGUAGE: ${{ matrix.language }} | |
OMPI_CC: ${{ matrix.arch }} | |
strategy: | |
# Prevent all builds from terminating if one fails | |
fail-fast: false | |
matrix: | |
name: [ | |
pytest-gpu-acc-nvidia, | |
pytest-gpu-omp-amd | |
] | |
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-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-amd | |
test_files: "tests/test_adjoint.py tests/test_gpu_common.py tests/test_gpu_openmp.py" | |
tags: ["self-hosted", "amdgpu"] | |
base: "devitocodes/bases:amd" | |
test_drive_cmd: "rocm-smi" | |
# Attach the AMD GPU devices `/dev` and add user to video and render (109 on wampa) group | |
# Options from https://rocmdocs.amd.com/en/latest/ROCm_Virtualization_Containers/ROCm-Virtualization-&-Containers.html | |
flags: "--network=host --device=/dev/kfd --device=/dev/dri --ipc=host --group-add video --group-add $(getent group render | cut -d: -f3) --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --rm --name testrun-amd" | |
steps: | |
- name: Checkout devito | |
uses: actions/checkout@v3 | |
- name: Build docker image | |
run: | | |
docker build . --rm --pull --file docker/Dockerfile.devito --tag ${{ matrix.name }} --build-arg base=${{ matrix.base }} | |
- name: Remove dangling layers | |
run: docker system prune -f | |
- name: Test with pytest | |
run: | | |
# Remove all existing containers for safety | |
docker ps -aq | xargs -r docker rm -f | |
# Run tests | |
docker run ${{ matrix.flags }} ${{ matrix.name }} ${{ matrix.test_drive_cmd }} | |
docker run ${{ matrix.flags }} -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} ${{ matrix.name }} pytest --cov --cov-config=.coveragerc --cov-report=xml ${{ matrix.test_files }} | |
- name: Test examples | |
run: | | |
docker run ${{ matrix.flags }} ${{ matrix.name }} pytest ${{ matrix.test_examples }} | |
- name: Test examples with MPI | |
run: | | |
docker run ${{ matrix.flags }} --env DEVITO_MPI=1 ${{ matrix.name }} mpiexec -n 2 pytest ${{ matrix.test_examples }} |