Skip to content

Merge pull request #2379 from devitocodes/sparse-gather #320

Merge pull request #2379 from devitocodes/sparse-gather

Merge pull request #2379 from devitocodes/sparse-gather #320

Workflow file for this run

name: Publish devito docker images from compiler bases
on:
release:
types: [published]
push:
branches:
- master # Push events on master branch
jobs:
deploy-devito:
runs-on: ${{ matrix.runner }}
env:
# Use buildkit https://docs.docker.com/develop/develop-images/build_enhancements/ for better build
DOCKER_BUILDKIT: "1"
strategy:
fail-fast: false
matrix:
include:
- base: 'bases:nvidia-nvc'
tag: 'nvidia-nvc'
flag: '--gpus all'
test: 'tests/test_gpu_openacc.py tests/test_gpu_common.py'
runner: ["self-hosted", "nvidiagpu"]
# Runtime gpu flags from https://hub.docker.com/r/rocm/tensorflow/
- base: 'bases:amd'
tag: 'amd'
flag: '--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'
test: 'tests/test_gpu_openmp.py'
runner: ["self-hosted", "amdgpu"]
- base: 'bases:cpu-gcc'
tag: "gcc"
flag: ''
test: 'tests/test_operator.py'
runner: ubuntu-latest
- base: 'bases:cpu-icx'
tag: "icx"
flag: ''
test: 'tests/test_operator.py'
runner: ubuntu-latest
steps:
- name: Checkout devito
uses: actions/checkout@v4
- 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: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: |
devitocodes/devito
# Creates all the tags to be pushed.
# `event`` is the trigger even (pr for pull request, tag for release)
# `value/pattern` is the actual tag
# `enable` is a "if" filter fir that tag
# `type` is the type of tag
tags: |
type=raw,value=${{ matrix.tag }}-dev
type=raw,value=${{ matrix.tag }}-latest,enable=${{ github.event_name == 'release' }}
type=raw,value=latest,enable=${{ matrix.base == 'bases:cpu-gcc' }}
type=semver,pattern={{raw}},prefix=${{ matrix.tag }}-,enable=${{ github.event_name == 'release' }}
# Legacy "gpu" tag
type=raw,value=gpu-dev,enable=${{ matrix.base == 'bases:nvidia-nvc' }}
type=semver,pattern={{raw}},prefix=gpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }}
type=semver,pattern={{raw}},value=gpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }}
# Legacy "cpu" tag
type=raw,value=cpu-dev,enable=${{ matrix.base == 'bases:cpu-gcc' }}
type=semver,pattern={{raw}},prefix=cpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }}
type=semver,pattern={{raw}},value=cpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }}
- name: Check tags
run: echo "${{ steps.meta.outputs.tags }}"
- name: Build and push image
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile.devito
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: base=devitocodes/${{ matrix.base }}
- name: Remove dangling layers
run: docker system prune -f
- name: Run tests
run: |
docker run ${{ matrix.flag }} --rm -t --name testrun 'devitocodes/devito:${{ matrix.tag }}-dev' pytest ${{ matrix.test }}