Skip to content

Commit 65d8381

Browse files
authored
Merge branch 'main' into setuptools-scm-docs
2 parents a21c5c2 + 69c8e68 commit 65d8381

36 files changed

Lines changed: 1005 additions & 63 deletions

‎.pre-commit-config.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ repos:
5050
files: ^cuda_bindings/
5151
types: [text]
5252

53+
- id: check-pixi-cuda-version
54+
name: Check pixi cuda-version pins track ci/versions.yml
55+
entry: python ./ci/tools/check_pixi_cuda_version.py
56+
language: python
57+
additional_dependencies: [pyyaml==6.0.3]
58+
files: '^(ci/versions\.yml|cuda_bindings/pixi\.toml|cuda_core/pixi\.toml)$'
59+
pass_filenames: false
60+
5361
- id: no-markdown-in-docs-source
5462
name: Prevent markdown files in docs/source directories
5563
entry: bash -c
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Check pixi cuda-version pins track ci/versions.yml (cuda.build.version)."""
5+
6+
from __future__ import annotations
7+
8+
import sys
9+
from pathlib import Path
10+
11+
import tomllib
12+
import yaml
13+
14+
ROOT = Path(__file__).resolve().parents[2]
15+
VERSIONS_FILE_PATH = ROOT / "ci" / "versions.yml"
16+
PIXI_FILES = [ROOT / d / "pixi.toml" for d in ("cuda_bindings", "cuda_core")]
17+
18+
19+
def main() -> int:
20+
"""Verify cuda_bindings/cuda_core pixi pins match ci/versions.yml."""
21+
if not VERSIONS_FILE_PATH.is_file():
22+
print(f"error: {VERSIONS_FILE_PATH} not found", file=sys.stderr)
23+
return 2
24+
try:
25+
build_version = yaml.safe_load(VERSIONS_FILE_PATH.read_text(encoding="utf-8"))["cuda"]["build"]["version"]
26+
except (KeyError, TypeError):
27+
print(f"error: cuda.build.version not found in {VERSIONS_FILE_PATH}", file=sys.stderr)
28+
return 2
29+
30+
major, minor, *_ = build_version.split(".")
31+
expected = f"{major}.{minor}.*"
32+
cuda_feature = f"cu{major}"
33+
34+
errors: list[str] = []
35+
checked: list[str] = []
36+
for path in PIXI_FILES:
37+
if not path.is_file():
38+
print(f"error: {path} not found", file=sys.stderr)
39+
return 2
40+
with path.open("rb") as f:
41+
data = tomllib.load(f)
42+
rel = path.relative_to(ROOT)
43+
try:
44+
variants = data["workspace"]["build-variants"]["cuda-version"]
45+
cuda_pin = data["feature"][cuda_feature]["dependencies"]["cuda-version"]
46+
except KeyError as exc:
47+
print(
48+
f"error: {rel} missing feature {cuda_feature!r} or cuda-version key: {exc}",
49+
file=sys.stderr,
50+
)
51+
return 2
52+
if expected not in variants:
53+
errors.append(
54+
f"{rel}: workspace.build-variants.cuda-version={variants!r} "
55+
f"does not include {expected!r} "
56+
f"(from ci/versions.yml cuda.build.version={build_version!r})"
57+
)
58+
if cuda_pin != expected:
59+
errors.append(
60+
f"{rel}: feature.{cuda_feature}.dependencies.cuda-version={cuda_pin!r} "
61+
f"!= {expected!r} "
62+
f"(from ci/versions.yml cuda.build.version={build_version!r})"
63+
)
64+
65+
checked.append(
66+
f"{rel} (workspace.build-variants.cuda-version={variants!r}, "
67+
f"feature.{cuda_feature}.dependencies.cuda-version={cuda_pin!r})"
68+
)
69+
70+
if errors:
71+
print(
72+
f"error: cuda_bindings/cuda_core pixi cuda-version pins out of sync with "
73+
f"ci/versions.yml cuda.build.version={build_version!r} "
74+
f"(expected pin {expected!r}):",
75+
file=sys.stderr,
76+
)
77+
for err in errors:
78+
print(f" - {err}", file=sys.stderr)
79+
return 1
80+
81+
print(
82+
f"OK: pixi cuda-version pins match ci/versions.yml "
83+
f"cuda.build.version={build_version!r} (expected pin {expected!r}):"
84+
)
85+
for item in checked:
86+
print(f" - {item}")
87+
return 0
88+
89+
90+
if __name__ == "__main__":
91+
sys.exit(main())

‎cuda_core/cuda/core/__init__.py‎

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -69,45 +69,51 @@ class _PatchedProperty(metaclass=_PatchedPropMeta):
6969

7070

7171
from cuda.core import checkpoint, system, utils
72-
from cuda.core._context import Context, ContextOptions
73-
from cuda.core._device import Device
74-
from cuda.core._device_resources import (
75-
DeviceResources,
76-
SMResource,
77-
SMResourceOptions,
78-
WorkqueueResource,
79-
WorkqueueResourceOptions,
80-
)
81-
from cuda.core._event import Event, EventOptions
82-
from cuda.core._graphics import GraphicsResource
83-
from cuda.core._host import Host
84-
from cuda.core._launch_config import LaunchConfig
85-
from cuda.core._launcher import launch
86-
from cuda.core._linker import Linker, LinkerOptions
87-
from cuda.core._memory import (
88-
Buffer,
89-
DeviceMemoryResource,
90-
DeviceMemoryResourceOptions,
91-
GraphMemoryResource,
92-
LegacyPinnedMemoryResource,
93-
ManagedBuffer,
94-
ManagedMemoryResource,
95-
ManagedMemoryResourceOptions,
96-
MemoryResource,
97-
PinnedMemoryResource,
98-
PinnedMemoryResourceOptions,
99-
VirtualMemoryResource,
100-
VirtualMemoryResourceOptions,
101-
)
102-
from cuda.core._module import Kernel, ObjectCode
103-
from cuda.core._program import Program, ProgramOptions
104-
from cuda.core._stream import (
105-
LEGACY_DEFAULT_STREAM,
106-
PER_THREAD_DEFAULT_STREAM,
107-
Stream,
108-
StreamOptions,
109-
)
110-
from cuda.core._tensor_map import TensorMapDescriptor, TensorMapDescriptorOptions
72+
from cuda.core._context import *
73+
from cuda.core._context import __all__ as _context_all
74+
from cuda.core._device import *
75+
from cuda.core._device import __all__ as _device_all
76+
from cuda.core._device_resources import *
77+
from cuda.core._device_resources import __all__ as _device_resources_all
78+
from cuda.core._event import *
79+
from cuda.core._event import __all__ as _event_all
80+
from cuda.core._graphics import *
81+
from cuda.core._graphics import __all__ as _graphics_all
82+
from cuda.core._host import *
83+
from cuda.core._host import __all__ as _host_all
84+
from cuda.core._launch_config import *
85+
from cuda.core._launch_config import __all__ as _launch_config_all
86+
from cuda.core._launcher import *
87+
from cuda.core._launcher import __all__ as _launcher_all
88+
from cuda.core._linker import *
89+
from cuda.core._linker import __all__ as _linker_all
90+
from cuda.core._memory import *
91+
from cuda.core._memory import __all__ as _memory_all
92+
from cuda.core._module import *
93+
from cuda.core._module import __all__ as _module_all
94+
from cuda.core._program import *
95+
from cuda.core._program import __all__ as _program_all
96+
from cuda.core._stream import *
97+
from cuda.core._stream import __all__ as _stream_all
98+
from cuda.core._tensor_map import *
99+
from cuda.core._tensor_map import __all__ as _tensor_map_all
100+
101+
__all__ = [
102+
*_context_all,
103+
*_device_all,
104+
*_device_resources_all,
105+
*_event_all,
106+
*_graphics_all,
107+
*_host_all,
108+
*_launch_config_all,
109+
*_launcher_all,
110+
*_linker_all,
111+
*_memory_all,
112+
*_module_all,
113+
*_program_all,
114+
*_stream_all,
115+
*_tensor_map_all,
116+
]
111117

112118
# isort: split
113119
# Texture/surface types live under the cuda.core.texture namespace (not the

‎cuda_core/cuda/core/_device.pyi‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,4 +1023,5 @@ class Device:
10231023
.. versionadded:: 1.1.0
10241024
"""
10251025
_tls = threading.local()
1026-
_lock = threading.Lock()
1026+
_lock = threading.Lock()
1027+
__all__ = ['Device']

‎cuda_core/cuda/core/_device.pyx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ _tls = threading.local()
6161
_lock = threading.Lock()
6262
cdef bint _is_cuInit = False
6363

64+
__all__ = ['Device']
65+
6466

6567
cdef class DeviceProperties:
6668
"""

‎cuda_core/cuda/core/_event.pyi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class IPCEventDescriptor:
180180

181181
def __reduce__(self) -> tuple[object, ...]:
182182
...
183+
__all__ = ['Event', 'EventOptions']
183184

184185
def _reduce_event(event: Event) -> tuple[object, ...]:
185186
...

‎cuda_core/cuda/core/_event.pyx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ if TYPE_CHECKING:
4343
import cuda.bindings.driver # no-cython-lint
4444
from cuda.core._device import Device
4545

46+
__all__ = ['Event', 'EventOptions']
47+
4648

4749
@dataclass
4850
cdef class EventOptions:

‎cuda_core/cuda/core/_host.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import threading
77
from typing import ClassVar
88

9+
__all__ = ["Host"]
10+
911

1012
class Host:
1113
"""Host (CPU) location for managed-memory operations.

‎cuda_core/cuda/core/_launch_config.pyi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class LaunchConfig:
6666
def __hash__(self) -> int:
6767
...
6868
_LAUNCH_CONFIG_ATTRS = ('grid', 'cluster', 'block', 'shmem_size', 'is_cooperative')
69+
__all__ = ['LaunchConfig']
6970

7071
def _to_native_launch_config(config: LaunchConfig) -> object:
7172
"""Convert LaunchConfig to native driver CUlaunchConfig.

‎cuda_core/cuda/core/_launch_config.pyx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ from cuda.core._utils.cuda_utils import (
1515

1616
_LAUNCH_CONFIG_ATTRS = ('grid', 'cluster', 'block', 'shmem_size', 'is_cooperative')
1717

18+
__all__ = ['LaunchConfig']
19+
1820

1921
cdef class LaunchConfig:
2022
"""Customizable launch options.

0 commit comments

Comments
 (0)