SWDEV-391188 - [AMDSMI][LinuxGuest] Added description in amdsmi header file for amdsmi_get_gpu_process_list, changed mentioned API in py_interface
Signed-off-by: Marko Oblak <Marko.Oblak@amd.com> Change-Id: I8cb7f2c6595da6ab0263e6fa4365bde91d900979
Tá an tiomantas seo le fáil i:
tiomanta ag
Dalibor Stanisavljevic
tuismitheoir
3b1e2f0817
tiomantas
78faf411f8
@@ -3390,16 +3390,21 @@ amdsmi_get_gpu_vram_usage(amdsmi_processor_handle processor_handle, amdsmi_vram_
|
||||
/**
|
||||
* @brief Returns the list of processes running on a given GPU including itself.
|
||||
*
|
||||
* @note The user provides a buffer to store the list and the
|
||||
* maximum number of processes that can be returned. If the user
|
||||
* sets max_processes to 0, the total number of processes will be
|
||||
* returned.
|
||||
* @note The user provides a buffer to store the list and the maximum
|
||||
* number of processes that can be returned. If the user sets
|
||||
* max_processes to 0, the current total number of processes will
|
||||
* replace max_processes param. After that, the function needs to be
|
||||
* called again, with updated max_processes, to successfully fill the
|
||||
* process list, which was previously allocated with max_processes
|
||||
*
|
||||
* @param[in] processor_handle Device which to query
|
||||
*
|
||||
* @param[in,out] max_processes Reference to the size of the list buffer in
|
||||
* number of elements. Returns the return number of elements
|
||||
* in list or the number of running processes if equal to 0.
|
||||
* in list or the number of running processes if equal to 0,
|
||||
* and if given value in param max_processes is less than
|
||||
* number of processes currently running,
|
||||
* AMDSMI_STATUS_OUT_OF_RESOURCES will be returned.
|
||||
*
|
||||
* @param[out] list Reference to a user-provided buffer where the process
|
||||
* list will be returned. This buffer must contain at least
|
||||
|
||||
@@ -28,6 +28,8 @@ from collections.abc import Iterable
|
||||
from . import amdsmi_wrapper
|
||||
from .amdsmi_exception import *
|
||||
|
||||
MAX_NUM_PROCESSES = 1024
|
||||
|
||||
class AmdSmiInitFlags(IntEnum):
|
||||
INIT_ALL_PROCESSORS = amdsmi_wrapper.AMDSMI_INIT_ALL_PROCESSORS
|
||||
INIT_AMD_CPUS = amdsmi_wrapper.AMDSMI_INIT_AMD_CPUS
|
||||
@@ -845,14 +847,7 @@ def amdsmi_get_gpu_process_list(
|
||||
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
|
||||
)
|
||||
|
||||
max_processes = ctypes.c_uint32(0)
|
||||
process_list = (amdsmi_wrapper.amdsmi_process_handle_t *
|
||||
max_processes.value)()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_gpu_process_list(
|
||||
processor_handle, ctypes.byref(max_processes), process_list
|
||||
)
|
||||
)
|
||||
max_processes = ctypes.c_uint32(MAX_NUM_PROCESSES)
|
||||
|
||||
process_list = (amdsmi_wrapper.amdsmi_process_handle_t *
|
||||
max_processes.value)()
|
||||
@@ -862,7 +857,8 @@ def amdsmi_get_gpu_process_list(
|
||||
)
|
||||
)
|
||||
|
||||
return [amdsmi_wrapper.amdsmi_process_handle_t(x) for x in list(process_list)]
|
||||
return [amdsmi_wrapper.amdsmi_process_handle_t(process_list[x])\
|
||||
for x in range(0, max_processes.value)]
|
||||
|
||||
|
||||
def amdsmi_get_gpu_process_info(
|
||||
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir