SWDEV-463405: Add amdsmi_get_link_topology_nearest support

amdsmi_get_link_topology_nearest() is used to retrieve
the set of GPUs that are nearest to a given device
at a specific interconnectivity level.

Code changes related to the following:
    * API
    * CLI
    * Unit tests
    * Examples

Header Unification Change: "/amdsmi/+/1122408"

Change-Id: Id0317797c652c267742513936d321677793ec634
Signed-off-by: Lang Yu <lang.yu@amd.com>
이 커밋은 다음에 포함됨:
Lang Yu 작성하고 Oliveira, Daniel가 2024-09-26 16:43:27 -05:00를 커밋함
1 부모 f00a03ed2b
커밋 7a557b1c50
11 파일이 변경됨
+535 -69

검색과 일치하는 파일 없음

+49
파일 보기
@@ -3867,6 +3867,55 @@ except AmdSmiException as e:
print(e)
```
### amdsmi_get_link_topology_nearest
Description: Retrieve the set of GPUs that are nearest to a given device
at a specific interconnectivity level.
Input parameters:
* `processor_handle` The identifier of the given device.
* `link_type` The AmdSmiLinkType level to search for nearest devices
Output: Dictionary holding the following fields.
* `count` number of nearest devices found based on given topology level
* `processor_list` list of all nearest device handlers found
Exceptions that can be thrown by `amdsmi_get_link_topology_nearest` function:
* `AmdSmiLibraryException`
Example:
```python
try:
amdsmi_init()
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs found on machine")
exit()
else:
print(amdsmi_get_gpu_device_uuid(devices[0]))
nearest_gpus = amdsmi_topology_nearest_t()
nearest_gpus = amdsmi_get_link_topology_nearest(devices[0], AmdSmiLinkType(2))
if (nearest_gpus['count']) == 0:
print("No nearest GPUs found on machine")
else:
print("Nearest GPUs")
for gpu in nearest_gpus['processor_list']:
print(amdsmi_get_gpu_device_uuid(gpu))
except AmdSmiException as e:
print(e)
finally:
try:
amdsmi_shut_down()
except AmdSmiException as e:
print(e)
```
## CPU APIs
### amdsmi_get_processor_info