Skip to content

Commit 784ba3c

Browse files
committed
Support systems with old cuda.bindings
1 parent c995aec commit 784ba3c

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

cuda_core/cuda/core/_device.pyx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,13 @@ class Device:
10471047
cuda.core.system.Device
10481048
The corresponding system-level device instance used for NVML access.
10491049
"""
1050+
from cuda.core.system._system import CUDA_BINDINGS_NVML_IS_COMPATIBLE
1051+
1052+
if not CUDA_BINDINGS_NVML_IS_COMPATIBLE:
1053+
raise RuntimeError(
1054+
"cuda.core.system.Device requires cuda_bindings 13.1.2+ or 12.9.6+"
1055+
)
1056+
10501057
from cuda.core.system import Device as SystemDevice
10511058
return SystemDevice(uuid=self.uuid)
10521059

cuda_core/tests/test_device.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,17 @@ def cuda_version():
2626

2727

2828
def test_to_system_device(deinit_cuda):
29-
from cuda.core.system import Device as SystemDevice
29+
from cuda.core.system import _system
3030

3131
device = Device()
32+
33+
if not _system.CUDA_BINDINGS_NVML_IS_COMPATIBLE:
34+
with pytest.raises(RuntimeError):
35+
device.to_system_device()
36+
pytest.skip("NVML support requires cuda.bindings version 12.9.6+ or 13.1.2+")
37+
38+
from cuda.core.system import Device as SystemDevice
39+
3240
system_device = device.to_system_device()
3341
assert isinstance(system_device, SystemDevice)
3442
assert system_device.uuid[4:] == device.uuid

0 commit comments

Comments
 (0)