Skip to content

Commit c4f4ffe

Browse files
authored
ci: python 3.13 free threading builds (#986)
* ci: build free-threaded wheels * build(deps): bump cython lower bound * ci: enable freethreading for 3.13 in cibuildwheel * ci: bump cython lower bound in cuda_core * ci: skip tests that require llvmlite because it does not ship a free-threading build wheel * ci: remove filtering out of cuda-bindings artifacts * ci: remove redundant environment variable setting * ci: fix syntax errors in ci/test-matrix.json * ci: add optional dependency group to avoid installation of cupy when testing the FT builds * ci: remove 12.9.x from builds for now
1 parent a3f3706 commit c4f4ffe

File tree

5 files changed

+39
-9
lines changed

5 files changed

+39
-9
lines changed

.github/workflows/build-wheel.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
- "3.11"
3131
- "3.12"
3232
- "3.13"
33+
- "3.13t"
3334
name: py${{ matrix.python-version }}
3435
runs-on: ${{ (inputs.host-platform == 'linux-64' && 'linux-amd64-cpu8') ||
3536
(inputs.host-platform == 'linux-aarch64' && 'linux-arm64-cpu8') ||
@@ -116,6 +117,7 @@ jobs:
116117
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wheel}"
117118
CIBW_ENVIRONMENT: >
118119
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
120+
CIBW_ENABLE: "cpython-freethreading"
119121
with:
120122
package-dir: ./cuda_core/
121123
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
@@ -163,6 +165,7 @@ jobs:
163165
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
164166
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
165167
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wheel}"
168+
CIBW_ENABLE: "cpython-freethreading"
166169
with:
167170
package-dir: ./cuda_bindings/
168171
output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
@@ -223,6 +226,10 @@ jobs:
223226
# workaround for actions/runner-images#12377 (the cached 3.13.4 is buggy on Windows)
224227
python-version: ${{ matrix.python-version == '3.13' && '3.13.5' || matrix.python-version }}
225228

229+
- name: verify free-threaded build
230+
if: endsWith(matrix.python-verison, 't')
231+
run: python -c 'import sys; assert not sys._is_gil_enabled()'
232+
226233
- name: Set up Python include paths
227234
run: |
228235
if [[ "${{ inputs.host-platform }}" == linux* ]]; then

ci/test-matrix.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
{ "ARCH": "amd64", "PY_VER": "3.12", "CUDA_VER": "13.0.1", "LOCAL_CTK": "0", "GPU": "l4", "DRIVER": "latest" },
1515
{ "ARCH": "amd64", "PY_VER": "3.13", "CUDA_VER": "12.9.1", "LOCAL_CTK": "0", "GPU": "l4", "DRIVER": "latest" },
1616
{ "ARCH": "amd64", "PY_VER": "3.13", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
17+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
1718
{ "ARCH": "arm64", "PY_VER": "3.9", "CUDA_VER": "12.9.1", "LOCAL_CTK": "0", "GPU": "a100", "DRIVER": "latest" },
1819
{ "ARCH": "arm64", "PY_VER": "3.9", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "a100", "DRIVER": "latest" },
1920
{ "ARCH": "arm64", "PY_VER": "3.10", "CUDA_VER": "12.9.1", "LOCAL_CTK": "1", "GPU": "a100", "DRIVER": "latest" },
@@ -23,7 +24,8 @@
2324
{ "ARCH": "arm64", "PY_VER": "3.12", "CUDA_VER": "12.9.1", "LOCAL_CTK": "1", "GPU": "a100", "DRIVER": "latest" },
2425
{ "ARCH": "arm64", "PY_VER": "3.12", "CUDA_VER": "13.0.1", "LOCAL_CTK": "0", "GPU": "a100", "DRIVER": "latest" },
2526
{ "ARCH": "arm64", "PY_VER": "3.13", "CUDA_VER": "12.9.1", "LOCAL_CTK": "0", "GPU": "a100", "DRIVER": "latest" },
26-
{ "ARCH": "arm64", "PY_VER": "3.13", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "a100", "DRIVER": "latest" }
27+
{ "ARCH": "arm64", "PY_VER": "3.13", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "a100", "DRIVER": "latest" },
28+
{ "ARCH": "arm64", "PY_VER": "3.13t", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "a100", "DRIVER": "latest" }
2729
],
2830
"nightly": [
2931
{ "ARCH": "amd64", "PY_VER": "3.9", "CUDA_VER": "11.8.0", "LOCAL_CTK": "0", "GPU": "l4", "DRIVER": "earliest" },
@@ -51,6 +53,11 @@
5153
{ "ARCH": "amd64", "PY_VER": "3.13", "CUDA_VER": "12.0.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
5254
{ "ARCH": "amd64", "PY_VER": "3.13", "CUDA_VER": "12.9.1", "LOCAL_CTK": "0", "GPU": "l4", "DRIVER": "latest" },
5355
{ "ARCH": "amd64", "PY_VER": "3.13", "CUDA_VER": "12.9.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
56+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "11.8.0", "LOCAL_CTK": "0", "GPU": "l4", "DRIVER": "earliest" },
57+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "11.8.0", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
58+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "12.0.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
59+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "12.9.1", "LOCAL_CTK": "0", "GPU": "l4", "DRIVER": "latest" },
60+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "12.9.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
5461
{ "ARCH": "arm64", "PY_VER": "3.9", "CUDA_VER": "11.8.0", "LOCAL_CTK": "0", "GPU": "a100", "DRIVER": "earliest" },
5562
{ "ARCH": "arm64", "PY_VER": "3.9", "CUDA_VER": "11.8.0", "LOCAL_CTK": "1", "GPU": "a100", "DRIVER": "latest" },
5663
{ "ARCH": "arm64", "PY_VER": "3.9", "CUDA_VER": "12.0.1", "LOCAL_CTK": "1", "GPU": "a100", "DRIVER": "latest" },
@@ -88,13 +95,17 @@
8895
{ "ARCH": "amd64", "PY_VER": "3.12", "CUDA_VER": "12.9.1", "LOCAL_CTK": "0", "GPU": "l4", "DRIVER": "latest" },
8996
{ "ARCH": "amd64", "PY_VER": "3.12", "CUDA_VER": "12.9.1", "LOCAL_CTK": "1", "GPU": "t4", "DRIVER": "latest" },
9097
{ "ARCH": "amd64", "PY_VER": "3.13", "CUDA_VER": "13.0.1", "LOCAL_CTK": "0", "GPU": "t4", "DRIVER": "latest" },
91-
{ "ARCH": "amd64", "PY_VER": "3.13", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" }
98+
{ "ARCH": "amd64", "PY_VER": "3.13", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
99+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "13.0.1", "LOCAL_CTK": "0", "GPU": "t4", "DRIVER": "latest" },
100+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" }
92101
],
93102
"nightly": [
94103
{ "ARCH": "amd64", "PY_VER": "3.12", "CUDA_VER": "11.8.0", "LOCAL_CTK": "0", "GPU": "l4", "DRIVER": "latest" },
95104
{ "ARCH": "amd64", "PY_VER": "3.12", "CUDA_VER": "11.8.0", "LOCAL_CTK": "1", "GPU": "t4", "DRIVER": "latest" },
96105
{ "ARCH": "amd64", "PY_VER": "3.12", "CUDA_VER": "12.9.1", "LOCAL_CTK": "0", "GPU": "t4", "DRIVER": "latest" },
97-
{ "ARCH": "amd64", "PY_VER": "3.12", "CUDA_VER": "12.9.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" }
106+
{ "ARCH": "amd64", "PY_VER": "3.12", "CUDA_VER": "12.9.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" },
107+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "13.0.1", "LOCAL_CTK": "0", "GPU": "t4", "DRIVER": "latest" },
108+
{ "ARCH": "amd64", "PY_VER": "3.13t", "CUDA_VER": "13.0.1", "LOCAL_CTK": "1", "GPU": "l4", "DRIVER": "latest" }
98109
]
99110
}
100111
}

ci/tools/run-tests

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,18 @@ elif [[ "${test_module}" == "core" ]]; then
7777
echo "Installing core wheel"
7878
pwd
7979
ls
80+
81+
FREE_THREADING=""
82+
if python -c 'import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then
83+
FREE_THREADING+="-ft"
84+
fi
85+
8086
if [[ "${LOCAL_CTK}" == 1 ]]; then
8187
# We already installed cuda-bindings, and all CTK components exist locally,
8288
# so just install the test dependencies.
83-
pip install $(ls *.whl)["test-cu${TEST_CUDA_MAJOR}"]
89+
pip install $(ls *.whl)["test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}"]
8490
else
85-
pip install $(ls *.whl)["cu${TEST_CUDA_MAJOR}","test-cu${TEST_CUDA_MAJOR}"]
91+
pip install $(ls *.whl)["cu${TEST_CUDA_MAJOR}","test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}"]
8692
fi
8793
popd
8894
pushd ./cuda_core

cuda_bindings/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
33

44
[build-system]
5-
requires = ["setuptools>=77.0.0", "cython>=3.0,<3.1.0", "pyclibrary>=0.1.7"]
5+
requires = ["setuptools>=77.0.0", "cython>=3.1,<3.2", "pyclibrary>=0.1.7"]
66
build-backend = "setuptools.build_meta"
77

88
[project]
@@ -37,7 +37,7 @@ all = [
3737
]
3838

3939
test = [
40-
"cython>=3.0,<3.1.0",
40+
"cython>=3.1,<3.2",
4141
"setuptools>=77.0.0",
4242
"numpy>=1.21.1",
4343
"pytest>=6.2.4",

cuda_core/pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
[build-system]
6-
requires = ["setuptools>=77.0.0", "Cython>=3.0"]
6+
requires = ["setuptools>=77.0.0", "Cython>=3.1"]
77
build-backend = "setuptools.build_meta"
88

99

@@ -49,10 +49,16 @@ dependencies = [
4949
cu11 = ["cuda-bindings[all]==11.8.*"]
5050
cu12 = ["cuda-bindings[all]==12.*"]
5151
cu13 = ["cuda-bindings[all]==13.*"]
52-
test = ["cython>=3.0", "setuptools", "pytest>=6.2.4"]
52+
# TODO: these should all be in development dependencies; optional dependencies
53+
# are for features exposed to *users*, not a dumping ground for all tooling
54+
# needed to build and test the project
55+
test = ["cython>=3.1", "setuptools", "pytest>=6.2.4"]
5356
test-cu11 = ["cuda-core[test]", "cupy-cuda11x", "cuda-toolkit[cudart]==11.*"] # runtime headers needed by CuPy
5457
test-cu12 = ["cuda-core[test]", "cupy-cuda12x", "cuda-toolkit[cudart]==12.*"] # runtime headers needed by CuPy
5558
test-cu13 = ["cuda-core[test]", "cupy-cuda13x", "cuda-toolkit[cudart]==13.*"] # runtime headers needed by CuPy
59+
# free threaded build, cupy doesn't support free-threaded builds yet, so avoid installing it for now
60+
# TODO: cupy should support free threaded builds
61+
test-cu13-ft = ["cuda-core[test]", "cuda-toolkit[cudart]==13.*"]
5662

5763
[project.urls]
5864
homepage = "https://nvidia.github.io/cuda-python/"

0 commit comments

Comments
 (0)