Skip to content

Commit 9098293

Browse files
committed
Add NvlinkInfo.state
1 parent 9013c64 commit 9098293

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

cuda_core/cuda/core/system/_nvlink.pxi

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cdef class NvlinkInfo:
2020
@property
2121
def version(self) -> NvLinkVersion:
2222
"""
23-
Retrieves the NvLink version for the device.
23+
Retrieves the NvLink version for the device and link.
2424

2525
For all products with NvLink support.
2626

@@ -31,4 +31,22 @@ cdef class NvlinkInfo:
3131
"""
3232
return NvlinkVersion(nvml.device_get_nvlink_version(self._device._handle, self._link))
3333

34+
@property
35+
def state(self) -> bool:
36+
"""
37+
Retrieves the state of the device's NvLink for the device and link specified.
38+
39+
For Pascal &tm; or newer fully supported devices.
40+
41+
For all products with NvLink support.
42+
43+
Returns
44+
-------
45+
46+
`True` if the NvLink is active, `False` otherwise.
47+
"""
48+
return (
49+
nvml.device_get_nvlink_state(self._device._handle, self._link) == nvml.EnableState.FEATURE_ENABLED
50+
)
51+
3452
max_links = nvml.NVLINK_MAX_LINKS

0 commit comments

Comments
 (0)