File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44
55
6+ from contextlib import contextmanager
7+
68import pytest
79
810from cuda .core import system
2224)
2325
2426
27+ @contextmanager
2528def 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
You can’t perform that action at this time.
0 commit comments