[rocprofiler-compute] Only depend on amdsmi in profile phase (#2044)
* Only depepnd on amdsmi in profile phase * amdsmi interface tests should have common prefix for easier testing
This commit is contained in:
1 parent
68c8e111ae
commit
3f2fbc18e9
2 files changed
+60
-20
No files matched your search
@@ -8552,7 +8552,9 @@ def test_list_metrics(binary_handler_analyze_rocprof_compute, capsys):
|
||||
|
||||
|
||||
def test_amdsmi_ctx():
|
||||
from utils.amdsmi_interface import amdsmi_ctx
|
||||
from utils.amdsmi_interface import amdsmi_ctx, import_amdsmi_module
|
||||
|
||||
_ = import_amdsmi_module()
|
||||
|
||||
with mock.patch("amdsmi.amdsmi_init") as amdsmi_init_mock:
|
||||
with mock.patch("amdsmi.amdsmi_shut_down") as amdsmi_shutdown_mock:
|
||||
@@ -8561,8 +8563,10 @@ def test_amdsmi_ctx():
|
||||
amdsmi_shutdown_mock.assert_called_once()
|
||||
|
||||
|
||||
def test_get_device_handle():
|
||||
from utils.amdsmi_interface import get_device_handle
|
||||
def test_amdsmi_get_device_handle():
|
||||
from utils.amdsmi_interface import get_device_handle, import_amdsmi_module
|
||||
|
||||
_ = import_amdsmi_module()
|
||||
|
||||
with mock.patch("amdsmi.amdsmi_get_processor_handles") as device_handles_mock:
|
||||
device_handles_mock.return_value = [12345]
|
||||
@@ -8576,8 +8580,10 @@ def test_get_device_handle():
|
||||
assert handle is None
|
||||
|
||||
|
||||
def test_get_mem_max_clock():
|
||||
from utils.amdsmi_interface import get_mem_max_clock
|
||||
def test_amdsmi_get_mem_max_clock():
|
||||
from utils.amdsmi_interface import get_mem_max_clock, import_amdsmi_module
|
||||
|
||||
_ = import_amdsmi_module()
|
||||
|
||||
with mock.patch("amdsmi.amdsmi_get_processor_handles") as device_handles_mock:
|
||||
device_handles_mock.return_value = [12345]
|
||||
@@ -8588,8 +8594,10 @@ def test_get_mem_max_clock():
|
||||
assert clk == 100
|
||||
|
||||
|
||||
def test_get_gpu_model():
|
||||
from utils.amdsmi_interface import get_gpu_model
|
||||
def test_amdsmi_get_gpu_model():
|
||||
from utils.amdsmi_interface import get_gpu_model, import_amdsmi_module
|
||||
|
||||
_ = import_amdsmi_module()
|
||||
|
||||
with mock.patch("amdsmi.amdsmi_get_processor_handles") as device_handles_mock:
|
||||
device_handles_mock.return_value = [12345]
|
||||
@@ -8610,8 +8618,10 @@ def test_get_gpu_model():
|
||||
assert model == "N/A"
|
||||
|
||||
|
||||
def test_get_gpu_vbios_part_number():
|
||||
from utils.amdsmi_interface import get_gpu_vbios_part_number
|
||||
def test_amdsmi_get_gpu_vbios_part_number():
|
||||
from utils.amdsmi_interface import get_gpu_vbios_part_number, import_amdsmi_module
|
||||
|
||||
_ = import_amdsmi_module()
|
||||
|
||||
with mock.patch("amdsmi.amdsmi_get_processor_handles") as device_handles_mock:
|
||||
device_handles_mock.return_value = [12345]
|
||||
@@ -8630,8 +8640,10 @@ def test_get_gpu_vbios_part_number():
|
||||
assert part_number == "N/A"
|
||||
|
||||
|
||||
def test_get_gpu_compute_partition():
|
||||
from utils.amdsmi_interface import get_gpu_compute_partition
|
||||
def test_amdsmi_get_gpu_compute_partition():
|
||||
from utils.amdsmi_interface import get_gpu_compute_partition, import_amdsmi_module
|
||||
|
||||
_ = import_amdsmi_module()
|
||||
|
||||
with mock.patch("amdsmi.amdsmi_get_processor_handles") as device_handles_mock:
|
||||
device_handles_mock.return_value = [12345]
|
||||
@@ -8651,8 +8663,10 @@ def test_get_gpu_compute_partition():
|
||||
assert partition == "N/A"
|
||||
|
||||
|
||||
def test_get_gpu_memory_partition():
|
||||
from utils.amdsmi_interface import get_gpu_memory_partition
|
||||
def test_amdsmi_get_gpu_memory_partition():
|
||||
from utils.amdsmi_interface import get_gpu_memory_partition, import_amdsmi_module
|
||||
|
||||
_ = import_amdsmi_module()
|
||||
|
||||
with mock.patch("amdsmi.amdsmi_get_processor_handles") as device_handles_mock:
|
||||
device_handles_mock.return_value = [12345]
|
||||
|
||||
Reference in new issue
Block a user