11# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0
33
4- import pytest
5-
64import cuda .bindings .driver as cuda
75from cuda .bindings import nvml
86
@@ -17,15 +15,10 @@ def get_nvml_device_names():
1715 for idx in range (num_devices ):
1816 handle = nvml .device_get_handle_by_index_v2 (idx )
1917 name = nvml .device_get_name (handle )
20- try :
21- info = nvml .device_get_pci_info_v3 (handle )
22- except nvml .NotSupportedError :
23- bus_id = - 1
24- else :
25- bus_id = info .bus
26- assert isinstance (bus_id , int )
18+ info = nvml .device_get_pci_info_v3 (handle )
19+ assert isinstance (info .bus , int )
2720 assert isinstance (name , str )
28- result .append ({"name" : name , "id" : bus_id })
21+ result .append ({"name" : name , "id" : info . bus })
2922
3023 return result
3124
@@ -61,15 +54,4 @@ def test_cuda_device_order():
6154 cuda_devices = get_cuda_device_names ()
6255 nvml_devices = get_nvml_device_names ()
6356
64- for kind in ("Orin" , "Thor" ):
65- if any (kind in device ["name" ] for device in nvml_devices ):
66- pytest .skip (f"Skipping test on { kind } , which has non-standard device naming" )
67-
68- def compare (cuda_device , nvml_device ):
69- return cuda_device ["name" ] == nvml_device ["name" ] and (
70- nvml_device ["id" ] == - 1 or cuda_device ["id" ] == nvml_device ["id" ]
71- )
72-
73- assert len (cuda_devices ) <= len (nvml_devices )
74- for cuda_device in cuda_devices :
75- assert any (compare (cuda_device , nvml_device ) for nvml_device in nvml_devices )
57+ assert cuda_devices == nvml_devices , "CUDA and NVML device lists do not match"
0 commit comments