@@ -32,10 +32,12 @@ include "_fan.pxi"
3232include " _field_values.pxi"
3333include " _inforom.pxi"
3434include " _memory.pxi"
35+ include " _nvlink.pxi"
3536include " _pci_info.pxi"
3637include " _performance.pxi"
3738include " _repair_status.pxi"
3839include " _temperature.pxi"
40+ include " _utilization.pxi"
3941
4042
4143cdef class Device:
@@ -674,6 +676,18 @@ cdef class Device:
674676 """
675677 return MemoryInfo(nvml.device_get_memory_info_v2(self._handle))
676678
679+ ##########################################################################
680+ # NVLINK
681+ # See external class definitions in _nvlink.pxi
682+
683+ def nvlink(self, link: int) -> NvlinkInfo:
684+ """
685+ Get information about NVLink on this device.
686+
687+ For devices with NVLink support.
688+ """
689+ return NvlinkInfo(self, link)
690+
677691 ##########################################################################
678692 # PCI INFO
679693 # See external class definitions in _pci_info.pxi
@@ -765,6 +779,30 @@ cdef class Device:
765779 device._handle = handle
766780 yield device
767781
782+ #######################################################################
783+ # UTILIZATION
784+
785+ @property
786+ def utilization(self) -> Utilization:
787+ """
788+ Retrieves the current utilization rates for the device' s major subsystems.
789+
790+ For Fermi & tm; or newer fully supported devices.
791+
792+ Note: During driver initialization when ECC is enabled one can see high
793+ GPU and Memory Utilization readings. This is caused by ECC Memory
794+ Scrubbing mechanism that is performed during driver initialization.
795+
796+ Note: On MIG- enabled GPUs, querying device utilization rates is not
797+ currently supported.
798+
799+ Returns
800+ -------
801+ Utilization
802+ An object containing the current utilization rates for the device.
803+ """
804+ return Utilization(nvml.device_get_utilization_rates(self._handle))
805+
768806
769807def get_topology_common_ancestor(device1: Device, device2: Device) -> GpuTopologyLevel:
770808 """
@@ -853,6 +891,8 @@ __all__ = [
853891 "InforomInfo",
854892 "InforomObject",
855893 "MemoryInfo",
894+ "NvlinkInfo",
895+ "NvlinkVersion",
856896 "PcieUtilCounter",
857897 "PciInfo",
858898 "Pstates",
@@ -864,4 +904,5 @@ __all__ = [
864904 "ThermalSensor",
865905 "ThermalSettings",
866906 "ThermalTarget",
907+ "Utilization",
867908]
0 commit comments