File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323from ._system import *
2424
2525if CUDA_BINDINGS_NVML_IS_COMPATIBLE :
26- from ._device import Device , DeviceArchitecture
26+ from ._device import *
27+ from ._device import __all__ as _device_all
2728 from .exceptions import *
2829 from .exceptions import __all__ as _exceptions_all
2930
30- __all__ .extend (
31- [
32- "get_nvml_version" ,
33- "Device" ,
34- "DeviceArchitecture" ,
35- ]
36- )
37-
31+ __all__ .append ("get_nvml_version" )
32+ __all__ .extend (_device_all )
3833 __all__ .extend (_exceptions_all )
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ cdef class Device:
175175 """
176176 Representation of a device.
177177
178- `` cuda.core.system.Device` ` provides access to various pieces of metadata
178+ :class:` cuda.core.system.Device` provides access to various pieces of metadata
179179 about devices and their topology , as provided by the NVIDIA Management
180180 Library (NVML ). To use CUDA with a device , use :class:`cuda.core.Device`.
181181
@@ -312,3 +312,12 @@ cdef class Device:
312312 board serial identifier.
313313 """
314314 return nvml.device_get_uuid(self._handle )
315+
316+
317+ __all__ = [
318+ " BAR1MemoryInfo" ,
319+ " Device" ,
320+ " DeviceArchitecture" ,
321+ " MemoryInfo" ,
322+ " PciInfo" ,
323+ ]
Original file line number Diff line number Diff line change @@ -82,6 +82,16 @@ def get_nvml_version() -> tuple[int, ...]:
8282 return tuple(int(v ) for v in nvml.system_get_nvml_version().split("."))
8383
8484
85+ def get_driver_branch() -> str:
86+ """
87+ Retrieves the driver branch of the NVIDIA driver installed on the system.
88+ """
89+ if not CUDA_BINDINGS_NVML_IS_COMPATIBLE:
90+ raise RuntimeError("NVML library is not available")
91+ initialize()
92+ return nvml.system_get_driver_branch()
93+
94+
8595def get_num_devices() -> int:
8696 """
8797 Return the number of devices in the system.
@@ -112,6 +122,7 @@ def get_process_name(pid: int) -> str:
112122
113123
114124__all__ = [
125+ " get_driver_branch" ,
115126 " get_driver_version" ,
116127 " get_driver_version_full" ,
117128 " get_nvml_version" ,
Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ CUDA system information and NVIDIA Management Library (NVML)
7979 :template: autosummary/cyclass.rst
8080
8181 system.Device
82+ system.DeviceArchitecture
83+ system.MemoryInfo
84+ system.BAR1MemoryInfo
85+ system.PciInfo
8286
8387
8488.. module :: cuda.core.utils
Original file line number Diff line number Diff line change @@ -95,3 +95,11 @@ def test_device_count():
9595 device_count = system .get_num_devices ()
9696 assert isinstance (device_count , int )
9797 assert device_count >= 0
98+
99+
100+ @skip_if_nvml_unsupported
101+ def test_get_driver_branch ():
102+ driver_branch = system .get_driver_branch ()
103+ assert isinstance (driver_branch , str )
104+ assert len (driver_branch ) > 0
105+ assert driver_branch [0 ] == "r"
You can’t perform that action at this time.
0 commit comments