Coverage for cuda / core / experimental / __init__.py: 84%
31 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-10 01:19 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-10 01:19 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2#
3# SPDX-License-Identifier: Apache-2.0
5try:
6 from cuda import bindings
7except ImportError:
8 raise ImportError("cuda.bindings 12.x or 13.x must be installed") from None
9else:
10 cuda_major, cuda_minor = bindings.__version__.split(".")[:2]
11 if cuda_major not in ("12", "13"):
12 raise ImportError("cuda.bindings 12.x or 13.x must be installed")
14import importlib
16subdir = f"cu{cuda_major}"
17try:
18 versioned_mod = importlib.import_module(f".{subdir}", __package__)
19 # Import all symbols from the module
20 globals().update(versioned_mod.__dict__)
21except ImportError:
22 # This is not a wheel build, but a conda or local build, do nothing
23 pass
24else:
25 del versioned_mod
26finally:
27 del bindings, importlib, subdir, cuda_major, cuda_minor
29from cuda.core.experimental import utils # noqa: E402
30from cuda.core.experimental._device import Device # noqa: E402
31from cuda.core.experimental._event import Event, EventOptions # noqa: E402
32from cuda.core.experimental._graph import ( # noqa: E402
33 Graph,
34 GraphBuilder,
35 GraphCompleteOptions,
36 GraphDebugPrintOptions,
37)
38from cuda.core.experimental._launch_config import LaunchConfig # noqa: E402
39from cuda.core.experimental._launcher import launch # noqa: E402
40from cuda.core.experimental._linker import Linker, LinkerOptions # noqa: E402
41from cuda.core.experimental._memory import ( # noqa: E402
42 Buffer,
43 DeviceMemoryResource,
44 DeviceMemoryResourceOptions,
45 GraphMemoryResource,
46 LegacyPinnedMemoryResource,
47 MemoryResource,
48 VirtualMemoryResource,
49 VirtualMemoryResourceOptions,
50)
51from cuda.core.experimental._module import Kernel, ObjectCode # noqa: E402
52from cuda.core.experimental._program import Program, ProgramOptions # noqa: E402
53from cuda.core.experimental._stream import Stream, StreamOptions # noqa: E402
54from cuda.core.experimental._system import System # noqa: E402
56system = System()
57__import__("sys").modules[__spec__.name + ".system"] = system
58del System