Skip to content

Commit e2ae412

Browse files
committed
Merge main into rwgk/orin-ctk-13-4-tests
Resolve the VMM test conflict by adopting the upstream handle-layer regressions. Their exact mapping and reservation release checks supersede the cached warm-up and device-wide free-memory measurement. Preserve the Orin NVML fixes and UUID release note.
2 parents 66bf6bb + de7d561 commit e2ae412

43 files changed

Lines changed: 3422 additions & 1005 deletions

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-docs.yml‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,6 @@ jobs:
309309
if: ${{ !inputs.is-release && startsWith(github.ref_name, 'pull-request/') }}
310310
uses: lycheeverse/lychee-action@6da1d14f3a43098a294b7696d93d938aa8d20fc0 # unreleased: supports v0.24.x archive layout
311311
with:
312-
# PR-preview canonical URLs are checked by the preview deployment workflow.
313-
# The cuda-bindings #id links are docutils "problematic" anchors from generated API docs.
314-
# TODO: Remove this exclusion after cybind stops emitting those problematic anchors.
315-
# Preferred Networks rejects hosted-runner GETs, but the URL is browser reachable.
316312
args: >-
317313
--files-from ${{ github.workspace }}/lychee-rendered-html-files.txt
318314
--include-fragments=full
@@ -325,9 +321,7 @@ jobs:
325321
--retry-wait-time 5
326322
--timeout 30
327323
--no-progress
328-
--exclude '^https://nvidia\.github\.io/cuda-python/pr-preview/pr-[0-9]+/'
329-
--exclude '^file://.*/cuda-bindings/latest/module/(driver|runtime)\.html#id[0-9]+$'
330-
--exclude '^https://www\.preferred\.jp/en/?$'
324+
--config ${{ github.workspace }}/lychee.toml
331325
fail: true
332326
failIfEmpty: true
333327
format: markdown

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ jobs:
6767
(inputs.host-platform == 'win-64' && 'windows-2022') ||
6868
(inputs.host-platform == 'win-arm64' && 'windows-11-arm') }}
6969
steps:
70+
- name: Enable Git symlinks (Windows, must precede checkout)
71+
if: ${{ startsWith(inputs.host-platform, 'win') }}
72+
run: git config --global core.symlinks true
73+
7074
- name: Checkout ${{ github.event.repository.name }}
7175
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
7276
with:

‎.github/workflows/ci-pixi-source-test.yml‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,23 @@ jobs:
154154
done
155155
# The last build was cu13, and each major must have kept its own
156156
# generated sources rather than overwriting the other's.
157-
stamp=$(cat cuda_core/build/.build-cuda-major)
158-
if [ "${stamp}" != "13" ]; then
159-
echo "::error::build stamp is '${stamp}', expected 13"
157+
# Stamp is ABI-scoped (.build-config.<EXT_SUFFIX>). Unset and gnu
158+
# both record as "gnu"; llvm records as "llvm".
159+
shopt -s nullglob
160+
stamps=(cuda_core/build/.build-config.*)
161+
if (( ${#stamps[@]} != 1 )); then
162+
echo "::error::expected one ABI stamp, found: ${stamps[*]:-none}"
160163
exit 1
161164
fi
165+
stamp=$(<"${stamps[0]}")
166+
if [[ ! "${stamp}" =~ ^cu13-(gnu|llvm)-(debug|opt)(-cov)?$ ]]; then
167+
echo "::error::build stamp is '${stamp}', expected cu13-{gnu|llvm}-{debug|opt}"
168+
exit 1
169+
fi
170+
suffix="${stamp#cu13-}"
162171
for major in cu12 cu13; do
163-
if [ ! -d "cuda_core/build/cython/${major}" ]; then
164-
echo "::error::no ${major} generated-source directory"
172+
if [ ! -d "cuda_core/build/cython/${major}-${suffix}" ]; then
173+
echo "::error::no ${major}-${suffix} generated-source directory"
165174
exit 1
166175
fi
167176
done

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
timeout-minutes: 60
4444
runs-on: windows-2022
4545
steps:
46+
- name: Enable Git symlinks (Windows, must precede checkout)
47+
run: git config --global core.symlinks true
48+
4649
- name: Checkout ${{ github.event.repository.name }}
4750
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4851
with:

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ jobs:
105105
continue-on-error: ${{ startsWith(matrix.PY_VER, '3.15') }}
106106
runs-on: "windows-${{ matrix.ARCH }}-gpu-${{ matrix.GPU }}-${{ matrix.RUNNER_DRIVER }}-${{ matrix.GPU_COUNT }}"
107107
steps:
108+
- name: Enable Git symlinks (Windows, must precede checkout)
109+
run: git config --global core.symlinks true
110+
108111
- name: Checkout ${{ github.event.repository.name }}
109112
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
110113
with:

‎CONTRIBUTING.md‎

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of
2323
- [Recommended clone](#recommended-clone)
2424
- [Fixing an existing clone](#fixing-an-existing-clone)
2525
- [Symptoms of a bad clone](#symptoms-of-a-bad-clone)
26+
- [Development on Windows](#development-on-windows)
27+
- [Enabling git symlinks](#enabling-git-symlinks)
28+
- [Pre-commit lychee workaround](#pre-commit-lychee-workaround)
2629
- [Type stubs for cuda.core](#type-stubs-for-cudacore)
2730
- [Pre-commit](#pre-commit)
28-
- [Pre-commit on Windows](#pre-commit-on-windows)
2931
- [Pixi lockfiles](#pixi-lockfiles)
3032
- [Signing Your Work](#signing-your-work)
3133
- [Code signing](#code-signing)
@@ -42,6 +44,11 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of
4244

4345
## Cloning the repository
4446

47+
> **Windows contributors (not WSL):** configure Git for symlinks *before*
48+
> cloning, or the shared PEP 517 build-hook file lands as a text stub instead
49+
> of a working symlink. See [Enabling git symlinks](#enabling-git-symlinks)
50+
> under Development on Windows.
51+
4552
Every package in this repository derives its version from git tags using
4653
[`setuptools-scm`](https://setuptools-scm.readthedocs.io/), so **how you clone
4754
determines whether you can build at all, and whether the version you build is
@@ -128,6 +135,63 @@ hyphens replaced by underscores: `..._FOR_CUDA_BINDINGS`, `..._FOR_CUDA_CORE`,
128135
genuinely cannot provide tags; it is not a substitute for a correct clone.
129136

130137

138+
## Development on Windows
139+
140+
This section collects the Windows-specific setup a contributor needs when
141+
working outside of WSL. WSL contributors can follow the Linux flow in the rest
142+
of this document.
143+
144+
### Enabling git symlinks
145+
146+
The `cuda_core` PEP 517 backend shares source-of-truth helper files with
147+
`cuda_bindings` via symbolic links. Git materializes symlinks by default on
148+
Linux and macOS, but on Windows it needs to be configured before cloning,
149+
otherwise the "symlinks" land in your working tree as plain text files that
150+
contain the target path — enough to look right in `git status`, but not enough
151+
to actually build.
152+
153+
1. **[Activate Developer Mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development#activate-developer-mode)**
154+
so Git can create symlinks without Administrator privileges.
155+
156+
2. **Enable Git symlink support globally** so newly-cloned repositories inherit
157+
the setting:
158+
159+
```console
160+
$ git config --global core.symlinks true
161+
```
162+
163+
Then clone as usual (see [Cloning the repository](#cloning-the-repository)).
164+
165+
If you already cloned without these settings, note that `git clone` probes
166+
symlink support at clone time and writes `core.symlinks=false` into the
167+
repo-local config when the probe fails. Repo-local config overrides
168+
`--global`, so you must clear it *inside the existing clone* — the global
169+
setting alone won't take effect:
170+
171+
```console
172+
$ git config core.symlinks true # no --global — clears the repo-local override
173+
$ git rm --cached cuda_core/_build_shared.py
174+
$ git checkout HEAD -- cuda_core/_build_shared.py
175+
```
176+
177+
In practice, deleting the checkout and re-cloning after the two steps at
178+
the top of this section (Developer Mode + `git config --global core.symlinks
179+
true`) is usually simpler and less error-prone than repairing an existing
180+
clone in place.
181+
182+
### Pre-commit lychee workaround
183+
184+
For development on Windows (not WSL), the `lychee` pre-commit task will not
185+
work when running `pre-commit run --all-files`. This problem does not occur
186+
if you install the pre-commit hook and run it automatically as part of your
187+
`git commit` workflow. To resolve this, you can either:
188+
189+
1. Run `pre-commit` in Git Bash, rather than directly in PowerShell or cmd
190+
191+
2. Skip it by setting the environment variable `SKIP` to `lychee`. This would
192+
be `$env:SKIP = "lychee"` in PowerShell or `set SKIP=lychee` in cmd.
193+
194+
131195
## Type stubs for cuda.core
132196

133197
`cuda.core` is a PEP 561-compliant package: it ships a `py.typed` marker and
@@ -168,17 +232,7 @@ between commits, leaving stale headers or out-of-date stubs in the history.
168232
If the hook isn't installed, `pre-commit run` (and CI) will print a visible
169233
warning reminding you to run `pre-commit install`.
170234

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

183237
## Pixi lockfiles
184238

‎ci/tools/run-tests‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,12 @@ elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then
167167
echo "Installing pathfinder + bindings + core + test deps + numba-cuda"
168168
# numba-cuda's test-cuXX group deps (can't use --group for a wheel install):
169169
# numpy<2.5: numba-cuda 0.30.4 references np.row_stack, removed in numpy 2.5. See NVIDIA/numba-cuda#907.
170+
# numba<0.67: numba-cuda 0.30.4 only supports Numba through 0.66. See NVIDIA/numba-cuda#940.
170171
PIP_ARGS+=(
171172
"cuda-toolkit[curand,cublas]==${TEST_CUDA_MAJOR_MINOR}.*"
172173
"numba-cuda[cu${TEST_CUDA_MAJOR}]"
173174
"cupy-cuda${TEST_CUDA_MAJOR}x"
175+
"numba<0.67"
174176
"numpy<2.5"
175177
psutil cffi pytest-xdist pytest-benchmark filecheck ml_dtypes statistics
176178
)

‎cuda_bindings/build_hooks.py‎

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import hashlib
1515
import os
1616
import re
17+
import shlex
1718
import shutil
1819
import sys
1920
import sysconfig
@@ -204,8 +205,42 @@ def _resolve_toolchain_name():
204205
return name, allowed, cc, cxx, explicit
205206

206207

208+
def _with_compiler(command, compiler):
209+
"""Replace the leading compiler on a linker command; keep flags.
210+
211+
Conda ``LDCXXSHARED`` looks like ``g++ -pthread -B .../python_compiler_compat
212+
-shared ...``. Only the executable changes so those flags stay on the
213+
link line. The command is tokenized with shlex so quoted arguments
214+
survive, and a leading ``env VAR=value`` prefix is preserved. CC/CXX are
215+
not rewritten this way: they may already be a launcher plus compiler
216+
(``sccache cc``).
217+
"""
218+
if not command or not command.strip():
219+
return compiler
220+
parts = shlex.split(command)
221+
# Keep an ``env VAR=value ...`` prefix: setuptools' C++ link step splits it
222+
# off before it substitutes the compiler, so it still reaches the link line.
223+
prefix_end = 0
224+
if parts and os.path.basename(parts[0]) == "env":
225+
prefix_end = 1
226+
# Match setuptools' _split_env: any token with ``=`` is an env operand
227+
# (covers both ``VAR=value`` and ``--unset=VAR`` long options).
228+
while prefix_end < len(parts) and "=" in parts[prefix_end]:
229+
prefix_end += 1
230+
# Everything else before the first flag is the old compiler (or a launcher
231+
# for it; setuptools takes the launcher from CXX instead).
232+
i = prefix_end
233+
while i < len(parts) and not parts[i].startswith("-"):
234+
i += 1
235+
return shlex.join([*parts[:prefix_end], compiler, *parts[i:]])
236+
237+
207238
def _with_sccache(current, compiler):
208-
"""Keep CC="sccache cc" as CC="sccache clang" when the toolchain picks a compiler."""
239+
"""Keep a leading sccache token when the toolchain picks a compiler.
240+
241+
CI sets ``CC="sccache cc"`` or ``CC="/host/.../sccache cc"``. An explicit
242+
toolchain then becomes ``CC="sccache clang"`` rather than a bare compiler.
243+
"""
209244
if current:
210245
launcher = current.split()[0]
211246
if os.path.basename(launcher) == "sccache":
@@ -214,18 +249,28 @@ def _with_sccache(current, compiler):
214249

215250

216251
def _apply_toolchain_env(cc, cxx, explicit):
217-
"""Set CC/CXX/LDSHARED for an explicitly-chosen toolchain.
252+
"""Set CC/CXX/LDCXXSHARED for an explicitly-chosen toolchain.
218253
219254
The default path (CUDA_PYTHON_TOOLCHAIN unset) intentionally
220255
does not touch the env, so an externally-set compiler (e.g.
221256
CC="sccache cc" in CI) keeps working. An explicit CUDA_PYTHON_TOOLCHAIN
222-
override (incl. =gnu) governs the compiler. An existing sccache prefix
223-
is kept (CC="sccache cc" + llvm -> CC="sccache clang").
257+
override (incl. =gnu) sets CC/CXX to the toolchain compiler; an existing
258+
sccache prefix is kept (CC="sccache cc" + llvm -> CC="sccache clang").
259+
Extras on LDCXXSHARED (rpath, -pthread, -B, ...) are kept, taken from the
260+
environment if set there and from sysconfig otherwise; only the compiler
261+
is swapped. LDSHARED is left unset so distutils rewrites it from CC.
224262
"""
225263
if explicit and cc is not None:
226264
os.environ["CC"] = _with_sccache(os.environ.get("CC", ""), cc)
227265
os.environ["CXX"] = _with_sccache(os.environ.get("CXX", ""), cxx)
228-
os.environ["LDSHARED"] = f"{os.environ['CXX']} -shared"
266+
# An LDCXXSHARED the user already exported takes precedence over
267+
# sysconfig's, as CC/CXX do; either way only the compiler is swapped.
268+
ldcxxshared = (
269+
os.environ.get("LDCXXSHARED")
270+
or sysconfig.get_config_var("LDCXXSHARED")
271+
or sysconfig.get_config_var("LDSHARED")
272+
)
273+
os.environ["LDCXXSHARED"] = _with_compiler(ldcxxshared, cxx) if ldcxxshared else f"{cxx} -shared"
229274

230275

231276
def _check_toolchain_available(name):
@@ -381,9 +426,9 @@ def _resolve_toolchain(debug=False, compile_for_coverage=False):
381426
382427
Returns (name, cc, cxx, extra_compile_args, extra_link_args). The default
383428
toolchain (gnu on Linux, msvc on Windows) reproduces the previous build
384-
behavior and does not touch CC/CXX/LDSHARED, so an externally-set compiler
429+
behavior and does not touch CC/CXX/LDCXXSHARED, so an externally-set compiler
385430
(e.g. CC="sccache cc") keeps working. A non-default toolchain (llvm on
386-
Linux) selects clang/clang++ and lld and sets CC/CXX/LDSHARED so distutils'
431+
Linux) selects clang/clang++ and lld and sets CC/CXX/LDCXXSHARED so distutils'
387432
customize_compiler picks them up.
388433
"""
389434
name, _allowed, cc, cxx, explicit = _resolve_toolchain_name()

‎cuda_bindings/examples/extra/iso_fd_modelling.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@
99
# ################################################################################
1010

1111
# /// script
12-
# dependencies = ["cuda_bindings>13.2.1", "numpy", "matplotlib"]
12+
# dependencies = ["cuda_bindings>13.2.1", "numpy"]
1313
# ///
1414

1515
import time
1616

1717
import numpy as np
1818

19+
try:
20+
# Optional: only needed to plot the result
21+
import matplotlib.pyplot as plt
22+
except ImportError:
23+
plt = None
24+
1925
from cuda.bindings import driver as cuda
2026
from cuda.bindings import runtime as cudart
2127
from cuda.bindings._example_helpers import KernelHelper, check_cuda_errors, requirement_not_met
@@ -769,8 +775,6 @@ def main():
769775
##
770776
## those are to plot results
771777
##
772-
import matplotlib.pyplot as plt
773-
774778
fig, ax = plt.subplots()
775779
title = "test fd kernels up to " + str(pars.tmax_propag) + " ms "
776780
plt.title(title, fontsize=20)
@@ -793,6 +797,6 @@ def main():
793797

794798

795799
if __name__ == "__main__":
796-
display_graph = True
800+
display_graph = plt is not None
797801
verbose_prints = True
798802
main()

‎cuda_bindings/pyproject.toml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ all = [
4545
test = [
4646
"cython>=3.2.5,<3.3",
4747
"setuptools>=80.0.0",
48-
# TODO: remove the Python 3.15 guard once 3.15 is officially supported
49-
"matplotlib>=3.5.0,<=3.10.9; python_version < '3.15'",
5048
# <=2.6.0.dev0 admits scientific-python nightlies (for Python 3.15)
5149
"numpy>=1.21.1,<=2.6.0.dev0",
5250
"pytest==9.1.0",

0 commit comments

Comments
 (0)