SWDEV-361376 - Added socket releated functions

Change-Id: Ib5984e9d85cbba95dfc153c0ed23dae04f5f9a46
Signed-off-by: Dalibor Stanisavljevic <Dalibor.Stanisavljevic@amd.com>


[ROCm/amdsmi commit: 62154829b0]
Este commit está contenido en:
Dalibor Stanisavljevic
2022-11-14 12:49:13 +01:00
padre dd0eab575b
commit 6d5261ac5d
Se han modificado 3 ficheros con 60 adiciones y 2 borrados
+46
Ver fichero
@@ -145,6 +145,52 @@ except AmdSmiException as e:
print(e)
```
## amdsmi_get_socket_handles
**Note: CURRENTLY HARDCODED TO RETURN DUMMY DATA**
Description: Returns list of socket device handle objects on current machine
Input parameters: `None`
Output: List of socket device handle objects
Exceptions that can be thrown by `amdsmi_get_socket_handles` function:
* `AmdSmiLibraryException`
Example:
```python
try:
sockets = amdsmi_get_socket_handles()
print('Socket numbers: {}'.format(len(sockets)))
except AmdSmiException as e:
print(e)
```
## amdsmi_get_socket_info
**Note: CURRENTLY HARDCODED TO RETURN EMPTY VALUES**
Description: Return socket name
Input parameters:
`socket_handle` socket handle
Output: Socket name
Exceptions that can be thrown by `amdsmi_get_socket_info` function:
* `AmdSmiLibraryException`
Example:
```python
try:
socket_handles = amdsmi_get_socket_handles()
if len(socket_handles) == 0:
print("No sockets on machine")
else:
for socket in socket_handles:
print(amdsmi_get_socket_info(socket))
except AmdSmiException as e:
print(e)
```
## amdsmi_get_device_handle_from_bdf
Description: Returns device handle from the given BDF
+3
Ver fichero
@@ -26,6 +26,9 @@ from .amdsmi_interface import amdsmi_shut_down
# Device Descovery
from .amdsmi_interface import amdsmi_get_device_type
from .amdsmi_interface import amdsmi_get_device_handles
from .amdsmi_interface import amdsmi_get_socket_handles
from .amdsmi_interface import amdsmi_get_socket_info
from .amdsmi_interface import amdsmi_get_device_bdf
from .amdsmi_interface import amdsmi_get_device_uuid
from .amdsmi_interface import amdsmi_get_device_handle_from_bdf
+11 -2
Ver fichero
@@ -478,7 +478,7 @@ def _check_res(ret_code) -> None:
raise AmdSmiLibraryException(ret_code)
def _amdsmi_get_socket_handles() -> List[amdsmi_wrapper.amdsmi_socket_handle]:
def amdsmi_get_socket_handles() -> List[amdsmi_wrapper.amdsmi_socket_handle]:
"""
Function that gets socket handles. Wraps the same named function call.
@@ -508,9 +508,18 @@ def _amdsmi_get_socket_handles() -> List[amdsmi_wrapper.amdsmi_socket_handle]:
return sockets
def amdsmi_get_socket_info(socket_handle):
if not isinstance(socket_handle, amdsmi_wrapper.amdsmi_socket_handle):
raise AmdSmiParameterException(
socket_handle, amdsmi_wrapper.amdsmi_socket_handle)
return {
"name": ""
}
def amdsmi_get_device_handles() -> List[amdsmi_wrapper.amdsmi_device_handle]:
socket_handles = _amdsmi_get_socket_handles()
socket_handles = amdsmi_get_socket_handles()
devices = []
for socket in socket_handles:
device_count = ctypes.c_uint32()