Added static --cache to cli tool
Change-Id: I494d29aba7915a0b8815036977b2636a2da5264e Signed-off-by: Maisam Arif <maisarif@amd.com>
Αυτή η υποβολή περιλαμβάνεται σε:
υποβλήθηκε από
Maisam Arif
γονέας
cb9875b056
υποβολή
66eb3de5e4
@@ -424,6 +424,85 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_gpu_vram_info
|
||||
|
||||
Description: Returns dictionary of vram information for the given GPU.
|
||||
|
||||
Input parameters:
|
||||
|
||||
* `processor_handle` device which to query
|
||||
|
||||
Output: Dictionary with fields
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`vram_type` | vram type
|
||||
`vram_vendor` | vram vendor
|
||||
`vram_size_mb` | vram size in mb
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_vram_info` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
devices = amdsmi_get_processor_handles()
|
||||
if len(devices) == 0:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
vram_info = amdsmi_get_gpu_vram_info(device)
|
||||
print(vram_info['vram_type'])
|
||||
print(vram_info['vram_vendor'])
|
||||
print(vram_info['vram_size_mb'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_gpu_cache_info
|
||||
|
||||
Description: Returns dictionary of cache information for the given GPU.
|
||||
|
||||
Input parameters:
|
||||
|
||||
* `processor_handle` device which to query
|
||||
|
||||
Output: Dictionary of Dictionaries containing cache information
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`cache #` | upt 10 caches will be available
|
||||
`cache_size` | size of cache in KB
|
||||
`cache_level` | level of cache
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_cache_info` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
devices = amdsmi_get_processor_handles()
|
||||
if len(devices) == 0:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
cache_info = amdsmi_get_gpu_cache_info(device)
|
||||
for cache_index, cache_values in cache_info.items():
|
||||
print(cache_index)
|
||||
print(cache_values['cache_size'])
|
||||
print(cache_values['cache_level'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_gpu_vbios_info
|
||||
|
||||
Description: Returns the static information for the VBIOS on the device.
|
||||
|
||||
@@ -40,6 +40,7 @@ from .amdsmi_interface import amdsmi_get_gpu_driver_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_asic_info
|
||||
from .amdsmi_interface import amdsmi_get_power_cap_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_vram_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_cache_info
|
||||
|
||||
# # Microcode and VBIOS Information
|
||||
from .amdsmi_interface import amdsmi_get_gpu_vbios_info
|
||||
|
||||
@@ -691,6 +691,30 @@ def amdsmi_get_gpu_vram_info(
|
||||
}
|
||||
|
||||
|
||||
def amdsmi_get_gpu_cache_info(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
) -> Dict[str, Any]:
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
raise AmdSmiParameterException(
|
||||
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
|
||||
)
|
||||
|
||||
cache_info = amdsmi_wrapper.amdsmi_gpu_cache_info_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_gpu_cache_info(
|
||||
processor_handle, ctypes.byref(cache_info))
|
||||
)
|
||||
|
||||
cache_info_dict = {}
|
||||
for cache_index in range(cache_info.num_cache_types):
|
||||
cache_size = cache_info.cache[cache_index].cache_size_kb
|
||||
cache_level = cache_info.cache[cache_index].cache_level
|
||||
cache_info_dict[f"cache {cache_index}"] = {"cache_size": cache_size,
|
||||
"cache_level": cache_level}
|
||||
|
||||
return cache_info_dict
|
||||
|
||||
|
||||
def amdsmi_get_gpu_vbios_info(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
) -> Dict[str, Any]:
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user