Skip to content

Commit bf46e69

Browse files
committed
ci: configure the CUDA manylinux images in pyproject.toml
Hardcode the CUDA manylinux images in [tool.cibuildwheel] so the wheels workflow no longer sets them. Document overriding them via the CIBW_MANYLINUX_*_IMAGE environment variables to target a different (e.g. older) CUDA version in the README. Assisted-by: ClaudeCode:claude-opus-4.8
1 parent 1b902de commit bf46e69

3 files changed

Lines changed: 31 additions & 25 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,13 @@ jobs:
4848
- arch: aarch64
4949
runner: ubuntu-24.04-arm
5050

51-
# The CUDA Toolkit ships inside these custom manylinux images, so nvcc is
52-
# available during the build (see https://github.com/pypa/cibuildwheel/pull/2896).
53-
# Bump the CUDA version here; to publish wheels for several CUDA versions you
54-
# would also need distinct local version labels (e.g. 0.0.1+cu131).
55-
env:
56-
CUDA_VERSION: "13_1"
57-
MANYLINUX_BASE: manylinux_2_28
58-
5951
steps:
6052
- uses: actions/checkout@v6
6153

54+
# The CUDA manylinux images (with nvcc) are configured in pyproject.toml.
55+
# Override them with CIBW_MANYLINUX_*_IMAGE here to target a different CUDA
56+
# version (see the README).
6257
- uses: pypa/cibuildwheel@v3.4
63-
env:
64-
CIBW_MANYLINUX_X86_64_IMAGE: >-
65-
quay.io/manylinux_cuda/${{ env.MANYLINUX_BASE }}_x86_64_cuda${{ env.CUDA_VERSION }}:latest
66-
CIBW_MANYLINUX_AARCH64_IMAGE: >-
67-
quay.io/manylinux_cuda/${{ env.MANYLINUX_BASE }}_aarch64_cuda${{ env.CUDA_VERSION }}:latest
6858

6959
- name: Verify clean directory
7060
run: git diff --exit-code

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,31 @@ assert (cpu == gpu).all() # identical results, very different runtimes
8585

8686
## Building CUDA wheels
8787

88-
The `Wheels` workflow builds CUDA-enabled Linux wheels with [cibuildwheel][] by
89-
pointing it at the custom manylinux images that ship the CUDA Toolkit (see
90-
[pypa/cibuildwheel#2896][cibw-cuda]):
91-
92-
```yaml
93-
- uses: pypa/cibuildwheel@v3.4
94-
env:
95-
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/manylinux_cuda/manylinux_2_28_x86_64_cuda13_1:latest
96-
CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/manylinux_cuda/manylinux_2_28_aarch64_cuda13_1:latest
88+
The `Wheels` workflow builds CUDA-enabled Linux wheels with [cibuildwheel][],
89+
using the custom manylinux images that ship the CUDA Toolkit (see
90+
[pypa/cibuildwheel#2896][cibw-cuda]). The images are configured in
91+
`pyproject.toml`:
92+
93+
```toml
94+
[tool.cibuildwheel]
95+
manylinux-x86_64-image = "quay.io/manylinux_cuda/manylinux_2_28_x86_64_cuda13_1:latest"
96+
manylinux-aarch64-image = "quay.io/manylinux_cuda/manylinux_2_28_aarch64_cuda13_1:latest"
9797
```
9898

99+
To target a different CUDA version (e.g. an older `cuda12_9` to support older
100+
drivers) without editing `pyproject.toml`, override the images with environment
101+
variables when running cibuildwheel:
102+
103+
```bash
104+
export CIBW_MANYLINUX_X86_64_IMAGE=quay.io/manylinux_cuda/manylinux_2_28_x86_64_cuda12_9:latest
105+
export CIBW_MANYLINUX_AARCH64_IMAGE=quay.io/manylinux_cuda/manylinux_2_28_aarch64_cuda12_9:latest
106+
cibuildwheel
107+
```
108+
109+
The available images are listed in [the cibuildwheel docs][cibw-cuda]; the
110+
`manylinux_2_28`/`manylinux_2_34` base and `cuda12_9`/`cuda13_1` version can be
111+
mixed and matched.
112+
99113
The CUDA runtime is linked statically (`CUDA_RUNTIME_LIBRARY Static`), so the
100114
resulting wheels do not depend on `libcudart`. GitHub-hosted runners have no
101115
GPU, so the wheels are compiled and imported, but the kernels themselves only

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ testpaths = ["tests"]
5252
[tool.cibuildwheel]
5353
build-frontend = "build[uv]"
5454
# Building requires the CUDA Toolkit, which is only present in the custom
55-
# manylinux CUDA images (see the wheels workflow). Restrict to CPython on
56-
# manylinux; musllinux and PyPy have no matching CUDA image.
57-
build = "cp3*"
55+
# manylinux CUDA images (https://github.com/pypa/cibuildwheel/pull/2896).
56+
# Override these to target a different CUDA version
57+
manylinux-x86_64-image = "quay.io/manylinux_cuda/manylinux_2_28_x86_64_cuda13_1:latest"
58+
manylinux-aarch64-image = "quay.io/manylinux_cuda/manylinux_2_28_aarch64_cuda13_1:latest"
59+
# Restrict to CPython on manylinux; musllinux and PyPy have no matching CUDA image.
5860
skip = "*-musllinux*"
5961
test-command = "python -m pytest tests"
6062
test-sources = ["pyproject.toml", "tests"]

0 commit comments

Comments
 (0)