Coverage for cuda / core / system / _nvlink.pxi: 42.86%
7 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-29 01:27 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-29 01:27 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2#
3# SPDX-License-Identifier: Apache-2.0
6NvlinkVersion = nvml.NvlinkVersion
9cdef class NvlinkInfo:
10 """
11 Nvlink information for a device.
12 """
13 cdef Device _device
14 cdef int _link
16 def __init__(self, device: Device, link: int):
17 self._device = device 1a
18 self._link = link 1a
20 @property
21 def version(self) -> NvlinkVersion:
22 """
23 Retrieves the :obj:`~NvlinkVersion` for the device and link.
25 For all products with NvLink support.
27 Returns
28 -------
29 NvlinkVersion
30 The Nvlink version.
31 """
32 return NvlinkVersion(nvml.device_get_nvlink_version(self._device._handle, self._link)) 1a
34 @property
35 def state(self) -> bool:
36 """
37 Retrieves the state of the device's Nvlink for the device and link specified.
39 For Pascal™ or newer fully supported devices.
41 For all products with Nvlink support.
43 Returns
44 -------
45 bool
46 `True` if the Nvlink is active.
47 """
48 return (
49 nvml.device_get_nvlink_state(self._device._handle, self._link) == nvml.EnableState.FEATURE_ENABLED
50 )
52 max_links = nvml.NVLINK_MAX_LINKS