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

1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4  

5  

6NvlinkVersion = nvml.NvlinkVersion 

7  

8  

9cdef class NvlinkInfo: 

10 """ 

11 Nvlink information for a device. 

12 """ 

13 cdef Device _device 

14 cdef int _link 

15  

16 def __init__(self, device: Device, link: int): 

17 self._device = device 1a

18 self._link = link 1a

19  

20 @property 

21 def version(self) -> NvlinkVersion: 

22 """ 

23 Retrieves the :obj:`~NvlinkVersion` for the device and link. 

24  

25 For all products with NvLink support. 

26  

27 Returns 

28 ------- 

29 NvlinkVersion 

30 The Nvlink version. 

31 """ 

32 return NvlinkVersion(nvml.device_get_nvlink_version(self._device._handle, self._link)) 1a

33  

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™ or newer fully supported devices. 

40  

41 For all products with Nvlink support. 

42  

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 ) 

51  

52 max_links = nvml.NVLINK_MAX_LINKS