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
9 changes: 6 additions & 3 deletions cuda_core/tests/system/test_system_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def test_device_name():


def test_device_pci_info(subtests):
for device in system.Device.get_all_devices():
for cuda_device in CudaDevice.get_all_devices():
device = cuda_device.to_system_device()
with subtests.test(device_index=device.index):
pci_info = device.pci_info
assert isinstance(pci_info, _device.PciInfo)
Expand Down Expand Up @@ -684,7 +685,8 @@ def test_clock_event_reasons(subtests):


def test_fan(subtests):
for device in system.Device.get_all_devices():
for cuda_device in CudaDevice.get_all_devices():
device = cuda_device.to_system_device()
device_index = device.index
num_fans = None
# The fan APIs are only supported on discrete devices with fans,
Expand Down Expand Up @@ -734,7 +736,8 @@ def test_fan(subtests):


def test_cooler(subtests):
for device in system.Device.get_all_devices():
for cuda_device in CudaDevice.get_all_devices():
device = cuda_device.to_system_device()
with subtests.test(device_index=device.index):
# The cooler APIs are only supported on discrete devices with fans,
# but when they are not available `device.num_fans` returns 0.
Expand Down
9 changes: 6 additions & 3 deletions cuda_core/tests/system/test_system_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import helpers
import pytest

from cuda.core import Device as CudaDevice
from cuda.core import system
from cuda.core.system import typing

Expand Down Expand Up @@ -54,10 +55,12 @@ def test_pci_bus_id_from_gpu_id(gpu_id, expected):
def test_system_event_device_resolves_pci_bus_id():
# Round-trip: pack pci_info with the inverse of _pci_bus_id_from_gpu_id,
# then resolve Device through SystemEvent.device.
if system.get_num_devices() == 0:
pytest.skip("No GPUs available")
cuda_devices = list(CudaDevice.get_all_devices())
if not cuda_devices:
pytest.skip("No CUDA devices available")

for device in system.Device.get_all_devices():
for cuda_device in cuda_devices:
device = cuda_device.to_system_device()
pci = device.pci_info
if pci.domain > 0xFFFF:
pytest.skip(f"PCI domain {pci.domain:#x} does not fit in a packed gpu_id")
Expand Down
Loading