Renamed APIs
1) amdsmi_get_compute_process_info to
amdsmi_get_gpu_compute_process_info
2) amdsmi_get_compute_process_info_by_pid to
amdsmi_get_gpu_compute_process_info_by_pid
grep -rli 'amdsmi_get_compute_process_info' * | xargs -i@ sed -i
's/amdsmi_get_compute_process_info/amdsmi_get_gpu_compute_process_info/g' @
Change-Id: Ia5c9c22d1466ecea27d3ae3025b3b87db75853e2
[ROCm/amdsmi commit: f3854b3d5f]
This commit is contained in:
committed by
Naveen Krishna Chatradhi
parent
edd17ebe30
commit
48aa5df6ef
@@ -3011,7 +3011,7 @@ amdsmi_status_t
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items);
|
||||
amdsmi_get_gpu_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items);
|
||||
|
||||
/**
|
||||
* @brief Get process information about a specific process
|
||||
@@ -3030,7 +3030,7 @@ amdsmi_get_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_item
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_compute_process_info_by_pid(uint32_t pid, amdsmi_process_info_t *proc);
|
||||
amdsmi_get_gpu_compute_process_info_by_pid(uint32_t pid, amdsmi_process_info_t *proc);
|
||||
|
||||
/**
|
||||
* @brief Get the device indices currently being used by a process
|
||||
|
||||
@@ -2739,7 +2739,7 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
## amdsmi_get_compute_process_info
|
||||
## amdsmi_get_gpu_compute_process_info
|
||||
Description: Get process information about processes currently using GPU
|
||||
|
||||
Input parameters: None
|
||||
@@ -2754,21 +2754,21 @@ Field | Description
|
||||
`sdma_usage` | SDMA usage in microseconds
|
||||
`cu_occupancy` | Compute Unit usage in percents
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_compute_process_info` function:
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_compute_process_info` function:
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
|
||||
Example:
|
||||
```python
|
||||
try:
|
||||
procs = amdsmi_get_compute_process_info()
|
||||
procs = amdsmi_get_gpu_compute_process_info()
|
||||
for proc in procs:
|
||||
print(proc)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
## amdsmi_get_compute_process_info_by_pid
|
||||
## amdsmi_get_gpu_compute_process_info_by_pid
|
||||
Description: Get process information about processes currently using GPU
|
||||
|
||||
Input parameters:
|
||||
@@ -2784,7 +2784,7 @@ Field | Description
|
||||
`sdma_usage` | SDMA usage in microseconds
|
||||
`cu_occupancy` | Compute Unit usage in percents
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_compute_process_info_by_pid` function:
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_compute_process_info_by_pid` function:
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
@@ -2793,7 +2793,7 @@ Example:
|
||||
```python
|
||||
try:
|
||||
pid = 0 # << valid pid here
|
||||
proc = amdsmi_get_compute_process_info_by_pid(pid)
|
||||
proc = amdsmi_get_gpu_compute_process_info_by_pid(pid)
|
||||
print(proc)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
|
||||
@@ -130,8 +130,8 @@ from .amdsmi_interface import amdsmi_dev_get_gpu_ecc_status
|
||||
from .amdsmi_interface import amdsmi_status_string
|
||||
|
||||
# # System Information Query
|
||||
from .amdsmi_interface import amdsmi_get_compute_process_info
|
||||
from .amdsmi_interface import amdsmi_get_compute_process_info_by_pid
|
||||
from .amdsmi_interface import amdsmi_get_gpu_compute_process_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_compute_process_info_by_pid
|
||||
from .amdsmi_interface import amdsmi_get_compute_process_gpus
|
||||
from .amdsmi_interface import amdsmi_dev_xgmi_error_status
|
||||
from .amdsmi_interface import amdsmi_dev_reset_xgmi_error
|
||||
|
||||
@@ -2535,17 +2535,17 @@ def amdsmi_status_string(status: amdsmi_wrapper.amdsmi_status_t) -> str:
|
||||
return amdsmi_wrapper.string_cast(status_string_p_p.contents)
|
||||
|
||||
|
||||
def amdsmi_get_compute_process_info() -> List[Dict[str, int]]:
|
||||
def amdsmi_get_gpu_compute_process_info() -> List[Dict[str, int]]:
|
||||
num_items = ctypes.c_uint32(0)
|
||||
nullptr = ctypes.POINTER(amdsmi_wrapper.amdsmi_process_info_t)()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_compute_process_info(
|
||||
amdsmi_wrapper.amdsmi_get_gpu_compute_process_info(
|
||||
nullptr, ctypes.byref(num_items))
|
||||
)
|
||||
|
||||
procs = (amdsmi_wrapper.amdsmi_process_info_t * num_items.value)()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_compute_process_info(
|
||||
amdsmi_wrapper.amdsmi_get_gpu_compute_process_info(
|
||||
procs, ctypes.byref(num_items))
|
||||
)
|
||||
|
||||
@@ -2561,13 +2561,13 @@ def amdsmi_get_compute_process_info() -> List[Dict[str, int]]:
|
||||
]
|
||||
|
||||
|
||||
def amdsmi_get_compute_process_info_by_pid(pid: int) -> Dict[str, int]:
|
||||
def amdsmi_get_gpu_compute_process_info_by_pid(pid: int) -> Dict[str, int]:
|
||||
if not isinstance(pid, int):
|
||||
raise AmdSmiParameterException(pid, int)
|
||||
|
||||
proc = amdsmi_wrapper.amdsmi_process_info_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_compute_process_info_by_pid(
|
||||
amdsmi_wrapper.amdsmi_get_gpu_compute_process_info_by_pid(
|
||||
ctypes.c_uint32(pid), ctypes.byref(proc)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1607,12 +1607,12 @@ amdsmi_read_counter.argtypes = [amdsmi_event_handle_t, ctypes.POINTER(struct_c__
|
||||
amdsmi_counter_get_available_counters = _libraries['libamd_smi.so'].amdsmi_counter_get_available_counters
|
||||
amdsmi_counter_get_available_counters.restype = amdsmi_status_t
|
||||
amdsmi_counter_get_available_counters.argtypes = [amdsmi_processor_handle, amdsmi_event_group_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_compute_process_info = _libraries['libamd_smi.so'].amdsmi_get_compute_process_info
|
||||
amdsmi_get_compute_process_info.restype = amdsmi_status_t
|
||||
amdsmi_get_compute_process_info.argtypes = [ctypes.POINTER(struct_c__SA_amdsmi_process_info_t), ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_compute_process_info_by_pid = _libraries['libamd_smi.so'].amdsmi_get_compute_process_info_by_pid
|
||||
amdsmi_get_compute_process_info_by_pid.restype = amdsmi_status_t
|
||||
amdsmi_get_compute_process_info_by_pid.argtypes = [uint32_t, ctypes.POINTER(struct_c__SA_amdsmi_process_info_t)]
|
||||
amdsmi_get_gpu_compute_process_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_compute_process_info
|
||||
amdsmi_get_gpu_compute_process_info.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_compute_process_info.argtypes = [ctypes.POINTER(struct_c__SA_amdsmi_process_info_t), ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_gpu_compute_process_info_by_pid = _libraries['libamd_smi.so'].amdsmi_get_gpu_compute_process_info_by_pid
|
||||
amdsmi_get_gpu_compute_process_info_by_pid.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_compute_process_info_by_pid.argtypes = [uint32_t, ctypes.POINTER(struct_c__SA_amdsmi_process_info_t)]
|
||||
amdsmi_get_compute_process_gpus = _libraries['libamd_smi.so'].amdsmi_get_compute_process_gpus
|
||||
amdsmi_get_compute_process_gpus.restype = amdsmi_status_t
|
||||
amdsmi_get_compute_process_gpus.argtypes = [uint32_t, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
|
||||
@@ -1897,8 +1897,8 @@ __all__ = \
|
||||
'amdsmi_get_gpu_bad_page_info', 'amdsmi_get_gpu_board_info',
|
||||
'amdsmi_get_caps_info', 'amdsmi_get_clock_measure',
|
||||
'amdsmi_get_compute_process_gpus',
|
||||
'amdsmi_get_compute_process_info',
|
||||
'amdsmi_get_compute_process_info_by_pid', 'amdsmi_get_gpu_device_bdf',
|
||||
'amdsmi_get_gpu_compute_process_info',
|
||||
'amdsmi_get_gpu_compute_process_info_by_pid', 'amdsmi_get_gpu_device_bdf',
|
||||
'amdsmi_get_processor_handle_from_bdf', 'amdsmi_get_processor_handles',
|
||||
'amdsmi_get_processor_type', 'amdsmi_get_gpu_device_uuid',
|
||||
'amdsmi_get_gpu_driver_version', 'amdsmi_get_gpu_ecc_error_count',
|
||||
|
||||
@@ -325,8 +325,8 @@ class Formatter:
|
||||
| """ + self.style.text("36 Get device ecc enable. Api: amdsmi_dev_get_gpu_ecc_enabled <bdf>") + """ |
|
||||
| """ + self.style.text("37 Get device ecc status. Api: amdsmi_dev_get_gpu_ecc_status <bdf>") + """ |
|
||||
| """ + self.style.text("38 Get status string. Api: amdsmi_status_string <status>") + """ |
|
||||
| """ + self.style.text("39 Get compute process info. Api: amdsmi_get_compute_process_info <None>") + """ |
|
||||
| """ + self.style.text("40 Get compute process info by pid. Api: amdsmi_get_compute_process_info_by_pid <pid>") + """ |
|
||||
| """ + self.style.text("39 Get compute process info. Api: amdsmi_get_gpu_compute_process_info <None>") + """ |
|
||||
| """ + self.style.text("40 Get compute process info by pid. Api: amdsmi_get_gpu_compute_process_info_by_pid <pid>") + """ |
|
||||
| """ + self.style.text("41 Get compute process gpus. Api: amdsmi_get_compute_process_gpus <pid>") + """ |
|
||||
| """ + self.style.text("42 Get device xgmi_error_status. Api: amdsmi_dev_xgmi_error_status <bdf>") + """ |
|
||||
| """ + self.style.text("43 Get device xgmi error reset. Api: amdsmi_dev_reset_xgmi_error <bdf>") + """ |
|
||||
@@ -537,7 +537,7 @@ def amdsmi_tool_compute_process_gpus_get(dic):
|
||||
|
||||
def amdsmi_tool_compute_process_info_by_pid_get(dic):
|
||||
pid = dic["pid"]
|
||||
return smi_api.amdsmi_get_compute_process_info_by_pid(pid)
|
||||
return smi_api.amdsmi_get_gpu_compute_process_info_by_pid(pid)
|
||||
|
||||
def amdsmi_tool_topo_get_link_weight(dev):
|
||||
return smi_api.amdsmi_topo_get_link_weight(dev[0], dev[1])
|
||||
@@ -839,7 +839,7 @@ commands = {
|
||||
38: [amdsmi_tool_status_string, {
|
||||
"status": [int, True]
|
||||
}],
|
||||
39: [smi_api.amdsmi_get_compute_process_info, {}],
|
||||
39: [smi_api.amdsmi_get_gpu_compute_process_info, {}],
|
||||
40: [amdsmi_tool_compute_process_info_by_pid_get, {
|
||||
"pid": [int, True]
|
||||
}],
|
||||
|
||||
@@ -975,7 +975,7 @@ amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle,
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items) {
|
||||
amdsmi_get_gpu_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (num_items == nullptr)
|
||||
@@ -986,7 +986,7 @@ amdsmi_get_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_item
|
||||
return amd::smi::rsmi_to_amdsmi_status(r);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_compute_process_info_by_pid(uint32_t pid,
|
||||
amdsmi_status_t amdsmi_get_gpu_compute_process_info_by_pid(uint32_t pid,
|
||||
amdsmi_process_info_t *proc) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ void TestProcInfoRead::Run(void) {
|
||||
|
||||
uint32_t num_devices = num_monitor_devs();
|
||||
|
||||
err = amdsmi_get_compute_process_info(nullptr, &num_proc_found);
|
||||
err = amdsmi_get_gpu_compute_process_info(nullptr, &num_proc_found);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -129,7 +129,7 @@ void TestProcInfoRead::Run(void) {
|
||||
procs = new amdsmi_process_info_t[num_proc_found];
|
||||
|
||||
val_ui32 = num_proc_found;
|
||||
err = amdsmi_get_compute_process_info(procs, &val_ui32);
|
||||
err = amdsmi_get_gpu_compute_process_info(procs, &val_ui32);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -191,13 +191,13 @@ void TestProcInfoRead::Run(void) {
|
||||
amdsmi_process_info_t proc_info;
|
||||
for (uint32_t j = 0; j < num_proc_found; j++) {
|
||||
memset(&proc_info, 0x0, sizeof(amdsmi_process_info_t));
|
||||
err = amdsmi_get_compute_process_info_by_pid(procs[j].process_id,
|
||||
err = amdsmi_get_gpu_compute_process_info_by_pid(procs[j].process_id,
|
||||
&proc_info);
|
||||
if (err == AMDSMI_STATUS_NOT_FOUND) {
|
||||
std::cout <<
|
||||
"\t** WARNING: amdsmi_get_compute_process_info() found process " <<
|
||||
"\t** WARNING: amdsmi_get_gpu_compute_process_info() found process " <<
|
||||
procs[j].process_id << ", but subsequently, "
|
||||
"amdsmi_get_compute_process_info_by_pid() did not"
|
||||
"amdsmi_get_gpu_compute_process_info_by_pid() did not"
|
||||
" find this same process." << std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -217,10 +217,10 @@ void TestProcInfoRead::Run(void) {
|
||||
if (num_proc_found > 1) {
|
||||
amdsmi_process_info_t tmp_proc;
|
||||
val_ui32 = 1;
|
||||
err = amdsmi_get_compute_process_info(&tmp_proc, &val_ui32);
|
||||
err = amdsmi_get_gpu_compute_process_info(&tmp_proc, &val_ui32);
|
||||
|
||||
if (err != AMDSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
std::cout << "Expected amdsmi_get_compute_process_info() to tell us"
|
||||
std::cout << "Expected amdsmi_get_gpu_compute_process_info() to tell us"
|
||||
" there are more processes available, but instead go return code " <<
|
||||
err << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user