Coverage for cuda / core / __init__.py: 85%
34 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
5from cuda.core._version import __version__
7try:
8 from cuda import bindings
9except ImportError:
10 raise ImportError("cuda.bindings 12.x or 13.x must be installed") from None
11else:
12 cuda_major, cuda_minor = bindings.__version__.split(".")[:2]
13 if cuda_major not in ("12", "13"):
14 raise ImportError("cuda.bindings 12.x or 13.x must be installed")
16import importlib
18subdir = f"cu{cuda_major}"
19try:
20 versioned_mod = importlib.import_module(f".{subdir}", __package__)
21 # Import all symbols from the module
22 globals().update(versioned_mod.__dict__)
23except ImportError:
24 # This is not a wheel build, but a conda or local build, do nothing
25 pass
26else:
27 del versioned_mod
28finally:
29 del bindings, importlib, subdir, cuda_major, cuda_minor
31from cuda.core import utils # noqa: E402
32from cuda.core._device import Device # noqa: E402
33from cuda.core._event import Event, EventOptions # noqa: E402
34from cuda.core._graph import ( # noqa: E402
35 Graph,
36 GraphBuilder,
37 GraphCompleteOptions,
38 GraphDebugPrintOptions,
39)
40from cuda.core._launch_config import LaunchConfig # noqa: E402
41from cuda.core._launcher import launch # noqa: E402
42from cuda.core._layout import _StridedLayout # noqa: E402
43from cuda.core._linker import Linker, LinkerOptions # noqa: E402
44from cuda.core._memory import ( # noqa: E402
45 Buffer,
46 DeviceMemoryResource,
47 DeviceMemoryResourceOptions,
48 GraphMemoryResource,
49 LegacyPinnedMemoryResource,
50 ManagedMemoryResource,
51 ManagedMemoryResourceOptions,
52 MemoryResource,
53 PinnedMemoryResource,
54 PinnedMemoryResourceOptions,
55 VirtualMemoryResource,
56 VirtualMemoryResourceOptions,
57)
58from cuda.core._memoryview import ( # noqa: E402
59 StridedMemoryView, # noqa: E402
60 args_viewable_as_strided_memory, # noqa: E402
61)
62from cuda.core._module import Kernel, ObjectCode # noqa: E402
63from cuda.core._program import Program, ProgramOptions # noqa: E402
64from cuda.core._stream import Stream, StreamOptions # noqa: E402
65from cuda.core._system import System # noqa: E402
67system = System()
68__import__("sys").modules[__spec__.name + ".system"] = system
69del System