Skip to content

Commit 4936801

Browse files
authored
Follow-up to #2065: A couple of additional test fixes (#2072)
* Follow-up to #2065: A couple of additional test fixes * Remove redundant test * Remove test that NVML devices == CUDA devices
1 parent 342b319 commit 4936801

3 files changed

Lines changed: 3 additions & 37 deletions

File tree

cuda_bindings/tests/nvml/test_pynvml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_device_get_attributes(mig_handles):
4747

4848
if mig_handles:
4949
for handle in mig_handles:
50-
att = nvml.device_get_attributes(handle)
50+
att = nvml.device_get_attributes_v2(handle)
5151
assert att is not None
5252
else:
5353
pytest.skip("No MIG devices found")

cuda_bindings/tests/test_cuda.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
33

44
import ctypes
5-
import platform
65
import shutil
76
import textwrap
87

@@ -560,29 +559,6 @@ def test_get_error_name_and_string():
560559
assert s == b"CUDA_ERROR_INVALID_DEVICE"
561560

562561

563-
@pytest.mark.skipif(not callableBinary("nvidia-smi"), reason="Binary existence needed")
564-
def test_device_get_name(device):
565-
# TODO: Refactor this test once we have nvml bindings to avoid the use of subprocess
566-
import subprocess
567-
568-
p = subprocess.check_output(
569-
["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"], # noqa: S607
570-
shell=False,
571-
stderr=subprocess.PIPE,
572-
)
573-
574-
delimiter = b"\r\n" if platform.system() == "Windows" else b"\n"
575-
expect = p.split(delimiter)
576-
size = 64
577-
_, got = cuda.cuDeviceGetName(size, device)
578-
got = got.split(b"\x00")[0]
579-
if any(b"Unable to determine the device handle for" in result for result in expect):
580-
# Undeterministic devices get waived
581-
pass
582-
else:
583-
assert any(got in result for result in expect)
584-
585-
586562
# TODO: cuStreamGetCaptureInfo_v2
587563
@pytest.mark.skipif(driverVersionLessThan(11030), reason="Driver too old for cuStreamGetCaptureInfo_v2")
588564
def test_stream_capture():

cuda_core/tests/system/test_system_system.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
import pytest
99

1010
try:
11-
from cuda.bindings import driver, runtime
11+
from cuda.bindings import driver
1212
except ImportError:
1313
from cuda import cuda as driver
14-
from cuda import cudart as runtime
1514

16-
from cuda.core import Device, system
15+
from cuda.core import system
1716
from cuda.core._utils.cuda_utils import handle_return
1817

1918
from .conftest import skip_if_nvml_unsupported
@@ -40,15 +39,6 @@ def test_kernel_mode_driver_version():
4039
assert 0 <= ver_patch[0] <= 99
4140

4241

43-
def test_devices():
44-
devices = Device.get_all_devices()
45-
expected_num_devices = handle_return(runtime.cudaGetDeviceCount())
46-
expected_devices = tuple(Device(device_id) for device_id in range(expected_num_devices))
47-
assert len(devices) == len(expected_devices), "Number of devices does not match expected value"
48-
for device, expected_device in zip(devices, expected_devices):
49-
assert device.device_id == expected_device.device_id, "Device ID does not match expected value"
50-
51-
5242
def test_kernel_mode_driver_version_requires_nvml():
5343
if system.CUDA_BINDINGS_NVML_IS_COMPATIBLE:
5444
pytest.skip("NVML is available, cannot test the error path")

0 commit comments

Comments
 (0)