From cdad242947ca36f870da3e8e68f1612bd440cbb2 Mon Sep 17 00:00:00 2001 From: Deepak Mewar Date: Sat, 25 Feb 2023 08:06:58 -0500 Subject: [PATCH] Renamed API amdsmi_dev_get_memory_total to amdsmi_get_gpu_memory_total grep -rli 'amdsmi_dev_get_memory_total' * | xargs -i@ sed -i 's/amdsmi_dev_get_memory_total/amdsmi_get_gpu_memory_total/g' @ Change-Id: I06dc20f4bf783c0ee824a6d4b4f7162166c598cb --- include/amd_smi/amdsmi.h | 2 +- py-interface/README.md | 6 +++--- py-interface/__init__.py | 2 +- py-interface/amdsmi_interface.py | 4 ++-- py-interface/amdsmi_wrapper.py | 8 ++++---- py-interface/rocm_smi_tool.py | 4 ++-- src/amd_smi/amd_smi.cc | 4 ++-- tests/amd_smi_test/functional/mem_util_read.cc | 4 ++-- tests/amd_smi_test/functional/mutual_exclusion.cc | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/amd_smi/amdsmi.h b/include/amd_smi/amdsmi.h index 50e2f2ed79..894c4e1baf 100644 --- a/include/amd_smi/amdsmi.h +++ b/include/amd_smi/amdsmi.h @@ -1758,7 +1758,7 @@ amdsmi_status_t * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_memory_total(amdsmi_processor_handle processor_handle, amdsmi_memory_type_t mem_type, +amdsmi_get_gpu_memory_total(amdsmi_processor_handle processor_handle, amdsmi_memory_type_t mem_type, uint64_t *total); /** diff --git a/py-interface/README.md b/py-interface/README.md index a68bb98e09..e1c06890e7 100644 --- a/py-interface/README.md +++ b/py-interface/README.md @@ -1558,7 +1558,7 @@ except AmdSmiException as e: ``` -## amdsmi_dev_get_memory_total +## amdsmi_get_gpu_memory_total Description: Get the total amount of memory that exists @@ -1569,7 +1569,7 @@ Input parameters: Output: total amount of memory -Exceptions that can be thrown by `amdsmi_dev_get_memory_total` function: +Exceptions that can be thrown by `amdsmi_get_gpu_memory_total` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1582,7 +1582,7 @@ try: print("No GPUs on machine") else: for device in devices: - memory = amdsmi_dev_get_memory_total(device) + memory = amdsmi_get_gpu_memory_total(device) print(memory) except AmdSmiException as e: print(e) diff --git a/py-interface/__init__.py b/py-interface/__init__.py index 37c4fd3a26..f16524d9bb 100644 --- a/py-interface/__init__.py +++ b/py-interface/__init__.py @@ -148,7 +148,7 @@ from .amdsmi_interface import amdsmi_get_power_ave from .amdsmi_interface import amdsmi_get_energy_count # # Memory information -from .amdsmi_interface import amdsmi_dev_get_memory_total +from .amdsmi_interface import amdsmi_get_gpu_memory_total from .amdsmi_interface import amdsmi_dev_get_memory_usage from .amdsmi_interface import amdsmi_dev_get_memory_busy_percent from .amdsmi_interface import amdsmi_dev_get_memory_reserved_pages diff --git a/py-interface/amdsmi_interface.py b/py-interface/amdsmi_interface.py index 63b4cbc669..ef4a449ea0 100644 --- a/py-interface/amdsmi_interface.py +++ b/py-interface/amdsmi_interface.py @@ -1929,7 +1929,7 @@ def amdsmi_dev_set_clk_range( ) -def amdsmi_dev_get_memory_total(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, mem_type: AmdSmiMemoryType): +def amdsmi_get_gpu_memory_total(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, mem_type: AmdSmiMemoryType): if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( processor_handle, amdsmi_wrapper.amdsmi_processor_handle @@ -1943,7 +1943,7 @@ def amdsmi_dev_get_memory_total(processor_handle: amdsmi_wrapper.amdsmi_processo total = ctypes.c_uint64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_memory_total( + amdsmi_wrapper.amdsmi_get_gpu_memory_total( processor_handle, mem_type, ctypes.byref(total)) ) diff --git a/py-interface/amdsmi_wrapper.py b/py-interface/amdsmi_wrapper.py index b004560b19..f0c245e641 100644 --- a/py-interface/amdsmi_wrapper.py +++ b/py-interface/amdsmi_wrapper.py @@ -1469,9 +1469,9 @@ amdsmi_set_power_cap.argtypes = [amdsmi_processor_handle, uint32_t, uint64_t] amdsmi_set_gpu_power_profile = _libraries['libamd_smi.so'].amdsmi_set_gpu_power_profile amdsmi_set_gpu_power_profile.restype = amdsmi_status_t amdsmi_set_gpu_power_profile.argtypes = [amdsmi_processor_handle, uint32_t, amdsmi_power_profile_preset_masks_t] -amdsmi_dev_get_memory_total = _libraries['libamd_smi.so'].amdsmi_dev_get_memory_total -amdsmi_dev_get_memory_total.restype = amdsmi_status_t -amdsmi_dev_get_memory_total.argtypes = [amdsmi_processor_handle, amdsmi_memory_type_t, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_memory_total = _libraries['libamd_smi.so'].amdsmi_get_gpu_memory_total +amdsmi_get_gpu_memory_total.restype = amdsmi_status_t +amdsmi_get_gpu_memory_total.argtypes = [amdsmi_processor_handle, amdsmi_memory_type_t, ctypes.POINTER(ctypes.c_uint64)] amdsmi_dev_get_memory_usage = _libraries['libamd_smi.so'].amdsmi_dev_get_memory_usage amdsmi_dev_get_memory_usage.restype = amdsmi_status_t amdsmi_dev_get_memory_usage.argtypes = [amdsmi_processor_handle, amdsmi_memory_type_t, ctypes.POINTER(ctypes.c_uint64)] @@ -1859,7 +1859,7 @@ __all__ = \ 'amdsmi_dev_get_gpu_clk_freq', 'amdsmi_dev_get_gpu_metrics_info', 'amdsmi_get_gpu_id', 'amdsmi_dev_get_memory_busy_percent', 'amdsmi_dev_get_memory_reserved_pages', - 'amdsmi_dev_get_memory_total', 'amdsmi_dev_get_memory_usage', + 'amdsmi_get_gpu_memory_total', 'amdsmi_dev_get_memory_usage', 'amdsmi_dev_get_od_volt_curve_regions', 'amdsmi_dev_get_od_volt_info', 'amdsmi_dev_get_overdrive_level', 'amdsmi_get_gpu_pci_bandwidth', 'amdsmi_get_gpu_pci_id', diff --git a/py-interface/rocm_smi_tool.py b/py-interface/rocm_smi_tool.py index 6d27efedea..93e6eb1cff 100644 --- a/py-interface/rocm_smi_tool.py +++ b/py-interface/rocm_smi_tool.py @@ -300,7 +300,7 @@ class Formatter: | """ + self.style.text("11 Get topo numa affinity. Api: amdsmi_get_gpu_topo_numa_affinity ") + """ | | """ + self.style.text("12 Get device power ave. Api: amdsmi_get_power_ave ") + """ | | """ + self.style.text("13 Get device energy count. Api: amdsmi_get_energy_count ") + """ | - | """ + self.style.text("14 Get device memory total. Api: amdsmi_dev_get_memory_total ") + """ | + | """ + self.style.text("14 Get device memory total. Api: amdsmi_get_gpu_memory_total ") + """ | | """ + self.style.text("15 Get device memory usage. Api: amdsmi_dev_get_memory_usage ") + """ | | """ + self.style.text("16 Get device memory busy percent. Api: amdsmi_dev_get_memory_busy_percent ") + """ | | """ + self.style.text("17 Get device memory reserved pages. Api: amdsmi_dev_get_memory_reserved_pages ") + """ | @@ -383,7 +383,7 @@ def amdsmi_tool_dev_memory_total_get(dev): result = {} for memory_type in smi_api.AmdSmiMemoryType: try: - value = smi_api.amdsmi_dev_get_memory_total(dev, memory_type) + value = smi_api.amdsmi_get_gpu_memory_total(dev, memory_type) result.update({memory_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(memory_type.name, e)) diff --git a/src/amd_smi/amd_smi.cc b/src/amd_smi/amd_smi.cc index 970e7d8766..c305078208 100644 --- a/src/amd_smi/amd_smi.cc +++ b/src/amd_smi/amd_smi.cc @@ -931,7 +931,7 @@ amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle, {"rsmi_topo_numa_affinity_get", "amdsmi_get_gpu_topo_numa_affinity"}, {"rsmi_dev_gpu_metrics_info_get", " amdsmi_dev_get_gpu_metrics_info"}, {"rsmi_dev_gpu_reset", "amdsmi_dev_reset_gpu"}, - {"rsmi_dev_memory_total_get", "amdsmi_dev_get_memory_total"}, + {"rsmi_dev_memory_total_get", "amdsmi_get_gpu_memory_total"}, {"rsmi_dev_memory_usage_get", "amdsmi_dev_get_memory_usage"}, {"rsmi_dev_gpu_clk_freq_get", " amdsmi_dev_get_gpu_clk_freq"}, {"rsmi_dev_gpu_clk_freq_set", " amdsmi_dev_set_clk_freq"}, @@ -1269,7 +1269,7 @@ amdsmi_dev_get_memory_reserved_pages(amdsmi_processor_handle processor_handle, num_pages, reinterpret_cast(records)); } -amdsmi_status_t amdsmi_dev_get_memory_total(amdsmi_processor_handle processor_handle, +amdsmi_status_t amdsmi_get_gpu_memory_total(amdsmi_processor_handle processor_handle, amdsmi_memory_type_t mem_type, uint64_t *total) { return rsmi_wrapper(rsmi_dev_memory_total_get, processor_handle, static_cast(mem_type), total); diff --git a/tests/amd_smi_test/functional/mem_util_read.cc b/tests/amd_smi_test/functional/mem_util_read.cc index 3f12b77c94..07b83a20ab 100755 --- a/tests/amd_smi_test/functional/mem_util_read.cc +++ b/tests/amd_smi_test/functional/mem_util_read.cc @@ -131,9 +131,9 @@ void TestMemUtilRead::Run(void) { #endif for (uint32_t mem_type = AMDSMI_MEM_TYPE_FIRST; mem_type <= AMDSMI_MEM_TYPE_LAST; ++mem_type) { - err = amdsmi_dev_get_memory_total(processor_handles_[i], + err = amdsmi_get_gpu_memory_total(processor_handles_[i], static_cast(mem_type), &total); - err_chk("amdsmi_dev_get_memory_total()"); + err_chk("amdsmi_get_gpu_memory_total()"); if (err != AMDSMI_STATUS_SUCCESS) { return; } diff --git a/tests/amd_smi_test/functional/mutual_exclusion.cc b/tests/amd_smi_test/functional/mutual_exclusion.cc index 6ae35f3746..3c27b88a3c 100755 --- a/tests/amd_smi_test/functional/mutual_exclusion.cc +++ b/tests/amd_smi_test/functional/mutual_exclusion.cc @@ -289,7 +289,7 @@ void TestMutualExclusion::Run(void) { amdsmi_set_power_cap amdsmi_dev_get_power_profile_presets amdsmi_set_gpu_power_profile - amdsmi_dev_get_memory_total + amdsmi_get_gpu_memory_total amdsmi_dev_get_memory_usage amdsmi_dev_get_memory_busy_percent amdsmi_dev_get_busy_percent