diff --git a/projects/amdsmi/py-interface/README.md b/projects/amdsmi/py-interface/README.md index 12086b0604..3d2453144f 100644 --- a/projects/amdsmi/py-interface/README.md +++ b/projects/amdsmi/py-interface/README.md @@ -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 diff --git a/projects/amdsmi/py-interface/__init__.py b/projects/amdsmi/py-interface/__init__.py index 999dbb8c14..dc36d9819e 100644 --- a/projects/amdsmi/py-interface/__init__.py +++ b/projects/amdsmi/py-interface/__init__.py @@ -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 diff --git a/projects/amdsmi/py-interface/amdsmi_interface.py b/projects/amdsmi/py-interface/amdsmi_interface.py index 5f222fc6cf..27c5032dd9 100644 --- a/projects/amdsmi/py-interface/amdsmi_interface.py +++ b/projects/amdsmi/py-interface/amdsmi_interface.py @@ -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()