Skip to content

Commit 7df3a4f

Browse files
committed
ci: Build free-threaded base images
1 parent 8578139 commit 7df3a4f

File tree

6 files changed

+128
-31
lines changed

6 files changed

+128
-31
lines changed

.github/workflows/docker-bases.yml

Lines changed: 117 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,24 @@ on:
1111
- "/docker/Dockerfile.cpu"
1212
- "/docker/Dockerfile.amd"
1313
- "/docker/Dockerfile.intel"
14+
- "/docker/Dockerfile.nogil"
1415
workflow_dispatch:
1516
inputs:
17+
nogil:
18+
type: boolean
19+
default: true
1620
cpu:
1721
type: boolean
18-
default: false
22+
default: true
1923
nvidia:
2024
type: boolean
21-
default: false
25+
default: true
2226
amd:
2327
type: boolean
24-
default: false
28+
default: true
2529
intel:
2630
type: boolean
27-
default: false
31+
default: true
2832

2933
tags:
3034
description: "Build compiler bases"
@@ -33,6 +37,43 @@ on:
3337
- cron: "0 0 1 * *"
3438

3539
jobs:
40+
#######################################################
41+
########### Free-threaded Python meta-base ############
42+
#######################################################
43+
deploy-nogil-base:
44+
name: "python-nogil-base"
45+
runs-on: ubuntu-latest
46+
if: inputs.nogil
47+
env:
48+
DOCKER_BUILDKIT: "1"
49+
50+
steps:
51+
- name: Checkout devito
52+
uses: actions/checkout@v5
53+
54+
- name: Check event name
55+
run: echo ${{ github.event_name }}
56+
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v3
59+
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
63+
- name: Login to DockerHub
64+
uses: docker/login-action@v3
65+
with:
66+
username: ${{ secrets.DOCKER_USERNAME }}
67+
password: ${{ secrets.DOCKER_PASSWORD }}
68+
69+
- name: Build free-threaded Python base
70+
uses: docker/build-push-action@v6
71+
with:
72+
context: .
73+
file: "./docker/Dockerfile.nogil"
74+
push: true
75+
tags: "devitocodes/bases:python-nogil"
76+
3677
#######################################################
3778
############## Basic gcc CPU ##########################
3879
#######################################################
@@ -46,10 +87,18 @@ jobs:
4687
strategy:
4788
matrix:
4889
gcc: ["", "14"]
90+
disable-gil: [false, true]
91+
include:
92+
- disable-gil: false
93+
build-args: ""
94+
suffix: ""
95+
- disable-gil: true
96+
build-args: "base=devitocodes/bases:python-nogil"
97+
suffix: "-nogil"
4998

5099
steps:
51100
- name: Checkout devito
52-
uses: actions/checkout@v5
101+
uses: actions/checkout@v4
53102

54103
- name: Check event name
55104
run: echo ${{ github.event_name }}
@@ -72,8 +121,10 @@ jobs:
72121
context: .
73122
file: "./docker/Dockerfile.cpu"
74123
push: true
75-
build-args: "gcc=${{ matrix.gcc }}"
76-
tags: "devitocodes/bases:cpu-gcc${{ matrix.gcc }}"
124+
build-args: |
125+
gcc=${{ matrix.gcc }}
126+
${{ matrix.build-args }}
127+
tags: "devitocodes/bases:cpu-gcc${{ matrix.gcc }}${{ matrix.suffix }}"
77128

78129
#######################################################
79130
############## Intel OneApi CPU #######################
@@ -85,6 +136,16 @@ jobs:
85136
env:
86137
DOCKER_BUILDKIT: "1"
87138

139+
strategy:
140+
matrix:
141+
include:
142+
- disable-gil: false
143+
build-args: ""
144+
suffix: ""
145+
- disable-gil: true
146+
build-args: "base=devitocodes/bases:python-nogil"
147+
suffix: "-nogil"
148+
88149
steps:
89150
- name: Checkout devito
90151
uses: actions/checkout@v5
@@ -103,15 +164,18 @@ jobs:
103164
with:
104165
username: ${{ secrets.DOCKER_USERNAME }}
105166
password: ${{ secrets.DOCKER_PASSWORD }}
167+
106168
- name: ICX image
107169
uses: docker/build-push-action@v6
108170
with:
109171
context: .
110172
file: "./docker/Dockerfile.intel"
111173
push: true
112174
target: "icx"
113-
build-args: "arch=icx"
114-
tags: "devitocodes/bases:cpu-icx"
175+
build-args: |
176+
arch=icx
177+
${{ matrix.build-args }}
178+
tags: "devitocodes/bases:cpu-icx${{ matrix.suffix }}"
115179

116180
- name: SYCL CPU image
117181
uses: docker/build-push-action@v6
@@ -120,8 +184,10 @@ jobs:
120184
file: "./docker/Dockerfile.intel"
121185
push: true
122186
target: "cpu-sycl"
123-
build-args: "arch=cpu-sycl"
124-
tags: "devitocodes/bases:cpu-sycl"
187+
build-args: |
188+
arch=cpu-sycl
189+
${{ matrix.build-args }}
190+
tags: "devitocodes/bases:cpu-sycl${{ matrix.suffix }}"
125191

126192
- name: SYCL GPU image
127193
uses: docker/build-push-action@v6
@@ -130,8 +196,10 @@ jobs:
130196
file: "./docker/Dockerfile.intel"
131197
push: true
132198
target: "gpu-sycl"
133-
build-args: "arch=gpu-sycl"
134-
tags: "devitocodes/bases:gpu-sycl"
199+
build-args: |
200+
arch=gpu-sycl
201+
${{ matrix.build-args }}
202+
tags: "devitocodes/bases:gpu-sycl${{ matrix.suffix }}"
135203

136204
#######################################################
137205
################### Nvidia nvhpc ######################
@@ -143,6 +211,16 @@ jobs:
143211
env:
144212
DOCKER_BUILDKIT: "1"
145213

214+
strategy:
215+
matrix:
216+
include:
217+
- disable-gil: false
218+
build-args: ""
219+
suffix: ""
220+
- disable-gil: true
221+
build-args: "base=devitocodes/bases:python-nogil"
222+
suffix: "-nogil"
223+
146224
steps:
147225
- name: Checkout devito
148226
uses: actions/checkout@v5
@@ -169,10 +247,12 @@ jobs:
169247
file: "./docker/Dockerfile.nvidia"
170248
push: true
171249
target: "nvc"
172-
build-args: "arch=nvc"
250+
build-args: |
251+
arch=nvc
252+
${{ matrix.build-args }}
173253
# Label (not tag) with runner name for traceability without changing image tags
174254
labels: builder-runner=${{ runner.name }}
175-
tags: "devitocodes/bases:nvidia-nvc"
255+
tags: "devitocodes/bases:nvidia-nvc${{ matrix.suffix }}"
176256

177257
- name: NVCC image
178258
uses: docker/build-push-action@v6
@@ -181,9 +261,11 @@ jobs:
181261
file: "./docker/Dockerfile.nvidia"
182262
push: true
183263
target: "nvcc"
184-
build-args: "arch=nvcc"
264+
build-args: |
265+
arch=nvcc
266+
${{ matrix.build-args }}
185267
labels: builder-runner=${{ runner.name }}
186-
tags: "devitocodes/bases:nvidia-nvcc"
268+
tags: "devitocodes/bases:nvidia-nvcc${{ matrix.suffix }}"
187269

188270
- name: NVC host image
189271
uses: docker/build-push-action@v6
@@ -192,9 +274,11 @@ jobs:
192274
file: "./docker/Dockerfile.nvidia"
193275
push: true
194276
target: "nvc-host"
195-
build-args: "arch=nvc-host"
277+
build-args: |
278+
arch=nvc-host
279+
${{ matrix.build-args }}
196280
labels: builder-runner=${{ runner.name }}
197-
tags: "devitocodes/bases:cpu-nvc"
281+
tags: "devitocodes/bases:cpu-nvc${{ matrix.suffix }}"
198282

199283
#######################################################
200284
##################### AMD #############################
@@ -206,6 +290,16 @@ jobs:
206290
env:
207291
DOCKER_BUILDKIT: "1"
208292

293+
strategy:
294+
matrix:
295+
include:
296+
- disable-gil: false
297+
build-args: ""
298+
suffix: ""
299+
- disable-gil: true
300+
build-args: "base=devitocodes/bases:python-nogil"
301+
suffix: "-nogil"
302+
209303
steps:
210304
- name: Checkout devito
211305
uses: actions/checkout@v5
@@ -236,7 +330,8 @@ jobs:
236330
ROCM_VERSION=5.5.1
237331
UCX_BRANCH=v1.13.1
238332
OMPI_BRANCH=v4.1.4
239-
tags: devitocodes/bases:amd
333+
${{ matrix.build-args }}
334+
tags: devitocodes/bases:amd${{ matrix.suffix }}
240335

241336
- name: AMD HIP image
242337
uses: docker/build-push-action@v6
@@ -247,4 +342,5 @@ jobs:
247342
target: "hip"
248343
build-args: |
249344
ROCM_VERSION=6.3.4
250-
tags: devitocodes/bases:amd-hip
345+
${{ matrix.build-args }}
346+
tags: devitocodes/bases:amd-hip${{ matrix.suffix }}

docker/Dockerfile.amd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
##############################################################
55

66
ARG ROCM_VERSION=6.3.2
7-
ARG FROM_IMAGE=ubuntu:22.04
7+
ARG base=ubuntu:22.04
88

9+
# Base may be specified with the nogil base to provide a Python build
910
FROM $base AS ubuntu-base
1011
FROM rocm/dev-ubuntu-22.04:${ROCM_VERSION}-complete AS sdk-base
1112

docker/Dockerfile.cpu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
##############################################################
66

77
# Base image is either ubuntu or the nogil base
8-
ARG FROM_IMAGE=ubuntu:22.04
9-
ARG gcc=""
8+
ARG base=ubuntu:22.04
109

11-
FROM $FROM_IMAGE AS base
10+
FROM $base AS base
11+
ARG gcc=""
1212

1313
ENV DEBIAN_FRONTEND=noninteractive
1414

docker/Dockerfile.intel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
##############################################################
55

66
# Base image
7-
ARG FROM_IMAGE=ubuntu:22.04
8-
FROM $FROM_IMAGE as base
7+
ARG base=ubuntu:22.04
8+
FROM $base as base
99

1010
ENV DEBIAN_FRONTEND noninteractive
1111

docker/Dockerfile.nogil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Builds a base image with free-threaded Python 3.13
33
##############################################################
44

5-
ARG FROM_IMAGE=ubuntu:22.04
5+
ARG base=ubuntu:22.04
66

7-
FROM $FROM_IMAGE AS builder
7+
FROM $base AS builder
88

99
ENV DEBIAN_FRONTEND=noninteractive
1010

docker/Dockerfile.nvidia

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ ARG arch="nvc"
77
########################################################################
88
# Build base image with apt setup and common env
99
########################################################################
10-
ARG FROM_IMAGE=ubuntu:22.04
11-
FROM $FROM_IMAGE AS sdk-base
10+
ARG base=ubuntu:22.04
11+
FROM $base AS sdk-base
1212

1313
SHELL ["/bin/bash", "-c"]
1414

0 commit comments

Comments
 (0)