-
Notifications
You must be signed in to change notification settings - Fork 256
142 lines (120 loc) · 5.32 KB
/
docker-devito.yml
File metadata and controls
142 lines (120 loc) · 5.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Publish devito docker images from compiler bases
on:
release:
types: [published]
push:
branches:
- main # Push events on main 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'
# Respect CUDA_VISIBLE_DEVICES set by the runner and hard-limit docker to that device.
# (--gpus maps only the selected device from CUDA_VISIBLE_DEVICES)
flag: --init --gpus "device=${CUDA_VISIBLE_DEVICES:-all}"
test: 'tests/test_gpu_openacc.py tests/test_gpu_common.py'
runner: ["self-hosted", "nvidiagpu"]
- base: 'bases:nvidia-nvc-nogil'
tag: 'nvidia-nvc-nogil'
flag: '--init --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: '--init --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:amd-nogil'
tag: 'amd-nogil'
flag: '--init --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: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-latest
- base: 'bases:cpu-gcc-nogil'
tag: "gcc-nogil"
flag: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-latest
- base: 'bases:cpu-icx'
tag: "icx"
flag: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-latest
- base: 'bases:cpu-icx-nogil'
tag: "icx-nogil"
flag: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-latest
steps:
- name: Checkout devito
uses: actions/checkout@v5
- name: Set per‑runner variables
run: |
echo "CONTAINER_NAME=testrun-${{ matrix.tag }}-${RUNNER_NAME// /_}" >> $GITHUB_ENV
- name: Check event name
run: echo ${{ github.event_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
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@v6
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 "${CONTAINER_NAME}" \
devitocodes/devito:${{ matrix.tag }}-dev \
pytest ${{ matrix.test }}