Coverage for cuda/core/system/__init__.py: 100.00%
15 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-13 01:38 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-13 01:38 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2#
3# SPDX-License-Identifier: Apache-2.0
6# NOTE: We must maintain that it is always possible to import this module
7# without CUDA being installed, and without CUDA being initialized or any
8# contexts created, so that a user can use NVML to explore things about their
9# system without loading CUDA.
11from typing import TYPE_CHECKING
13__all__ = [
14 "CUDA_BINDINGS_NVML_IS_COMPATIBLE",
15 "get_kernel_mode_driver_version",
16 "get_num_devices",
17 "get_process_name",
18 "get_user_mode_driver_version",
19]
22from cuda.core.system import typing
24from ._system import *
26# The TYPE_CHECKING branch is split out from the runtime branch so that
27# stubgen-pyx, which only recognizes the literal `if TYPE_CHECKING:` form,
28# preserves these imports in the generated .pyi. When
29# CUDA_BINDINGS_NVML_IS_COMPATIBLE is no longer necessary, this complexity can
30# be removed.
31if TYPE_CHECKING:
32 from ._device import *
33 from ._system_events import *
34 from .exceptions import *
35elif CUDA_BINDINGS_NVML_IS_COMPATIBLE:
36 from ._device import *
37 from ._device import __all__ as _device_all
38 from ._system_events import *
39 from ._system_events import __all__ as _system_events_all
40 from .exceptions import *
41 from .exceptions import __all__ as _exceptions_all
43 __all__.append("get_nvml_version")
44 __all__.extend(_device_all)
45 __all__.extend(_system_events_all)
46 __all__.extend(_exceptions_all)