Skip to content

Commit 08049e1

Browse files
committed
test: skip system NVML tests when the symbol is absent in older bindings
1 parent a9df0a5 commit 08049e1

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

cuda_core/tests/system/conftest.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55

6+
from contextlib import contextmanager
7+
68
import pytest
79

810
from cuda.core import system
@@ -22,7 +24,24 @@
2224
)
2325

2426

27+
@contextmanager
2528
def unsupported_before(device, expected_device_arch):
29+
from cuda.bindings import nvml
30+
from cuda.bindings._internal.utils import FunctionNotFoundError
2631
from cuda.bindings._test_helpers.arch_check import unsupported_before as nvml_unsupported_before
2732

28-
return nvml_unsupported_before(device._handle, expected_device_arch)
33+
try:
34+
with nvml_unsupported_before(device._handle, expected_device_arch):
35+
yield
36+
except FunctionNotFoundError:
37+
# Backstop older cuda.bindings versions that don't skip when an NVML symbol is
38+
# absent from the loaded NVML library. Only skip on the "possibly unsupported"
39+
# branch, matching arch_check.py.
40+
possibly_unsupported = (
41+
expected_device_arch is None
42+
or expected_device_arch == "HAS_INFOROM"
43+
or nvml.device_get_architecture(device._handle) == nvml.DeviceArch.UNKNOWN
44+
)
45+
if possibly_unsupported:
46+
pytest.skip("Requested NVML symbol is missing from the loaded driver/library")
47+
raise

0 commit comments

Comments
 (0)