Coverage for cuda / core / experimental / __init__.py: 100%
21 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-18 00:44 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-18 00:44 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2#
3# SPDX-License-Identifier: Apache-2.0
5"""
6Backward compatibility stubs for cuda.core.experimental namespace.
8This module provides forwarding stubs that import from the new cuda.core.*
9locations and emit deprecation warnings. Users should migrate to importing
10directly from cuda.core instead of cuda.core.experimental.
12The experimental namespace will be removed in v1.0.0.
14"""
17def _warn_deprecated():
18 """Emit a deprecation warning for using the experimental namespace.
20 Note: This warning is only when the experimental module is first imported.
21 Subsequent accesses to attributes (like utils, Device, etc.) do not trigger
22 additional warnings since they are already set in the module namespace.
23 """
24 import warnings
26 warnings.warn(
27 "The cuda.core.experimental namespace is deprecated. "
28 "Please import directly from cuda.core instead. "
29 "For example, use 'from cuda.core import Device' instead of "
30 "'from cuda.core.experimental import Device'. "
31 "The experimental namespace will be removed in v1.0.0.",
32 DeprecationWarning,
33 stacklevel=3,
34 )
37# Import from new locations and re-export
38_warn_deprecated()
41from cuda.core import utils # noqa: E402
43# Make utils accessible as a submodule for backward compatibility
44__import__("sys").modules[__spec__.name + ".utils"] = utils
47from cuda.core._device import Device # noqa: E402
48from cuda.core._event import Event, EventOptions # noqa: E402
49from cuda.core._graph import ( # noqa: E402
50 Graph,
51 GraphBuilder,
52 GraphCompleteOptions,
53 GraphDebugPrintOptions,
54)
55from cuda.core._launch_config import LaunchConfig # noqa: E402
56from cuda.core._launcher import launch # noqa: E402
57from cuda.core._layout import _StridedLayout # noqa: E402
58from cuda.core._linker import Linker, LinkerOptions # noqa: E402
59from cuda.core._memory import ( # noqa: E402
60 Buffer,
61 DeviceMemoryResource,
62 DeviceMemoryResourceOptions,
63 GraphMemoryResource,
64 LegacyPinnedMemoryResource,
65 ManagedMemoryResource,
66 ManagedMemoryResourceOptions,
67 MemoryResource,
68 PinnedMemoryResource,
69 PinnedMemoryResourceOptions,
70 VirtualMemoryResource,
71 VirtualMemoryResourceOptions,
72)
73from cuda.core._module import Kernel, ObjectCode # noqa: E402
74from cuda.core._program import Program, ProgramOptions # noqa: E402
75from cuda.core._stream import Stream, StreamOptions # noqa: E402
76from cuda.core._system import System # noqa: E402
78system = System()
79__import__("sys").modules[__spec__.name + ".system"] = system
80del System