Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cuda_bindings/tests/nvml/test_pynvml.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_device_get_attributes(mig_handles):

if mig_handles:
for handle in mig_handles:
att = nvml.device_get_attributes(handle)
att = nvml.device_get_attributes_v2(handle)
assert att is not None
else:
pytest.skip("No MIG devices found")
Expand Down
24 changes: 0 additions & 24 deletions cuda_bindings/tests/test_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

import ctypes
import platform
import shutil
import textwrap

Expand Down Expand Up @@ -560,29 +559,6 @@ def test_get_error_name_and_string():
assert s == b"CUDA_ERROR_INVALID_DEVICE"


@pytest.mark.skipif(not callableBinary("nvidia-smi"), reason="Binary existence needed")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is redundant to this one: https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/tests/nvml/test_cuda.py#L57

(Hinted at already in the comment here).

Just removing this seems like the better choice.

def test_device_get_name(device):
# TODO: Refactor this test once we have nvml bindings to avoid the use of subprocess
import subprocess

p = subprocess.check_output(
["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"], # noqa: S607
shell=False,
stderr=subprocess.PIPE,
)

delimiter = b"\r\n" if platform.system() == "Windows" else b"\n"
expect = p.split(delimiter)
size = 64
_, got = cuda.cuDeviceGetName(size, device)
got = got.split(b"\x00")[0]
if any(b"Unable to determine the device handle for" in result for result in expect):
# Undeterministic devices get waived
pass
else:
assert any(got in result for result in expect)


# TODO: cuStreamGetCaptureInfo_v2
@pytest.mark.skipif(driverVersionLessThan(11030), reason="Driver too old for cuStreamGetCaptureInfo_v2")
def test_stream_capture():
Expand Down
14 changes: 2 additions & 12 deletions cuda_core/tests/system/test_system_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
import pytest

try:
from cuda.bindings import driver, runtime
from cuda.bindings import driver
except ImportError:
from cuda import cuda as driver
from cuda import cudart as runtime

from cuda.core import Device, system
from cuda.core import system
from cuda.core._utils.cuda_utils import handle_return

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


def test_devices():
devices = Device.get_all_devices()
expected_num_devices = handle_return(runtime.cudaGetDeviceCount())
expected_devices = tuple(Device(device_id) for device_id in range(expected_num_devices))
assert len(devices) == len(expected_devices), "Number of devices does not match expected value"
for device, expected_device in zip(devices, expected_devices):
assert device.device_id == expected_device.device_id, "Device ID does not match expected value"


def test_kernel_mode_driver_version_requires_nvml():
if system.CUDA_BINDINGS_NVML_IS_COMPATIBLE:
pytest.skip("NVML is available, cannot test the error path")
Expand Down
Loading