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>
Αυτή η υποβολή περιλαμβάνεται σε:
υποβλήθηκε από
Oliveira, Daniel
γονέας
f00a03ed2b
υποβολή
7a557b1c50
@@ -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
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user