diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index 0bddead973..b2e39a10b8 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -329,7 +329,7 @@ def do_cythonize(extensions): return cythonize( extensions, nthreads=nthreads, - compiler_directives=dict(language_level=3, embedsignature=True, binding=True), + compiler_directives=dict(language_level=3, embedsignature=True, binding=True, freethreading_compatible=True), **extra_cythonize_kwargs, ) diff --git a/cuda_bindings/tests/cython/build_tests.bat b/cuda_bindings/tests/cython/build_tests.bat index c56efac47f..fda860506e 100644 --- a/cuda_bindings/tests/cython/build_tests.bat +++ b/cuda_bindings/tests/cython/build_tests.bat @@ -5,5 +5,5 @@ REM SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE setlocal set CL=%CL% /I"%CUDA_HOME%\include" - cythonize -3 -i %~dp0test_*.pyx + cythonize -3 -i -Xfreethreading_compatible=True %~dp0test_*.pyx endlocal diff --git a/cuda_bindings/tests/cython/build_tests.sh b/cuda_bindings/tests/cython/build_tests.sh index 50a16b6930..1e08f35955 100755 --- a/cuda_bindings/tests/cython/build_tests.sh +++ b/cuda_bindings/tests/cython/build_tests.sh @@ -14,4 +14,4 @@ else exit 1 fi -cythonize -3 -i ${SCRIPTPATH}/test_*.pyx +cythonize -3 -i -Xfreethreading_compatible=True ${SCRIPTPATH}/test_*.pyx diff --git a/cuda_core/build_hooks.py b/cuda_core/build_hooks.py index ab54e4bca2..e38f5676df 100644 --- a/cuda_core/build_hooks.py +++ b/cuda_core/build_hooks.py @@ -101,7 +101,7 @@ def get_cuda_paths(): verbose=True, language_level=3, nthreads=nthreads, - compiler_directives={"embedsignature": True, "warn.deprecated.IF": False}, + compiler_directives={"embedsignature": True, "warn.deprecated.IF": False, "freethreading_compatible": True}, compile_time_env=compile_time_env, ) diff --git a/cuda_core/pyproject.toml b/cuda_core/pyproject.toml index 8bbfca07d6..5f12f6f120 100644 --- a/cuda_core/pyproject.toml +++ b/cuda_core/pyproject.toml @@ -51,7 +51,7 @@ cu12 = ["cuda-bindings[all]==12.*"] cu13 = ["cuda-bindings[all]==13.*"] [dependency-groups] -test = ["cython>=3.0", "setuptools", "pytest>=6.2.4"] +test = ["cython>=3.1", "setuptools", "pytest>=6.2.4"] test-cu12 = ["cuda-core[test]", "cupy-cuda12x; python_version < '3.14'", "cuda-toolkit[cudart]==12.*"] # runtime headers needed by CuPy test-cu13 = ["cuda-core[test]", "cupy-cuda13x; python_version < '3.14'", "cuda-toolkit[cudart]==13.*"] # runtime headers needed by CuPy # free threaded build, cupy doesn't support free-threaded builds yet, so avoid installing it for now diff --git a/cuda_core/tests/cython/build_tests.sh b/cuda_core/tests/cython/build_tests.sh index 1c36259c08..eb3303840d 100755 --- a/cuda_core/tests/cython/build_tests.sh +++ b/cuda_core/tests/cython/build_tests.sh @@ -15,4 +15,4 @@ else exit 1 fi -cythonize -3 -i ${SCRIPTPATH}/test_*.pyx +cythonize -3 -i -Xfreethreading_compatible=True ${SCRIPTPATH}/test_*.pyx