Skip to content

Commit ad4658b

Browse files
committed
Merge remote-tracking branch 'origin/main' into ajost/context-safe-buffer-cleanup
2 parents fec0ca4 + 51141c8 commit ad4658b

71 files changed

Lines changed: 3320 additions & 1451 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/build-wheel.yml‎

Lines changed: 11 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jobs:
166166
cuda-version: ${{ inputs.cuda-version }}
167167

168168
- name: Build cuda.bindings wheel
169-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
169+
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
170170
with:
171171
package-dir: ./cuda_bindings/
172172
output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
@@ -234,7 +234,7 @@ jobs:
234234
if-no-files-found: error
235235

236236
- name: Build cuda.core wheel
237-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
237+
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
238238
with:
239239
package-dir: ./cuda_core/
240240
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
@@ -338,13 +338,16 @@ jobs:
338338
id: setup-python2
339339
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
340340
with:
341-
# TODO: Pin beta.2 precisely until cibuildwheel catches up (b4 broke ABI for Cython);
342-
# this precise pin requires the explicit `freethreaded`.
343-
# When 3.15 is officially supported we can also remove the `allow-prereleases` override.
344-
python-version: ${{ startsWith(matrix.python-version, '3.15') && '3.15.0-beta.2' || matrix.python-version }}
345-
freethreaded: ${{ endsWith(matrix.python-version, 't') }}
341+
python-version: ${{ matrix.python-version }}
342+
# TODO: remove allow-prereleases once 3.15 is officially supported
346343
allow-prereleases: ${{ startsWith(matrix.python-version, '3.15') }}
347344

345+
- name: Enable Scientific Python Nightly Wheels for Python 3.15
346+
if: ${{ startsWith(matrix.python-version, '3.15') }}
347+
run: |
348+
echo "PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" >> "$GITHUB_ENV"
349+
echo "PIP_ONLY_BINARY=numpy" >> "$GITHUB_ENV"
350+
348351
- name: verify free-threaded build
349352
if: endsWith(matrix.python-version, 't')
350353
run: python -c 'import sys; assert not sys._is_gil_enabled()'
@@ -370,64 +373,6 @@ jobs:
370373
mv "/c/Program Files/Git/usr/bin/link.exe" "/c/Program Files/Git/usr/bin/link.exe.bak"
371374
fi
372375
373-
# TODO: remove the numpy pre-build steps once 3.15 is officially supported
374-
# (numpy will publish pre-built 3.15 wheels at that point)
375-
- name: Download and patch numpy sdist (pre-release Python)
376-
if: ${{ startsWith(matrix.python-version, '3.15') }}
377-
run: |
378-
pip download --no-binary numpy --no-deps "numpy>=1.21.1" -d numpy-sdist/
379-
cd numpy-sdist && tar xf numpy-*.tar.gz && rm numpy-*.tar.gz
380-
# WAR: numpy 2.4.x ships [tool.cibuildwheel] config that is
381-
# incompatible with cibuildwheel v4.0 (cpython-freethreading enable
382-
# group, OpenBLAS before-build scripts, etc.). Strip the cibuildwheel
383-
# sections but preserve [tool.meson-python] (vendored meson path).
384-
python -c "
385-
import glob
386-
for f in glob.glob('numpy-*/pyproject.toml'):
387-
lines, skip = open(f).readlines(), False
388-
out = []
389-
for line in lines:
390-
hdr = line.strip()
391-
if hdr.startswith('[tool.cibuildwheel') or hdr.startswith('[[tool.cibuildwheel'):
392-
skip = True
393-
continue
394-
if skip and hdr.startswith('[') and 'cibuildwheel' not in hdr:
395-
skip = False
396-
if not skip:
397-
out.append(line)
398-
open(f, 'w').writelines(out)
399-
"
400-
echo "NUMPY_SRC_DIR=$(pwd)/$(ls -d numpy-*/)" >> $GITHUB_ENV
401-
402-
- name: Build numpy wheel (pre-release Python)
403-
if: ${{ startsWith(matrix.python-version, '3.15') }}
404-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
405-
env:
406-
CIBW_BUILD: ${{ env.CIBW_BUILD }}
407-
CIBW_SKIP: "*-musllinux* *-win32"
408-
CIBW_ARCHS_LINUX: "native"
409-
CIBW_BUILD_VERBOSITY: 1
410-
CIBW_CONFIG_SETTINGS: "setup-args=-Dallow-noblas=true"
411-
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv setup-args=-Dallow-noblas=true"
412-
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
413-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
414-
CIBW_ENABLE: "cpython-prerelease"
415-
with:
416-
package-dir: ${{ env.NUMPY_SRC_DIR }}
417-
output-dir: numpy-wheel/
418-
419-
- name: Upload numpy wheel
420-
if: ${{ startsWith(matrix.python-version, '3.15') }}
421-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
422-
with:
423-
name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }}
424-
path: numpy-wheel/*.whl
425-
if-no-files-found: error
426-
427-
- name: Install numpy wheel
428-
if: ${{ startsWith(matrix.python-version, '3.15') }}
429-
run: pip install numpy-wheel/*.whl
430-
431376
- name: Build cuda.bindings Cython tests
432377
run: |
433378
pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings/pyproject.toml:test
@@ -508,7 +453,7 @@ jobs:
508453
rmdir $OLD_BASENAME
509454
510455
- name: Build cuda.core wheel
511-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
456+
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
512457
with:
513458
package-dir: ./cuda_core/
514459
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}

‎.github/workflows/ci.yml‎

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ jobs:
255255
GH_TOKEN: ${{ github.token }}
256256
run: |
257257
# --paginate fetches all pages; jq outputs one name per line per page;
258-
# head -1 takes the first (newest) match since GitHub returns tags
259-
# newest-first. Fails hard if no cuda-core-v* tag is found.
258+
# sed prints the first (newest) match while consuming all pages, so
259+
# gh can complete without SIGPIPE. Fails if no cuda-core-v* tag is found.
260260
tag="$(gh api "repos/$GITHUB_REPOSITORY/tags" --paginate \
261261
--jq '.[] | select(.name | startswith("cuda-core-v")) | .name' \
262-
| head -1)"
262+
| sed -n '1p')"
263263
if [[ -z "${tag}" ]]; then
264264
echo "::error::No cuda-core-v* tag found in the repository." >&2
265265
exit 1
@@ -501,6 +501,38 @@ jobs:
501501
with:
502502
is-release: ${{ github.ref_type == 'tag' }}
503503

504+
precommit-windows:
505+
name: Pre-commit on Windows
506+
runs-on: windows-latest
507+
if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) }}
508+
needs:
509+
- should-skip
510+
permissions:
511+
contents: read
512+
steps:
513+
- name: Checkout repository
514+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
515+
with:
516+
fetch-depth: 1
517+
persist-credentials: false
518+
519+
- name: Set up Python
520+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
521+
with:
522+
python-version: '3.13'
523+
524+
- name: Install pre-commit
525+
shell: bash
526+
run: |
527+
set -euxo pipefail
528+
python -m pip install --upgrade pip pre-commit
529+
530+
- name: Run pre-commit
531+
shell: bash
532+
run: |
533+
set -euxo pipefail
534+
SKIP=lychee pre-commit run --all-files
535+
504536
checks:
505537
name: Check job status
506538
if: always()
@@ -514,6 +546,7 @@ jobs:
514546
- test-linux-aarch64
515547
- test-windows
516548
- doc
549+
- precommit-windows
517550
steps:
518551
- name: Exit
519552
run: |
@@ -546,6 +579,7 @@ jobs:
546579
check_result "should-skip" "success" "${{ needs.should-skip.result }}"
547580
check_result "detect-changes" "success" "${{ needs.detect-changes.result }}"
548581
check_result "doc" "success" "${{ needs.doc.result }}"
582+
check_result "precommit-windows" "success" "${{ needs.precommit-windows.result }}"
549583
550584
# [doc-only] flips these from 'success' to 'skipped'
551585
if [[ "$doc_only" == "true" ]]; then expected="skipped"; else expected="success"; fi

‎.github/workflows/test-wheel-linux.yml‎

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,19 @@ jobs:
296296
- name: Set up Python ${{ matrix.PY_VER }}
297297
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
298298
with:
299-
# TODO: Pin beta.2 precisely until cibuildwheel catches up (b4 broke ABI for Cython)
300-
# this precise pin requires the explicit `freethreaded`.
301-
# When 3.15 is officially supported we can also remove the `allow-prereleases` override.
302-
python-version: ${{ startsWith(matrix.PY_VER, '3.15') && '3.15.0-beta.2' || matrix.PY_VER }}
303-
freethreaded: ${{ endsWith(matrix.PY_VER, 't') }}
299+
python-version: ${{ matrix.PY_VER }}
300+
# TODO: remove allow-prereleases once 3.15 is officially supported
304301
allow-prereleases: ${{ startsWith(matrix.PY_VER, '3.15') }}
305302
env:
306303
# we use self-hosted runners on which setup-python behaves weirdly (Python include can't be found)...
307304
AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
308305

306+
- name: Enable Scientific Python Nightly Wheels for Python 3.15
307+
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
308+
run: |
309+
echo "PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" >> "$GITHUB_ENV"
310+
echo "PIP_ONLY_BINARY=numpy" >> "$GITHUB_ENV"
311+
309312
- name: Set up mini CTK
310313
if: ${{ matrix.LOCAL_CTK == '1' }}
311314
uses: ./.github/actions/fetch_ctk
@@ -314,18 +317,6 @@ jobs:
314317
host-platform: ${{ inputs.host-platform }}
315318
cuda-version: ${{ matrix.CUDA_VER }}
316319

317-
# TODO: remove the numpy wheel steps once 3.15 is officially supported
318-
- name: Download numpy wheel (pre-release Python)
319-
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
320-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
321-
with:
322-
name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }}
323-
path: numpy-wheel
324-
325-
- name: Install numpy wheel (pre-release Python)
326-
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
327-
run: pip install numpy-wheel/*.whl
328-
329320
- name: Set up latest cuda_sanitizer_api
330321
if: ${{ env.SETUP_SANITIZER == '1' }}
331322
uses: ./.github/actions/fetch_ctk

‎.github/workflows/test-wheel-windows.yml‎

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,17 @@ jobs:
276276
- name: Set up Python ${{ matrix.PY_VER }}
277277
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
278278
with:
279-
# TODO: Pin beta.2 precisely until cibuildwheel catches up (b4 broke ABI for Cython)
280-
# this precise pin requires the explicit `freethreaded`.
281-
# When 3.15 is officially supported we can also remove the `allow-prereleases` override.
282-
python-version: ${{ startsWith(matrix.PY_VER, '3.15') && '3.15.0-beta.2' || matrix.PY_VER }}
283-
freethreaded: ${{ endsWith(matrix.PY_VER, 't') }}
279+
python-version: ${{ matrix.PY_VER }}
280+
# TODO: remove allow-prereleases once 3.15 is officially supported
284281
allow-prereleases: ${{ startsWith(matrix.PY_VER, '3.15') }}
285282

283+
- name: Enable Scientific Python Nightly Wheels for Python 3.15
284+
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
285+
shell: bash --noprofile --norc -xeuo pipefail {0}
286+
run: |
287+
echo "PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" >> "$GITHUB_ENV"
288+
echo "PIP_ONLY_BINARY=numpy" >> "$GITHUB_ENV"
289+
286290
- name: Verify LongPathsEnabled
287291
run: |
288292
$val = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled').LongPathsEnabled
@@ -300,19 +304,6 @@ jobs:
300304
host-platform: ${{ inputs.host-platform }}
301305
cuda-version: ${{ matrix.CUDA_VER }}
302306

303-
# TODO: remove the numpy wheel steps once 3.15 is officially supported
304-
- name: Download numpy wheel (pre-release Python)
305-
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
306-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
307-
with:
308-
name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }}
309-
path: numpy-wheel
310-
311-
- name: Install numpy wheel (pre-release Python)
312-
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
313-
shell: bash --noprofile --norc -xeuo pipefail {0}
314-
run: pip install numpy-wheel/*.whl
315-
316307
- name: Set up test repetition on nightly runs
317308
shell: bash --noprofile --norc -xeuo pipefail {0}
318309
run: echo "PYTEST_ADDOPTS=\"--count=${{ inputs.nruns }}\"" >> "$GITHUB_ENV"

‎.pre-commit-config.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ repos:
6969

7070
- id: stubgen-pyx-cuda-core
7171
name: Generate .pyi stubs for cuda_core
72-
entry: stubgen-pyx cuda_core/cuda --continue-on-error --include-private
72+
entry: python ./toolshed/run_stubgen_pyx.py
7373
language: python
7474
files: ^cuda_core/cuda/.*\.(pyx|pxd)$
7575
pass_filenames: false
7676
additional_dependencies:
7777
- stubgen-pyx==0.2.6
78-
- Cython==3.2.4
78+
- Cython==3.2.9
7979

8080
# Link checking for authored documentation files
8181
- repo: https://github.com/lycheeverse/lychee
@@ -103,7 +103,7 @@ repos:
103103
- id: check-yaml
104104
- id: debug-statements
105105
- id: end-of-file-fixer
106-
exclude: &gen_exclude '^(?:cuda_python/README\.md|cuda_bindings/cuda/bindings/.*\.in?|cuda_bindings/docs/source/module/.*\.rst?|.*\.pyi)$'
106+
exclude: &gen_exclude '^(?:cuda_python/README\.md|(?:.*/)?CLAUDE\.md|(?:.*/)?\.git_archival\.txt|cuda_bindings/cuda/bindings/.*\.in?|cuda_bindings/docs/source/module/.*\.rst?|.*\.pyi)$'
107107
- id: mixed-line-ending
108108
- id: trailing-whitespace
109109
exclude: |

‎CONTRIBUTING.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of
2525
- [Symptoms of a bad clone](#symptoms-of-a-bad-clone)
2626
- [Type stubs for cuda.core](#type-stubs-for-cudacore)
2727
- [Pre-commit](#pre-commit)
28+
- [Pre-commit on Windows](#pre-commit-on-windows)
2829
- [Signing Your Work](#signing-your-work)
2930
- [Code signing](#code-signing)
3031
- [Developer Certificate of Origin (DCO)](#developer-certificate-of-origin-dco)
@@ -166,6 +167,17 @@ between commits, leaving stale headers or out-of-date stubs in the history.
166167
If the hook isn't installed, `pre-commit run` (and CI) will print a visible
167168
warning reminding you to run `pre-commit install`.
168169

170+
### Pre-commit on Windows
171+
172+
For development on Windows (not WSL), the `lychee` pre-commit task will not work
173+
when running `pre-commit run --all-files`. This problem does not occur if you
174+
install the pre-commit hook and run it automatically as part of your `git
175+
commit` workflow. To resolve this, you can either:
176+
177+
1. Run `pre-commit` in Git Bash, rather than directly in PowerShell or cmd
178+
179+
2. Skip it by setting the environment variable `SKIP` to `lychee`. This would
180+
be `$env:SKIP = "lychee"` in PowerShell or `set SKIP=lychee` in cmd.
169181

170182
## Signing Your Work
171183

‎ci/test-matrix.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ windows:
128128
- { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC' }
129129
- { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' }
130130
- { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' }
131+
- { ARCH: 'amd64', PY_VER: '3.15', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' }
131132
# special runners
132133
- { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 't4', GPU_COUNT: '2', DRIVER: 'latest', DRIVER_MODE: 'TCC' }
133134
- { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'h100', GPU_COUNT: '2', DRIVER: 'latest', DRIVER_MODE: 'MCDM' }

0 commit comments

Comments
 (0)