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
11 changes: 8 additions & 3 deletions cuda_bindings/tests/nvml/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def test_clk_mon_status_t():

def test_current_clock_freqs(all_devices):
for device in all_devices:
clk_freqs = nvml.device_get_current_clock_freqs(device)
with unsupported_before(device, None):
clk_freqs = nvml.device_get_current_clock_freqs(device)
assert isinstance(clk_freqs, str)


Expand Down Expand Up @@ -87,7 +88,8 @@ def test_device_get_pdi(all_devices):

def test_device_get_performance_modes(all_devices):
for device in all_devices:
modes = nvml.device_get_performance_modes(device)
with unsupported_before(device, None):
modes = nvml.device_get_performance_modes(device)
assert isinstance(modes, str)


Expand Down Expand Up @@ -133,7 +135,10 @@ def test_nvlink_low_power_threshold(all_devices):
for device in all_devices:
# Docs say supported on HOPPER or newer
with unsupported_before(device, None):
nvml.device_set_nvlink_device_low_power_threshold(device, 0)
try:
nvml.device_set_nvlink_device_low_power_threshold(device, 0)
except nvml.NoPermissionError:
pytest.skip("No permission to set NVLink low power threshold")


def test_get_power_management_limit(all_devices):
Expand Down
3 changes: 2 additions & 1 deletion cuda_bindings/tests/nvml/test_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def test_gpu_get_module_id(nvml_init):
if util.is_vgpu(device):
continue

module_id = nvml.device_get_module_id(device)
with unsupported_before(device, None):
module_id = nvml.device_get_module_id(device)
assert isinstance(module_id, int)


Expand Down
12 changes: 7 additions & 5 deletions cuda_bindings/tests/nvml/test_pynvml.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def test_device_get_power_usage(ngpus, handles):

def test_device_get_total_energy_consumption(ngpus, handles):
for i in range(ngpus):
with unsupported_before(handles[i], nvml.DeviceArch.VOLTA):
with unsupported_before(handles[i], None):
energy_mjoules1 = nvml.device_get_total_energy_consumption(handles[i])

for j in range(10): # idle for 150 ms
time.sleep(0.015) # and check for increase every 15 ms
with unsupported_before(handles[i], nvml.DeviceArch.VOLTA):
with unsupported_before(handles[i], None):
energy_mjoules2 = nvml.device_get_total_energy_consumption(handles[i])
assert energy_mjoules2 >= energy_mjoules1
if energy_mjoules2 > energy_mjoules1:
Expand All @@ -169,7 +169,8 @@ def test_device_get_total_energy_consumption(ngpus, handles):

def test_device_get_memory_info(ngpus, handles):
for i in range(ngpus):
meminfo = nvml.device_get_memory_info_v2(handles[i])
with unsupported_before(handles[i], None):
meminfo = nvml.device_get_memory_info_v2(handles[i])
assert (meminfo.used <= meminfo.total) and (meminfo.free <= meminfo.total)


Expand Down Expand Up @@ -243,10 +244,11 @@ def test_device_get_utilization_rates(ngpus, handles):

def test_device_get_pcie_throughput(ngpus, handles):
for i in range(ngpus):
with unsupported_before(handles[i], nvml.DeviceArch.MAXWELL):
with unsupported_before(handles[i], None):
tx_bytes_tp = nvml.device_get_pcie_throughput(handles[i], nvml.PcieUtilCounter.PCIE_UTIL_TX_BYTES)
assert tx_bytes_tp >= 0
rx_bytes_tp = nvml.device_get_pcie_throughput(handles[i], nvml.PcieUtilCounter.PCIE_UTIL_RX_BYTES)
with unsupported_before(handles[i], None):
rx_bytes_tp = nvml.device_get_pcie_throughput(handles[i], nvml.PcieUtilCounter.PCIE_UTIL_RX_BYTES)
assert rx_bytes_tp >= 0

# with pytest.raises(nvml.InvalidArgumentError):
Expand Down
25 changes: 16 additions & 9 deletions cuda_core/tests/system/test_system_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_device_architecture():

def test_device_bar1_memory():
for device in system.Device.get_all_devices():
with unsupported_before(device, DeviceArch.KEPLER):
with unsupported_before(device, None):
bar1_memory_info = device.bar1_memory_info
free, total, used = (
bar1_memory_info.free,
Expand Down Expand Up @@ -136,7 +136,8 @@ def test_device_cuda_compute_capability():

def test_device_memory():
for device in system.Device.get_all_devices():
memory_info = device.memory_info
with unsupported_before(device, None):
memory_info = device.memory_info
free, total, used, reserved = memory_info.free, memory_info.total, memory_info.used, memory_info.reserved

assert isinstance(memory_info, system.MemoryInfo)
Expand Down Expand Up @@ -212,7 +213,8 @@ def test_device_pci_info():
assert isinstance(pci_info.get_current_pcie_link_width(), int)
assert 0 <= pci_info.get_current_pcie_link_width() <= 0xFF

assert isinstance(pci_info.get_pcie_throughput(system.PcieUtilCounter.PCIE_UTIL_TX_BYTES), int)
with unsupported_before(device, None):
assert isinstance(pci_info.get_pcie_throughput(system.PcieUtilCounter.PCIE_UTIL_TX_BYTES), int)

assert isinstance(pci_info.get_pcie_replay_counter(), int)

Expand Down Expand Up @@ -421,7 +423,8 @@ def test_index():

def test_module_id():
for device in system.Device.get_all_devices():
module_id = device.module_id
with unsupported_before(device, None):
module_id = device.module_id
assert isinstance(module_id, int)
assert module_id >= 0

Expand Down Expand Up @@ -509,7 +512,8 @@ def test_get_inforom_version():
with unsupported_before(device, "HAS_INFOROM"):
inforom = device.inforom

inforom_image_version = inforom.image_version
with unsupported_before(device, "HAS_INFOROM"):
inforom_image_version = inforom.image_version
assert isinstance(inforom_image_version, str)
assert len(inforom_image_version) > 0

Expand Down Expand Up @@ -558,7 +562,7 @@ def test_clock():
# These are ordered from oldest API to newest API so we test as much
# as we can on each hardware architecture.

with unsupported_before(device, "FERMI"):
with unsupported_before(device, None):
pstate = device.performance_state

min_, max_ = clock.get_min_max_clock_of_pstate_mhz(pstate)
Expand Down Expand Up @@ -600,10 +604,12 @@ def test_clock():

def test_clock_event_reasons():
for device in system.Device.get_all_devices():
reasons = device.get_current_clock_event_reasons()
with unsupported_before(device, None):
reasons = device.get_current_clock_event_reasons()
assert all(isinstance(reason, system.ClocksEventReasons) for reason in reasons)

reasons = device.get_supported_clock_event_reasons()
with unsupported_before(device, None):
reasons = device.get_supported_clock_event_reasons()
assert all(isinstance(reason, system.ClocksEventReasons) for reason in reasons)


Expand Down Expand Up @@ -706,7 +712,8 @@ def test_temperature():

def test_pstates():
for device in system.Device.get_all_devices():
pstate = device.performance_state
with unsupported_before(device, None):
pstate = device.performance_state
assert isinstance(pstate, system.Pstates)

pstates = device.get_supported_pstates()
Expand Down
1 change: 1 addition & 0 deletions cuda_core/tests/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def test_launch_invalid_values(init_cuda):
launch(StreamWrapper(stream), config, ker)

launch(stream, config, ker)
stream.sync() # TODO(#1539)


# Parametrize: (python_type, cpp_type, init_value)
Expand Down
Loading