-
Notifications
You must be signed in to change notification settings - Fork 255
295 lines (261 loc) · 10.9 KB
/
docker-devito.yaml
File metadata and controls
295 lines (261 loc) · 10.9 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
name: Publish devito docker images from compiler bases
permissions:
contents: read
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'
arch: amd64
platform: linux/amd64
run_tests: false
tag_suffix: '-amd64'
# 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'
tag: 'nvidia-nvc'
arch: arm64
platform: linux/arm64
run_tests: false
tag_suffix: '-arm64'
flag: --init --gpus "device=${CUDA_VISIBLE_DEVICES:-all}"
test: ''
runner: ubuntu-24.04-arm
- base: 'bases:nvidia-nvc12'
tag: 'nvidia-nvc12'
arch: amd64
platform: linux/amd64
run_tests: false
tag_suffix: '-amd64'
# 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-nvc12'
tag: 'nvidia-nvc12'
arch: arm64
platform: linux/arm64
run_tests: false
tag_suffix: '-arm64'
flag: --init --gpus "device=${CUDA_VISIBLE_DEVICES:-all}"
test: ''
runner: ubuntu-24.04-arm
# Runtime gpu flags from https://hub.docker.com/r/rocm/tensorflow/
- base: 'bases:amd'
tag: 'amd'
arch: amd64
platform: linux/amd64
run_tests: true
tag_suffix: ''
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"
arch: amd64
platform: linux/amd64
run_tests: false
tag_suffix: '-amd64'
flag: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-latest
- base: 'bases:cpu-gcc'
tag: "gcc"
arch: arm64
platform: linux/arm64
run_tests: false
tag_suffix: '-arm64'
flag: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-24.04-arm
- base: 'bases:cpu-icx'
tag: "icx"
arch: amd64
platform: linux/amd64
run_tests: true
tag_suffix: ''
flag: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-latest
steps:
- name: Checkout devito
uses: actions/checkout@v6
- 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@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
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,suffix=${{ matrix.tag_suffix }}
type=raw,value=${{ matrix.tag }}-latest,enable=${{ github.event_name == 'release' }},suffix=${{ matrix.tag_suffix }}
type=raw,value=latest,enable=${{ matrix.base == 'bases:cpu-gcc' }},suffix=${{ matrix.tag_suffix }}
type=semver,pattern={{raw}},prefix=${{ matrix.tag }}-,enable=${{ github.event_name == 'release' }},suffix=${{ matrix.tag_suffix }}
# Legacy "gpu" tag
type=raw,value=gpu-dev,enable=${{ contains(matrix.base, 'bases:nvidia-nvc') }},suffix=${{ matrix.tag_suffix }}
type=semver,pattern={{raw}},prefix=gpu-,enable=${{ github.event_name == 'release' && contains(matrix.base, 'bases:nvidia-nvc') }},suffix=${{ matrix.tag_suffix }}
type=semver,pattern={{raw}},value=gpu-latest,enable=${{ github.event_name == 'release' && contains(matrix.base, 'bases:nvidia-nvc') }},suffix=${{ matrix.tag_suffix }}
# Legacy "cpu" tag
type=raw,value=cpu-dev,enable=${{ matrix.base == 'bases:cpu-gcc' }},suffix=${{ matrix.tag_suffix }}
type=semver,pattern={{raw}},prefix=cpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }},suffix=${{ matrix.tag_suffix }}
type=semver,pattern={{raw}},value=cpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }},suffix=${{ matrix.tag_suffix }}
- name: Check tags
run: echo "${{ steps.meta.outputs.tags }}"
- name: Build and push image
uses: docker/build-push-action@v7
with:
context: .
file: ./docker/Dockerfile.devito
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: base=devitocodes/${{ matrix.base }}
platforms: ${{ matrix.platform }}
- name: Remove dangling layers
run: docker system prune -f
- name: Run tests
if: ${{ matrix.run_tests }}
run: |
docker run ${{ matrix.flag }} --rm -t --name "${CONTAINER_NAME}" \
devitocodes/devito:${{ matrix.tag }}-dev \
pytest -v ${{ matrix.test }}
deploy-devito-manifest:
needs: deploy-devito
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"
strategy:
matrix:
include:
- tag: 'nvidia-nvc'
base: 'bases:nvidia-nvc'
arches: "amd64 arm64"
- tag: 'nvidia-nvc12'
base: 'bases:nvidia-nvc12'
arches: "amd64 arm64"
- tag: 'gcc'
base: 'bases:cpu-gcc'
arches: "amd64 arm64"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: manifest-meta
uses: docker/metadata-action@v6
with:
flavor: |
latest=false
images: |
devitocodes/devito
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=${{ contains(matrix.base, 'bases:nvidia-nvc') }}
type=semver,pattern={{raw}},prefix=gpu-,enable=${{ github.event_name == 'release' && contains(matrix.base, 'bases:nvidia-nvc') }}
type=semver,pattern={{raw}},value=gpu-latest,enable=${{ github.event_name == 'release' && contains(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: Create multi-arch manifests
env:
ARCHES: ${{ matrix.arches }}
TAGS: ${{ steps.manifest-meta.outputs.tags }}
run: |
if [ -z "$TAGS" ]; then
echo "No tags generated, skipping"
exit 0
fi
echo "$TAGS" | while read -r tag; do
refs=""
for arch in $ARCHES; do
refs="$refs devitocodes/devito:${tag}-${arch}"
done
echo "Creating manifest for devitocodes/devito:${tag} using:${refs}"
docker buildx imagetools create --tag "devitocodes/devito:${tag}" "$refs"
docker buildx imagetools inspect "devitocodes/devito:${tag}"
done
test-devito:
needs: deploy-devito-manifest
runs-on: ${{ matrix.runner }}
env:
DOCKER_BUILDKIT: "1"
strategy:
fail-fast: false
matrix:
include:
- tag: 'nvidia-nvc'
flag: --init --gpus "device=${CUDA_VISIBLE_DEVICES:-all}"
test: 'tests/test_gpu_openacc.py tests/test_gpu_common.py'
runner: ["self-hosted", "nvidiagpu"]
- tag: 'nvidia-nvc12'
flag: --init --gpus "device=${CUDA_VISIBLE_DEVICES:-all}"
test: 'tests/test_gpu_openacc.py tests/test_gpu_common.py'
runner: ["self-hosted", "nvidiagpu"]
- tag: 'gcc'
flag: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-latest
- tag: 'gcc'
flag: '--init -t'
test: 'tests/test_operator.py'
runner: ubuntu-24.04-arm
steps:
- name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set per‑runner variables
run: |
echo "CONTAINER_NAME=testrun-${{ matrix.tag }}-${RUNNER_NAME// /_}" >> "$GITHUB_ENV"
- name: Run tests against multi-arch image
run: |
docker run ${{ matrix.flag }} --rm -t --name "${CONTAINER_NAME}" \
devitocodes/devito:${{ matrix.tag }}-dev \
pytest -v ${{ matrix.test }}