Skip to content

Commit f77ea5b

Browse files
committed
Address comments in the PR
1 parent 039013e commit f77ea5b

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

cuda_core/cuda/core/system/_device.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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
##########################################################################

cuda_core/cuda/core/system/_nvlink.pxi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff 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

cuda_core/tests/system/test_system_device.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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

750754
def test_utilization():
751755
for device in system.Device.get_all_devices():

0 commit comments

Comments
 (0)