Skip to content

Commit 288df4e

Browse files
authored
Merge pull request #2773 from devitocodes/arm-base-mloubout
docker: Add arm support (gcc and nvidia)
2 parents 9d2e0c4 + b8004ad commit 288df4e

15 files changed

+347
-35
lines changed

.github/workflows/docker-bases.yml

Lines changed: 100 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build base compilers docker images
22

3+
permissions:
4+
contents: read
5+
36
concurrency:
47
group: ${{ github.workflow }}-${{ github.ref }}
58
cancel-in-progress: true
@@ -38,14 +41,22 @@ jobs:
3841
#######################################################
3942
deploy-cpu-bases:
4043
if: inputs.cpu
41-
name: "cpu-base"
42-
runs-on: ubuntu-latest
44+
name: "cpu-base-${{ matrix.arch }}-gcc${{ matrix.gcc }}"
45+
runs-on: ${{ matrix.runner }}
4346
env:
4447
DOCKER_BUILDKIT: "1"
4548

4649
strategy:
4750
matrix:
4851
gcc: ["", "14"]
52+
arch: [amd64, arm64]
53+
include:
54+
- arch: amd64
55+
platform: linux/amd64
56+
runner: ubuntu-latest
57+
- arch: arm64
58+
platform: linux/arm64
59+
runner: ubuntu-24.04-arm
4960

5061
steps:
5162
- name: Checkout devito
@@ -72,8 +83,41 @@ jobs:
7283
context: .
7384
file: "./docker/Dockerfile.cpu"
7485
push: true
86+
platforms: ${{ matrix.platform }}
7587
build-args: "gcc=${{ matrix.gcc }}"
76-
tags: "devitocodes/bases:cpu-gcc${{ matrix.gcc }}"
88+
tags: "devitocodes/bases:cpu-gcc${{ matrix.gcc }}-${{ matrix.arch }}"
89+
90+
deploy-cpu-bases-manifest:
91+
if: inputs.cpu
92+
name: "cpu-base-manifest"
93+
runs-on: ubuntu-latest
94+
needs: deploy-cpu-bases
95+
env:
96+
DOCKER_BUILDKIT: "1"
97+
98+
strategy:
99+
matrix:
100+
gcc: ["", "14"]
101+
102+
steps:
103+
- name: Set up Docker Buildx
104+
uses: docker/setup-buildx-action@v3
105+
106+
- name: Login to DockerHub
107+
uses: docker/login-action@v3
108+
with:
109+
username: ${{ secrets.DOCKER_USERNAME }}
110+
password: ${{ secrets.DOCKER_PASSWORD }}
111+
112+
- name: Create multi-arch manifest
113+
env:
114+
TAG_BASE: ${{ format('cpu-gcc{0}', matrix.gcc) }}
115+
run: |
116+
docker buildx imagetools create \
117+
--tag devitocodes/bases:${TAG_BASE} \
118+
devitocodes/bases:${TAG_BASE}-amd64 \
119+
devitocodes/bases:${TAG_BASE}-arm64
120+
docker buildx imagetools inspect devitocodes/bases:${TAG_BASE}
77121
78122
#######################################################
79123
############## Intel OneApi CPU #######################
@@ -138,11 +182,24 @@ jobs:
138182
#######################################################
139183
deploy-nvidia-bases:
140184
if: inputs.nvidia
141-
name: "nvidia-bases"
142-
runs-on: ["self-hosted", "nvidiagpu"]
185+
name: "nvidia-bases-${{ matrix.arch }}"
186+
runs-on: ${{ matrix.runner }}
143187
env:
144188
DOCKER_BUILDKIT: "1"
145189

190+
strategy:
191+
matrix:
192+
arch: [amd64, arm64]
193+
include:
194+
- arch: amd64
195+
platform: linux/amd64
196+
runner:
197+
- self-hosted
198+
- nvidiagpu
199+
- arch: arm64
200+
platform: linux/arm64
201+
runner: ubuntu-24.04-arm
202+
146203
steps:
147204
- name: Checkout devito
148205
uses: actions/checkout@v5
@@ -169,10 +226,11 @@ jobs:
169226
file: "./docker/Dockerfile.nvidia"
170227
push: true
171228
target: "nvc"
229+
platforms: ${{ matrix.platform }}
172230
build-args: "arch=nvc"
173231
# Label (not tag) with runner name for traceability without changing image tags
174232
labels: builder-runner=${{ runner.name }}
175-
tags: "devitocodes/bases:nvidia-nvc"
233+
tags: "devitocodes/bases:nvidia-nvc-${{ matrix.arch }}"
176234

177235
- name: NVCC image
178236
uses: docker/build-push-action@v6
@@ -181,9 +239,10 @@ jobs:
181239
file: "./docker/Dockerfile.nvidia"
182240
push: true
183241
target: "nvcc"
242+
platforms: ${{ matrix.platform }}
184243
build-args: "arch=nvcc"
185244
labels: builder-runner=${{ runner.name }}
186-
tags: "devitocodes/bases:nvidia-nvcc"
245+
tags: "devitocodes/bases:nvidia-nvcc-${{ matrix.arch }}"
187246

188247
- name: NVC host image
189248
uses: docker/build-push-action@v6
@@ -192,9 +251,42 @@ jobs:
192251
file: "./docker/Dockerfile.nvidia"
193252
push: true
194253
target: "nvc-host"
254+
platforms: ${{ matrix.platform }}
195255
build-args: "arch=nvc-host"
196256
labels: builder-runner=${{ runner.name }}
197-
tags: "devitocodes/bases:cpu-nvc"
257+
tags: "devitocodes/bases:cpu-nvc-${{ matrix.arch }}"
258+
259+
deploy-nvidia-bases-manifest:
260+
if: inputs.nvidia
261+
name: "nvidia-base-manifest"
262+
runs-on: ubuntu-latest
263+
needs: deploy-nvidia-bases
264+
env:
265+
DOCKER_BUILDKIT: "1"
266+
267+
strategy:
268+
matrix:
269+
final_tag: [nvidia-nvc, nvidia-nvcc, cpu-nvc]
270+
271+
steps:
272+
- name: Set up Docker Buildx
273+
uses: docker/setup-buildx-action@v3
274+
275+
- name: Login to DockerHub
276+
uses: docker/login-action@v3
277+
with:
278+
username: ${{ secrets.DOCKER_USERNAME }}
279+
password: ${{ secrets.DOCKER_PASSWORD }}
280+
281+
- name: Create multi-arch manifest
282+
env:
283+
FINAL_TAG: ${{ matrix.final_tag }}
284+
run: |
285+
docker buildx imagetools create \
286+
--tag devitocodes/bases:${FINAL_TAG} \
287+
devitocodes/bases:${FINAL_TAG}-amd64 \
288+
devitocodes/bases:${FINAL_TAG}-arm64
289+
docker buildx imagetools inspect devitocodes/bases:${FINAL_TAG}
198290
199291
#######################################################
200292
##################### AMD #############################

.github/workflows/docker-devito.yml

Lines changed: 158 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Publish devito docker images from compiler bases
22

3+
permissions:
4+
contents: read
5+
36
on:
47
release:
58
types: [published]
@@ -21,27 +24,63 @@ jobs:
2124
include:
2225
- base: 'bases:nvidia-nvc'
2326
tag: 'nvidia-nvc'
27+
arch: amd64
28+
platform: linux/amd64
29+
run_tests: false
30+
tag_suffix: '-amd64'
2431
# Respect CUDA_VISIBLE_DEVICES set by the runner and hard-limit docker to that device.
2532
# (--gpus maps only the selected device from CUDA_VISIBLE_DEVICES)
2633
flag: --init --gpus "device=${CUDA_VISIBLE_DEVICES:-all}"
2734
test: 'tests/test_gpu_openacc.py tests/test_gpu_common.py'
2835
runner: ["self-hosted", "nvidiagpu"]
2936

37+
- base: 'bases:nvidia-nvc'
38+
tag: 'nvidia-nvc'
39+
arch: arm64
40+
platform: linux/arm64
41+
run_tests: false
42+
tag_suffix: '-arm64'
43+
flag: --init --gpus "device=${CUDA_VISIBLE_DEVICES:-all}"
44+
test: ''
45+
runner: ubuntu-24.04-arm
46+
3047
# Runtime gpu flags from https://hub.docker.com/r/rocm/tensorflow/
3148
- base: 'bases:amd'
3249
tag: 'amd'
50+
arch: amd64
51+
platform: linux/amd64
52+
run_tests: true
53+
tag_suffix: ''
3354
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'
3455
test: 'tests/test_gpu_openmp.py'
3556
runner: ["self-hosted", "amdgpu"]
3657

3758
- base: 'bases:cpu-gcc'
3859
tag: "gcc"
60+
arch: amd64
61+
platform: linux/amd64
62+
run_tests: false
63+
tag_suffix: '-amd64'
3964
flag: '--init -t'
4065
test: 'tests/test_operator.py'
4166
runner: ubuntu-latest
4267

68+
- base: 'bases:cpu-gcc'
69+
tag: "gcc"
70+
arch: arm64
71+
platform: linux/arm64
72+
run_tests: false
73+
tag_suffix: '-arm64'
74+
flag: '--init -t'
75+
test: 'tests/test_operator.py'
76+
runner: ubuntu-24.04-arm
77+
4378
- base: 'bases:cpu-icx'
4479
tag: "icx"
80+
arch: amd64
81+
platform: linux/amd64
82+
run_tests: true
83+
tag_suffix: ''
4584
flag: '--init -t'
4685
test: 'tests/test_operator.py'
4786
runner: ubuntu-latest
@@ -83,18 +122,18 @@ jobs:
83122
# `enable` is a "if" filter fir that tag
84123
# `type` is the type of tag
85124
tags: |
86-
type=raw,value=${{ matrix.tag }}-dev
87-
type=raw,value=${{ matrix.tag }}-latest,enable=${{ github.event_name == 'release' }}
88-
type=raw,value=latest,enable=${{ matrix.base == 'bases:cpu-gcc' }}
89-
type=semver,pattern={{raw}},prefix=${{ matrix.tag }}-,enable=${{ github.event_name == 'release' }}
125+
type=raw,value=${{ matrix.tag }}-dev,suffix=${{ matrix.tag_suffix }}
126+
type=raw,value=${{ matrix.tag }}-latest,enable=${{ github.event_name == 'release' }},suffix=${{ matrix.tag_suffix }}
127+
type=raw,value=latest,enable=${{ matrix.base == 'bases:cpu-gcc' }},suffix=${{ matrix.tag_suffix }}
128+
type=semver,pattern={{raw}},prefix=${{ matrix.tag }}-,enable=${{ github.event_name == 'release' }},suffix=${{ matrix.tag_suffix }}
90129
# Legacy "gpu" tag
91-
type=raw,value=gpu-dev,enable=${{ matrix.base == 'bases:nvidia-nvc' }}
92-
type=semver,pattern={{raw}},prefix=gpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }}
93-
type=semver,pattern={{raw}},value=gpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }}
130+
type=raw,value=gpu-dev,enable=${{ matrix.base == 'bases:nvidia-nvc' }},suffix=${{ matrix.tag_suffix }}
131+
type=semver,pattern={{raw}},prefix=gpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }},suffix=${{ matrix.tag_suffix }}
132+
type=semver,pattern={{raw}},value=gpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }},suffix=${{ matrix.tag_suffix }}
94133
# Legacy "cpu" tag
95-
type=raw,value=cpu-dev,enable=${{ matrix.base == 'bases:cpu-gcc' }}
96-
type=semver,pattern={{raw}},prefix=cpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }}
97-
type=semver,pattern={{raw}},value=cpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }}
134+
type=raw,value=cpu-dev,enable=${{ matrix.base == 'bases:cpu-gcc' }},suffix=${{ matrix.tag_suffix }}
135+
type=semver,pattern={{raw}},prefix=cpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }},suffix=${{ matrix.tag_suffix }}
136+
type=semver,pattern={{raw}},value=cpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }},suffix=${{ matrix.tag_suffix }}
98137
99138
- name: Check tags
100139
run: echo "${{ steps.meta.outputs.tags }}"
@@ -107,11 +146,120 @@ jobs:
107146
push: true
108147
tags: ${{ steps.meta.outputs.tags }}
109148
build-args: base=devitocodes/${{ matrix.base }}
149+
platforms: ${{ matrix.platform }}
110150

111151
- name: Remove dangling layers
112152
run: docker system prune -f
113153

114154
- name: Run tests
155+
if: ${{ matrix.run_tests }}
156+
run: |
157+
docker run ${{ matrix.flag }} --rm -t --name "${CONTAINER_NAME}" \
158+
devitocodes/devito:${{ matrix.tag }}-dev \
159+
pytest ${{ matrix.test }}
160+
161+
deploy-devito-manifest:
162+
needs: deploy-devito
163+
runs-on: ubuntu-latest
164+
env:
165+
DOCKER_BUILDKIT: "1"
166+
167+
strategy:
168+
matrix:
169+
include:
170+
- tag: 'nvidia-nvc'
171+
base: 'bases:nvidia-nvc'
172+
arches: "amd64 arm64"
173+
- tag: 'gcc'
174+
base: 'bases:cpu-gcc'
175+
arches: "amd64 arm64"
176+
177+
steps:
178+
- name: Set up Docker Buildx
179+
uses: docker/setup-buildx-action@v3
180+
181+
- name: Login to DockerHub
182+
uses: docker/login-action@v3
183+
with:
184+
username: ${{ secrets.DOCKER_USERNAME }}
185+
password: ${{ secrets.DOCKER_PASSWORD }}
186+
187+
- name: Docker meta
188+
id: manifest-meta
189+
uses: docker/metadata-action@v5
190+
with:
191+
flavor: |
192+
latest=false
193+
images: |
194+
devitocodes/devito
195+
tags: |
196+
type=raw,value=${{ matrix.tag }}-dev
197+
type=raw,value=${{ matrix.tag }}-latest,enable=${{ github.event_name == 'release' }}
198+
type=raw,value=latest,enable=${{ matrix.base == 'bases:cpu-gcc' }}
199+
type=semver,pattern={{raw}},prefix=${{ matrix.tag }}-,enable=${{ github.event_name == 'release' }}
200+
# Legacy "gpu" tag
201+
type=raw,value=gpu-dev,enable=${{ matrix.base == 'bases:nvidia-nvc' }}
202+
type=semver,pattern={{raw}},prefix=gpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }}
203+
type=semver,pattern={{raw}},value=gpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }}
204+
# Legacy "cpu" tag
205+
type=raw,value=cpu-dev,enable=${{ matrix.base == 'bases:cpu-gcc' }}
206+
type=semver,pattern={{raw}},prefix=cpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }}
207+
type=semver,pattern={{raw}},value=cpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }}
208+
209+
- name: Create multi-arch manifests
210+
env:
211+
ARCHES: ${{ matrix.arches }}
212+
TAGS: ${{ steps.manifest-meta.outputs.tags }}
213+
run: |
214+
if [ -z "$TAGS" ]; then
215+
echo "No tags generated, skipping"
216+
exit 0
217+
fi
218+
for tag in $TAGS; do
219+
refs=""
220+
for arch in $ARCHES; do
221+
refs="$refs devitocodes/devito:${tag}-${arch}"
222+
done
223+
echo "Creating manifest for devitocodes/devito:${tag} using:${refs}"
224+
docker buildx imagetools create --tag devitocodes/devito:${tag} $refs
225+
docker buildx imagetools inspect devitocodes/devito:${tag}
226+
done
227+
228+
test-devito:
229+
needs: deploy-devito-manifest
230+
runs-on: ${{ matrix.runner }}
231+
env:
232+
DOCKER_BUILDKIT: "1"
233+
234+
strategy:
235+
fail-fast: false
236+
matrix:
237+
include:
238+
- tag: 'nvidia-nvc'
239+
flag: --init --gpus "device=${CUDA_VISIBLE_DEVICES:-all}"
240+
test: 'tests/test_gpu_openacc.py tests/test_gpu_common.py'
241+
runner: ["self-hosted", "nvidiagpu"]
242+
- tag: 'gcc'
243+
flag: '--init -t'
244+
test: 'tests/test_operator.py'
245+
runner: ubuntu-latest
246+
- tag: 'gcc'
247+
flag: '--init -t'
248+
test: 'tests/test_operator.py'
249+
runner: ubuntu-24.04-arm
250+
251+
steps:
252+
- name: Login to DockerHub
253+
uses: docker/login-action@v3
254+
with:
255+
username: ${{ secrets.DOCKER_USERNAME }}
256+
password: ${{ secrets.DOCKER_PASSWORD }}
257+
258+
- name: Set per‑runner variables
259+
run: |
260+
echo "CONTAINER_NAME=testrun-${{ matrix.tag }}-${RUNNER_NAME// /_}" >> $GITHUB_ENV
261+
262+
- name: Run tests against multi-arch image
115263
run: |
116264
docker run ${{ matrix.flag }} --rm -t --name "${CONTAINER_NAME}" \
117265
devitocodes/devito:${{ matrix.tag }}-dev \

0 commit comments

Comments
 (0)