File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -686,6 +686,8 @@ cdef class Device:
686686
687687 For devices with NVLink support.
688688 """
689+ if link < 0 or link >= NvlinkInfo.max_links:
690+ raise ValueError(f"Link index {link} is out of range [0, {NvlinkInfo.max_links})")
689691 return NvlinkInfo(self, link)
690692
691693 ##########################################################################
Original file line number Diff line number Diff line change @@ -18,32 +18,32 @@ cdef class NvlinkInfo:
1818 self ._link = link
1919
2020 @property
21- def version (self ) -> NvLinkVersion :
21+ def version (self ) -> NvlinkVersion :
2222 """
23- Retrieves the :obj:`~NvLinkVersion ` for the device and link.
23+ Retrieves the :obj:`~NvlinkVersion ` for the device and link.
2424
2525 For all products with NvLink support.
2626
2727 Returns
2828 -------
29- NvLinkVersion
30- The NvLink version.
29+ NvlinkVersion
30+ The Nvlink version.
3131 """
3232 return NvlinkVersion(nvml.device_get_nvlink_version(self._device._handle , self._link ))
3333
3434 @property
3535 def state(self ) -> bool:
3636 """
37- Retrieves the state of the device's NvLink for the device and link specified.
37+ Retrieves the state of the device's Nvlink for the device and link specified.
3838
3939 For Pascal™ or newer fully supported devices.
4040
41- For all products with NvLink support.
41+ For all products with Nvlink support.
4242
4343 Returns
4444 -------
4545 bool
46- `True` if the NvLink is active.
46+ `True` if the Nvlink is active.
4747 """
4848 return (
4949 nvml.device_get_nvlink_state(self._device._handle , self._link ) == nvml.EnableState.FEATURE_ENABLED
Original file line number Diff line number Diff line change @@ -746,6 +746,10 @@ def test_nvlink():
746746 version = nvlink_info .version
747747 assert isinstance (version , system .NvlinkVersion )
748748
749+ with unsupported_before (device , None ):
750+ state = nvlink_info .state
751+ assert isinstance (state , bool )
752+
749753
750754def test_utilization ():
751755 for device in system .Device .get_all_devices ():
You can’t perform that action at this time.
0 commit comments