diff --git a/cuda_bindings/tests/nvml/test_init.py b/cuda_bindings/tests/nvml/test_init.py index 2a04799708e..4c94dc26a3e 100644 --- a/cuda_bindings/tests/nvml/test_init.py +++ b/cuda_bindings/tests/nvml/test_init.py @@ -25,11 +25,17 @@ def test_devices_are_the_same_architecture(all_devices): # they won't be tested properly. This tests for the (hopefully rare) case # where a system has devices of different architectures and produces a warning. - all_arches = {nvml.DeviceArch(nvml.device_get_architecture(device)) for device in all_devices} + def get_architecture_name(arch): + try: + return nvml.DeviceArch(arch).name + except ValueError: + return f"UNKNOWN_ARCH_ID({arch})" + + all_arches = {nvml.device_get_architecture(device) for device in all_devices} if len(all_arches) > 1: warnings.warn( - f"System has devices of multiple architectures ({', '.join(x.name for x in all_arches)}). " + f"System has devices of multiple architectures ({', '.join(get_architecture_name(x) for x in all_arches)}). " f" Some tests may be skipped unexpectedly", UserWarning, ) diff --git a/cuda_bindings/tests/nvml/test_nvlink.py b/cuda_bindings/tests/nvml/test_nvlink.py index d8e782831ef..be82aa37453 100644 --- a/cuda_bindings/tests/nvml/test_nvlink.py +++ b/cuda_bindings/tests/nvml/test_nvlink.py @@ -26,4 +26,4 @@ def test_nvlink_get_link_count(all_devices): # The feature_nvlink_supported detection is not robust, so we # can't be more specific about how many links we should find. if value.nvml_return == nvml.Return.SUCCESS: - assert value.value.ui_val <= nvml.NVLINK_MAX_LINKS, f"Unexpected link count {value.value.ui_val}" + assert value.value.ui_val[0] <= nvml.NVLINK_MAX_LINKS, f"Unexpected link count {value.value.ui_val[0]}" diff --git a/cuda_core/cuda/core/system/_device.pyx b/cuda_core/cuda/core/system/_device.pyx index 9cfc77adb1a..e5d2d15588f 100644 --- a/cuda_core/cuda/core/system/_device.pyx +++ b/cuda_core/cuda/core/system/_device.pyx @@ -180,7 +180,11 @@ cdef class Device: "VOLTA"``, and RTX A6000 will report ``DeviceArchitecture.name == "AMPERE"``. """ - return DeviceArch(nvml.device_get_architecture(self._handle)) + arch = nvml.device_get_architecture(self._handle) + try: + return DeviceArch(arch) + except ValueError: + return nvml.DeviceArch.UNKNOWN @property def name(self) -> str: