Merge amd-dev into amd-master 20230524
Change-Id: I13197ced9ac95113067fe4ec6a011826a8f3f328
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
[ROCm/amdsmi commit: 79b62b132f]
This commit is contained in:
@@ -208,9 +208,10 @@ set(CPACK_DEBIAN_ASAN_PACKAGE_RECOMMENDS "sudo, libdrm-dev")
|
||||
set(CPACK_DEBIAN_DEV_PACKAGE_RECOMMENDS "sudo, libdrm-dev")
|
||||
set(CPACK_DEBIAN_ASAN_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}-asan")
|
||||
set(CPACK_DEBIAN_DEV_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3")
|
||||
set(CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS "python3")
|
||||
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "python3")
|
||||
#Python 3.7.9 is the first stable build post the python bugfix window
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3 (>= 3.7.9), python3-clang, python3-yaml")
|
||||
set(CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS "python3 (>= 3.7.9), python3-clang, python3-yaml")
|
||||
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "python3 (>= 3.7.9), python3-clang, python3-yaml")
|
||||
|
||||
## Process the Debian install/remove scripts to update the CPACK variables
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst.in DEBIAN/postinst @ONLY)
|
||||
@@ -227,11 +228,12 @@ endif()
|
||||
set(CPACK_RPM_PACKAGE_PROVIDES "amd-smi")
|
||||
set(CPACK_RPM_DEV_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}")
|
||||
set(CPACK_RPM_ASAN_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}-asan")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "python3")
|
||||
#Python 3.7.9 is the first stable build post the python bugfix window
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "python38, python3-clang, python3-pyyaml")
|
||||
# don't terminate if bytecompile of python files fails
|
||||
set(CPACK_RPM_SPEC_MORE_DEFINE "%define _python_bytecompile_errors_terminate_build 0")
|
||||
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "python3")
|
||||
set(CPACK_RPM_ASAN_PACKAGE_REQUIRES "python3")
|
||||
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "python38, python3-clang, python3-pyyaml")
|
||||
set(CPACK_RPM_ASAN_PACKAGE_REQUIRES "python38, python3-clang, python3-pyyaml")
|
||||
|
||||
# Add rocm-core dependency if -DROCM_DEP_ROCMCORE=ON is passed
|
||||
if(ROCM_DEP_ROCMCORE)
|
||||
@@ -243,7 +245,6 @@ if(ROCM_DEP_ROCMCORE)
|
||||
string(APPEND CPACK_RPM_PACKAGE_REQUIRES ", rocm-core")
|
||||
endif()
|
||||
|
||||
|
||||
## Enable Component Mode and set component specific flags
|
||||
set(CPACK_DEB_COMPONENT_INSTALL ON)
|
||||
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${AMD_SMI_PACKAGE}")
|
||||
|
||||
+38
-13
@@ -76,7 +76,7 @@ Many of the functions in the library take a "socket handle" or "device handle".
|
||||
GPU device and CPU device on the same socket. Moreover, for MI200, it may have multiple GCDs.
|
||||
|
||||
To discover the sockets in the system, `amdsmi_get_socket_handles()` is called to get list of sockets
|
||||
handles, which in turn can be used to query the devices in that socket using `amdsmi_get_device_handles()`. The device handler is used to distinguish the detected devices from one another. It is important to note that a device may end up with a different device handles after restart application, so a device handle should not be relied upon to be constant over process.
|
||||
handles, which in turn can be used to query the devices in that socket using `amdsmi_get_processor_handles()`. The device handler is used to distinguish the detected devices from one another. It is important to note that a device may end up with a different device handles after restart application, so a device handle should not be relied upon to be constant over process.
|
||||
|
||||
## Hello AMD SMI
|
||||
|
||||
@@ -116,34 +116,34 @@ int main() {
|
||||
|
||||
// Get the device count for the socket.
|
||||
uint32_t device_count = 0;
|
||||
ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr);
|
||||
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
|
||||
|
||||
// Allocate the memory for the device handlers on the socket
|
||||
std::vector<amdsmi_device_handle> device_handles(device_count);
|
||||
std::vector<amdsmi_processor_handle> processor_handles(device_count);
|
||||
// Get all devices of the socket
|
||||
ret = amdsmi_get_device_handles(sockets[i],
|
||||
&device_count, &device_handles[0]);
|
||||
ret = amdsmi_get_processor_handles(sockets[i],
|
||||
&device_count, &processor_handles[0]);
|
||||
|
||||
// For each device of the socket, get name and temperature.
|
||||
for (uint32_t j=0; j < device_count; j++) {
|
||||
// Get device type. Since the amdsmi is initialized with
|
||||
// AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU.
|
||||
device_type_t device_type;
|
||||
ret = amdsmi_get_device_type(device_handles[j], &device_type);
|
||||
if (device_type != AMD_GPU) {
|
||||
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU.
|
||||
processor_type_t processor_type;
|
||||
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
|
||||
if (processor_type != AMD_GPU) {
|
||||
std::cout << "Expect AMD_GPU device type!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get device name
|
||||
amdsmi_board_info_t board_info;
|
||||
ret = amdsmi_get_board_info(device_handles[j], &board_info);
|
||||
ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info);
|
||||
std::cout << "\tdevice "
|
||||
<< j <<"\n\t\tName:" << board_info.product_name << std::endl;
|
||||
|
||||
// Get temperature
|
||||
int64_t val_i64 = 0;
|
||||
ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE,
|
||||
ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
|
||||
AMDSMI_TEMP_CURRENT, &val_i64);
|
||||
std::cout << "\t\tTemperature: " << val_i64 << "C" << std::endl;
|
||||
}
|
||||
@@ -157,7 +157,32 @@ int main() {
|
||||
}
|
||||
```
|
||||
|
||||
# Python wrapper
|
||||
# Insall Python Library and CLI Tool
|
||||
|
||||
## Requirements
|
||||
|
||||
- python 3.7+ 64-bit
|
||||
- driver must be loaded for amdsmi_init() to pass
|
||||
|
||||
## Installation
|
||||
|
||||
- Install amdgpu driver
|
||||
- Install amd-smi-lib package through package manager
|
||||
- cd /opt/<rocm_instance>/share/amd_smi
|
||||
- pip install .
|
||||
|
||||
or
|
||||
|
||||
- pip3 install .
|
||||
- /opt/<rocm_instance>/bin/amd-smi --help
|
||||
|
||||
Add /opt/<rocm_instance>/bin to your shell's path to call amd-smi from the cmdline
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation for AMDSMI-CLI is available post install in /opt/<rocm_instance>/libexec/amdsmi_cli/README.md
|
||||
|
||||
## Rebuilding Python wrapper
|
||||
The python wrapper (binding) is an auto-generated file `py-interface/amdsmi_wrapper.py`
|
||||
|
||||
Wrapper should be re-generated on each C++ API change, by doing:
|
||||
@@ -173,7 +198,7 @@ Note: To be able to re-generate python wrapper you need several tools installed
|
||||
|
||||
Note: python_wrapper is NOT automatically re-generated. You must run `cmake` with `-DBUILD_WRAPPER=on` argument.
|
||||
|
||||
## DISCLAIMER
|
||||
# DISCLAIMER
|
||||
|
||||
The information contained herein is for informational purposes only, and is subject to change without notice. In addition, any stated support is planned and is also subject to change. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# AMD System Management Interface
|
||||
|
||||
This tool acts as a command line interface for manipulating
|
||||
and monitoring the amdgpu kernel, and is intended to replace
|
||||
and deprecate the existing rocm_smi CLI tool & gpuv-smi tool.
|
||||
@@ -6,27 +7,47 @@ It uses Ctypes to call the amd_smi_lib API.
|
||||
Recommended: At least one AMD GPU with AMD driver installed
|
||||
|
||||
## Requirements
|
||||
* python 3.7+ 64-bit
|
||||
* driver must be loaded for amdsmi_init() to pass
|
||||
|
||||
- python 3.7+ 64-bit
|
||||
- driver must be loaded for amdsmi_init() to pass
|
||||
|
||||
## Installation
|
||||
|
||||
- Install amdgpu driver
|
||||
- Through package manager install amd-smi-lib
|
||||
- Install amd-smi-lib package through package manager
|
||||
- cd /opt/<rocm_instance>/share/amd_smi
|
||||
- pip install .
|
||||
- /opt/<rocm_instance>/bin/amd-smi
|
||||
|
||||
or
|
||||
|
||||
- pip3 install .
|
||||
- /opt/<rocm_instance>/bin/amd-smi --help
|
||||
|
||||
### RHEL 8
|
||||
|
||||
The default python version in RHEL 8 is python 3.6.8
|
||||
|
||||
To install the python library you need to upgrade to python 3.7+
|
||||
|
||||
The package's dependency manager will attempt to install python 3.8+
|
||||
|
||||
Verify that your pip version is 3.7+ and if not you can use pip3.8 instead
|
||||
|
||||
### Example of Ubuntu 22.04 post amdgpu driver install
|
||||
|
||||
``` shell
|
||||
apt install amd-smi-lib
|
||||
cd /opt/rocm/share/amd_smi
|
||||
pip install .
|
||||
/opt/rocm/bin/amd-smi
|
||||
```
|
||||
Add /opt/rocm/bin to your local path to access amd-smi via the cmdline
|
||||
|
||||
Add /opt/rocm/bin to your shell's path to access amd-smi via the cmdline
|
||||
|
||||
## Usage
|
||||
|
||||
amd-smi will report the version and current platform detected when running the command without arguments:
|
||||
|
||||
``` bash
|
||||
amd-smi
|
||||
usage: amd-smi [-h] ...
|
||||
@@ -51,12 +72,15 @@ AMD-SMI Commands:
|
||||
set Set options for devices.
|
||||
reset Reset options for devices.
|
||||
```
|
||||
|
||||
More detailed verison information can be give when running `amd-smi version`
|
||||
|
||||
Each command will have detailed information via `amd-smi [command] --help`
|
||||
|
||||
## Commands
|
||||
|
||||
For convenience, here is the help output for each command
|
||||
|
||||
``` bash
|
||||
amd-smi discovery --help
|
||||
usage: amd-smi discovery [-h] [--json | --csv] [--file FILE]
|
||||
@@ -330,4 +354,3 @@ The information contained herein is for informational purposes only, and is subj
|
||||
AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.
|
||||
|
||||
Copyright (c) 2014-2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# Release Notes
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation for AMDSMI-CLI is available post install in /opt/<rocm_instance>/libexec/amdsmi_cli/README.md
|
||||
|
||||
## AMDSMI-CLI 0.0.4
|
||||
|
||||
### Added
|
||||
|
||||
- AMDSMI-CLI tool enabled for Linux Baremetal & Guest
|
||||
- Added CSV & Watch modifier
|
||||
- Added topology subcommand
|
||||
|
||||
### Known Issues
|
||||
|
||||
- not all ecc fields are currently supported
|
||||
- RHEL 8 has extra install steps
|
||||
|
||||
## AMDSMI-CLI 0.0.2
|
||||
|
||||
### Added
|
||||
|
||||
- AMDSMI-CLI tool enabled for Linux Baremetal & Guest
|
||||
|
||||
### Known Issues
|
||||
|
||||
- ecc & ras subcommands will report N/A even if RAS is enabled
|
||||
- process vram_mem's unit is listed as percentage vs bytes
|
||||
- csv modifier does not work
|
||||
- topology information is not yet enabled
|
||||
- watch modifier not fully enabled
|
||||
- limited guest support
|
||||
@@ -1 +1 @@
|
||||
__version__ = "0.0.4"
|
||||
__version__ = "0.1.0"
|
||||
|
||||
@@ -28,6 +28,7 @@ from amdsmi_parser import AMDSMIParser
|
||||
from amdsmi_logger import AMDSMILogger
|
||||
import amdsmi_cli_exceptions
|
||||
from amdsmi import amdsmi_interface
|
||||
from amdsmi import amdsmi_exception
|
||||
|
||||
|
||||
def _print_error(e, destination):
|
||||
@@ -85,6 +86,6 @@ if __name__ == "__main__":
|
||||
args.func(args)
|
||||
except amdsmi_cli_exceptions.AmdSmiException as e:
|
||||
_print_error(str(e), amd_smi_commands.logger.destination)
|
||||
except amdsmi_interface.AmdSmiLibraryException as e:
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
exc = amdsmi_cli_exceptions.AmdSmiAMDSMIErrorException(amd_smi_commands.logger.format, e.get_error_code())
|
||||
_print_error(str(exc), amd_smi_commands.logger.destination)
|
||||
|
||||
@@ -44,7 +44,7 @@ class AMDSMICommands():
|
||||
format=format,
|
||||
destination=destination)
|
||||
try:
|
||||
self.device_handles = amdsmi_interface.amdsmi_get_device_handles()
|
||||
self.device_handles = amdsmi_interface.amdsmi_get_processor_handles()
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
raise e
|
||||
self.stop = ''
|
||||
@@ -117,12 +117,12 @@ class AMDSMICommands():
|
||||
args.gpu = device_handle
|
||||
|
||||
try:
|
||||
bdf = amdsmi_interface.amdsmi_get_device_bdf(args.gpu)
|
||||
bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
bdf = e.get_error_info()
|
||||
|
||||
try:
|
||||
uuid = amdsmi_interface.amdsmi_get_device_uuid(args.gpu)
|
||||
uuid = amdsmi_interface.amdsmi_get_gpu_device_uuid(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
uuid = e.get_error_info()
|
||||
|
||||
@@ -185,7 +185,7 @@ class AMDSMICommands():
|
||||
args.caps = caps
|
||||
if numa:
|
||||
args.numa = numa
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if ras:
|
||||
args.ras = ras
|
||||
if limit:
|
||||
@@ -204,10 +204,10 @@ class AMDSMICommands():
|
||||
args.gpu = device_handle
|
||||
|
||||
# If all arguments are False, it means that no argument was passed and the entire static should be printed
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if not any([args.asic, args.bus, args.vbios, args.limit, args.driver, args.caps, args.ras, args.board]):
|
||||
args.asic = args.bus = args.vbios = args.limit = args.driver = args.caps = args.ras = args.board = args.numa = self.all_arguments = True
|
||||
if (self.helpers.is_linux() and self.helpers.is_virtual_os()):
|
||||
if self.helpers.is_linux() and self.helpers.is_virtual_os():
|
||||
if not any([args.asic, args.bus, args.vbios, args.driver, args.caps]):
|
||||
args.asic = args.bus = args.vbios = args.driver = args.caps = self.all_arguments = True
|
||||
|
||||
@@ -215,8 +215,7 @@ class AMDSMICommands():
|
||||
|
||||
if args.asic:
|
||||
try:
|
||||
asic_info = amdsmi_interface.amdsmi_get_asic_info(args.gpu)
|
||||
asic_info['family'] = hex(asic_info['family'])
|
||||
asic_info = amdsmi_interface.amdsmi_get_gpu_asic_info(args.gpu)
|
||||
asic_info['vendor_id'] = hex(asic_info['vendor_id'])
|
||||
asic_info['device_id'] = hex(asic_info['device_id'])
|
||||
asic_info['rev_id'] = hex(asic_info['rev_id'])
|
||||
@@ -243,7 +242,7 @@ class AMDSMICommands():
|
||||
raise e
|
||||
|
||||
try:
|
||||
bus_output_info['bdf'] = amdsmi_interface.amdsmi_get_device_bdf(args.gpu)
|
||||
bus_output_info['bdf'] = amdsmi_interface.amdsmi_get_gpu_device_bdf(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
bus_output_info['bdf'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
@@ -253,28 +252,26 @@ class AMDSMICommands():
|
||||
static_dict['bus'] = bus_output_info
|
||||
if args.vbios:
|
||||
try:
|
||||
vbios_info = amdsmi_interface.amdsmi_get_vbios_info(args.gpu)
|
||||
vbios_info = amdsmi_interface.amdsmi_get_gpu_vbios_info(args.gpu)
|
||||
if self.logger.is_gpuvsmi_compatibility():
|
||||
vbios_info['version'] = vbios_info.pop('vbios_version_string')
|
||||
vbios_info['version'] = vbios_info.pop('version')
|
||||
vbios_info['build_date'] = vbios_info.pop('build_date')
|
||||
vbios_info['part_number'] = vbios_info.pop('part_number')
|
||||
vbios_info['vbios_version'] = vbios_info.pop('vbios_version')
|
||||
|
||||
static_dict['vbios'] = vbios_info
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict['vbios'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if args.board:
|
||||
try:
|
||||
board_info = amdsmi_interface.amdsmi_get_board_info(args.gpu)
|
||||
board_info = amdsmi_interface.amdsmi_get_gpu_board_info(args.gpu)
|
||||
board_info['serial_number'] = hex(board_info['serial_number'])
|
||||
board_info['model_number'] = board_info['model_number'].strip()
|
||||
board_info['product_serial'] = '0x' + board_info['product_serial']
|
||||
|
||||
if self.logger.is_gpuvsmi_compatibility():
|
||||
board_info['product_number'] = board_info.pop('product_serial')
|
||||
board_info['product_name'] = board_info.pop('product_name')
|
||||
board_info['product_name'] = board_info['product_name'].strip()
|
||||
board_info['manufacturer_name'] = board_info['manufacturer_name'].strip()
|
||||
|
||||
static_dict['board'] = board_info
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
@@ -283,14 +280,14 @@ class AMDSMICommands():
|
||||
raise e
|
||||
if args.limit:
|
||||
try:
|
||||
power_limit = amdsmi_interface.amdsmi_get_power_measure(args.gpu)['power_limit']
|
||||
power_limit = amdsmi_interface.amdsmi_get_power_info(args.gpu)['power_limit']
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
power_limit = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
|
||||
try:
|
||||
temp_edge_limit = amdsmi_interface.amdsmi_dev_get_temp_metric(args.gpu,
|
||||
temp_edge_limit = amdsmi_interface.amdsmi_get_temp_metric(args.gpu,
|
||||
amdsmi_interface.AmdSmiTemperatureType.EDGE, amdsmi_interface.AmdSmiTemperatureMetric.CRITICAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
temp_edge_limit = e.get_error_info()
|
||||
@@ -298,7 +295,7 @@ class AMDSMICommands():
|
||||
raise e
|
||||
|
||||
try:
|
||||
temp_junction_limit = amdsmi_interface.amdsmi_dev_get_temp_metric(args.gpu,
|
||||
temp_junction_limit = amdsmi_interface.amdsmi_get_temp_metric(args.gpu,
|
||||
amdsmi_interface.AmdSmiTemperatureType.JUNCTION, amdsmi_interface.AmdSmiTemperatureMetric.CRITICAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
temp_junction_limit = e.get_error_info()
|
||||
@@ -306,7 +303,7 @@ class AMDSMICommands():
|
||||
raise e
|
||||
|
||||
try:
|
||||
temp_vram_limit = amdsmi_interface.amdsmi_dev_get_temp_metric(args.gpu,
|
||||
temp_vram_limit = amdsmi_interface.amdsmi_get_temp_metric(args.gpu,
|
||||
amdsmi_interface.AmdSmiTemperatureType.VRAM, amdsmi_interface.AmdSmiTemperatureMetric.CRITICAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
temp_junction_limit = e.get_error_info()
|
||||
@@ -332,46 +329,26 @@ class AMDSMICommands():
|
||||
if args.driver:
|
||||
try:
|
||||
driver_info = {}
|
||||
driver_info['driver_version'] = amdsmi_interface.amdsmi_get_driver_version(args.gpu)
|
||||
driver_info['driver_version'] = amdsmi_interface.amdsmi_get_gpu_driver_version(args.gpu)
|
||||
|
||||
static_dict['driver'] = driver_info
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict['driver'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if args.ras:
|
||||
try:
|
||||
if self.helpers.has_ras_support(args.gpu):
|
||||
static_dict['ras'] = amdsmi_interface.amdsmi_get_ras_block_features_enabled(args.gpu)
|
||||
else:
|
||||
static_dict['ras'] = 'N/A'
|
||||
|
||||
static_dict['ras'] = amdsmi_interface.amdsmi_get_gpu_ras_block_features_enabled(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict['ras'] = e.get_error_info()
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED:
|
||||
static_dict['ras'] = 'N/A'
|
||||
else:
|
||||
static_dict['ras'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
if args.caps:
|
||||
try:
|
||||
caps_info = amdsmi_interface.amdsmi_get_caps_info(args.gpu)
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
for capability_name, capability_value in caps_info.items():
|
||||
if isinstance(capability_value, list):
|
||||
caps_info[capability_name] = f"{capability_value}"
|
||||
if isinstance(capability_value, bool):
|
||||
caps_info[capability_name] = f"{bool(capability_value)}"
|
||||
|
||||
if self.logger.is_csv_format() and self.logger.is_gpuvsmi_compatibility():
|
||||
if 'mm_ip_list' in caps_info:
|
||||
if caps_info['mm_ip_list']: # Don't index if it's not populated
|
||||
caps_info['mm_ip_list'] = caps_info['mm_ip_list'][0]
|
||||
|
||||
static_dict['caps'] = caps_info
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict['caps'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
pass
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if args.numa:
|
||||
try:
|
||||
@@ -382,7 +359,7 @@ class AMDSMICommands():
|
||||
raise e
|
||||
|
||||
try:
|
||||
numa_affinity = amdsmi_interface.amdsmi_topo_get_numa_affinity(args.gpu)
|
||||
numa_affinity = amdsmi_interface.amdsmi_get_gpu_topo_numa_affinity(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
numa_affinity = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
@@ -395,19 +372,19 @@ class AMDSMICommands():
|
||||
# Convert and store output by pid for csv format
|
||||
if self.logger.is_csv_format():
|
||||
# expand if ras blocks are populated
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal() and args.ras):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal() and args.ras:
|
||||
if isinstance(static_dict['ras'], list):
|
||||
ras_dicts = static_dict.pop('ras')
|
||||
multiple_devices_csv_override = True
|
||||
for ras_dict in ras_dicts:
|
||||
for key, value in ras_dict.items():
|
||||
self.logger.store_output(args.gpu, key, value)
|
||||
self.logger.store_output(args.gpu, 'values', static_dict)
|
||||
self.logger.store_output(args.gpu, 'values', static_dict)
|
||||
self.logger.store_multiple_device_output()
|
||||
else:
|
||||
# Store values if ras has an error
|
||||
self.logger.store_output(args.gpu, 'values', static_dict)
|
||||
if (self.helpers.is_linux() and self.helpers.is_virtual_os()):
|
||||
if self.helpers.is_linux() and self.helpers.is_virtual_os():
|
||||
self.logger.store_output(args.gpu, 'values', static_dict)
|
||||
else:
|
||||
self.logger.store_output(args.gpu, 'values', static_dict)
|
||||
@@ -551,7 +528,7 @@ class AMDSMICommands():
|
||||
bad_page_err_output = ''
|
||||
|
||||
try:
|
||||
bad_page_info = amdsmi_interface.amdsmi_get_bad_page_info(args.gpu)
|
||||
bad_page_info = amdsmi_interface.amdsmi_get_gpu_bad_page_info(args.gpu)
|
||||
bad_page_error = False
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
bad_page_info = ""
|
||||
@@ -631,8 +608,8 @@ class AMDSMICommands():
|
||||
|
||||
def metric(self, args, multiple_devices=False, watching_output=False, gpu=None,
|
||||
usage=None, watch=None, watch_time=None, iterations=None, fb_usage=None, power=None,
|
||||
clock=None, temperature=None, ecc=None, pcie=None, voltage=None, fan=None,
|
||||
voltage_curve=None, overdrive=None, mem_overdrive=None, perf_level=None,
|
||||
clock=None, temperature=None, ecc=None, ecc_block=None, pcie=None, voltage=None,
|
||||
fan=None, voltage_curve=None, overdrive=None, mem_overdrive=None, perf_level=None,
|
||||
replay_count=None, xgmi_err=None, energy=None, mem_usage=None):
|
||||
"""Get Metric information for target gpu
|
||||
|
||||
@@ -650,6 +627,7 @@ class AMDSMICommands():
|
||||
clock (bool, optional): Value override for args.clock. Defaults to None.
|
||||
temperature (bool, optional): Value override for args.temperature. Defaults to None.
|
||||
ecc (bool, optional): Value override for args.ecc. Defaults to None.
|
||||
ecc_block (bool, optional): Value override for args.ecc. Defaults to None.
|
||||
pcie (bool, optional): Value override for args.pcie. Defaults to None.
|
||||
voltage (bool, optional): Value override for args.voltage. Defaults to None.
|
||||
fan (bool, optional): Value override for args.fan. Defaults to None.
|
||||
@@ -684,7 +662,7 @@ class AMDSMICommands():
|
||||
if mem_usage:
|
||||
args.mem_usage = mem_usage
|
||||
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if usage:
|
||||
args.usage = usage
|
||||
if power:
|
||||
@@ -695,6 +673,8 @@ class AMDSMICommands():
|
||||
args.temperature = temperature
|
||||
if ecc:
|
||||
args.ecc = ecc
|
||||
if ecc_block:
|
||||
args.ecc_block = ecc_block
|
||||
if pcie:
|
||||
args.pcie = pcie
|
||||
if voltage:
|
||||
@@ -755,21 +735,21 @@ class AMDSMICommands():
|
||||
raise IndexError("args.gpu should not be an empty list")
|
||||
|
||||
# Check if any of the options have been set, if not then set them all to true
|
||||
if (self.helpers.is_linux() and self.helpers.is_virtual_os()):
|
||||
if self.helpers.is_linux() and self.helpers.is_virtual_os():
|
||||
if not any([args.fb_usage, args.replay_count, args.mem_usage]):
|
||||
args.fb_usage = args.replay_count = args.mem_usage = self.all_arguments = True
|
||||
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if not any([args.usage, args.fb_usage, args.power, args.clock, args.temperature, args.ecc, args.pcie, args.voltage, args.fan,
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if not any([args.usage, args.fb_usage, args.power, args.clock, args.temperature, args.ecc, args.ecc_block, args.pcie, args.voltage, args.fan,
|
||||
args.voltage_curve, args.overdrive, args.mem_overdrive, args.perf_level,
|
||||
args.replay_count, args.xgmi_err, args.energy, args.mem_usage]):
|
||||
args.usage = args.fb_usage = args.power = args.clock = args.temperature = args.ecc = args.pcie = args.voltage = args.fan = \
|
||||
args.usage = args.fb_usage = args.power = args.clock = args.temperature = args.ecc = args.ecc_block = args.pcie = args.voltage = args.fan = \
|
||||
args.voltage_curve = args.overdrive = args.mem_overdrive = args.perf_level = \
|
||||
args.replay_count = args.xgmi_err = args.energy = args.mem_usage = self.all_arguments = True
|
||||
|
||||
# Add timestamp and store values for specified arguments
|
||||
values_dict = {}
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if args.usage:
|
||||
try:
|
||||
engine_usage = amdsmi_interface.amdsmi_get_gpu_activity(args.gpu)
|
||||
@@ -791,7 +771,7 @@ class AMDSMICommands():
|
||||
raise e
|
||||
if args.fb_usage:
|
||||
try:
|
||||
vram_usage = amdsmi_interface.amdsmi_get_vram_usage(args.gpu)
|
||||
vram_usage = amdsmi_interface.amdsmi_get_gpu_vram_usage(args.gpu)
|
||||
|
||||
if self.logger.is_gpuvsmi_compatibility():
|
||||
vram_usage['fb_total'] = vram_usage.pop('vram_total')
|
||||
@@ -808,39 +788,39 @@ class AMDSMICommands():
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if args.power:
|
||||
power_dict = {}
|
||||
try:
|
||||
power_measure = amdsmi_interface.amdsmi_get_power_measure(args.gpu)
|
||||
power_measure = amdsmi_interface.amdsmi_get_power_info(args.gpu)
|
||||
power_dict = {'average_socket_power': power_measure['average_socket_power'],
|
||||
'voltage_gfx': power_measure['voltage_gfx'],
|
||||
'voltage_soc': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info,
|
||||
'voltage_mem': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info}
|
||||
'gfx_voltage': power_measure['gfx_voltage'],
|
||||
'soc_voltage': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info,
|
||||
'mem_voltage': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info}
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
power_dict['average_socket_power'] = f"{power_dict['average_socket_power']} W"
|
||||
power_dict['voltage_gfx'] = f"{power_dict['voltage_gfx']} mV"
|
||||
power_dict['voltage_soc'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info
|
||||
power_dict['voltage_mem'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info
|
||||
power_dict['gfx_voltage'] = f"{power_dict['gfx_voltage']} mV"
|
||||
power_dict['soc_voltage'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info
|
||||
power_dict['mem_voltage'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info
|
||||
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
power_dict = {'average_socket_power': e.get_error_info(),
|
||||
'voltage_gfx': e.get_error_info(),
|
||||
'voltage_soc': e.get_error_info(),
|
||||
'voltage_mem': e.get_error_info()}
|
||||
'gfx_voltage': e.get_error_info(),
|
||||
'soc_voltage': e.get_error_info(),
|
||||
'mem_voltage': e.get_error_info()}
|
||||
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
|
||||
if self.logger.is_gpuvsmi_compatibility():
|
||||
power_dict['current_power'] = power_dict.pop('average_socket_power')
|
||||
power_dict['current_voltage'] = power_dict.pop('voltage_gfx')
|
||||
power_dict['current_voltage_soc'] = power_dict.pop('voltage_soc')
|
||||
power_dict['current_voltage_mem'] = power_dict.pop('voltage_mem')
|
||||
power_dict['current_voltage'] = power_dict.pop('gfx_voltage')
|
||||
power_dict['current_soc_voltage'] = power_dict.pop('soc_voltage')
|
||||
power_dict['current_mem_voltage'] = power_dict.pop('mem_voltage')
|
||||
|
||||
try:
|
||||
power_dict['current_fan_rpm'] = amdsmi_interface.amdsmi_dev_get_fan_rpms(args.gpu, 0)
|
||||
power_dict['current_fan_rpm'] = amdsmi_interface.amdsmi_get_gpu_fan_rpms(args.gpu, 0)
|
||||
if self.logger.is_human_readable_format():
|
||||
power_dict['current_fan_rpm'] = f"{power_dict['current_fan_rpm']} RPM"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
@@ -851,8 +831,8 @@ class AMDSMICommands():
|
||||
values_dict['power'] = power_dict
|
||||
if args.clock:
|
||||
try:
|
||||
clock_gfx = amdsmi_interface.amdsmi_get_clock_measure(args.gpu, amdsmi_interface.AmdSmiClkType.GFX)
|
||||
clock_mem = amdsmi_interface.amdsmi_get_clock_measure(args.gpu, amdsmi_interface.AmdSmiClkType.MEM)
|
||||
clock_gfx = amdsmi_interface.amdsmi_get_clock_info(args.gpu, amdsmi_interface.AmdSmiClkType.GFX)
|
||||
clock_mem = amdsmi_interface.amdsmi_get_clock_info(args.gpu, amdsmi_interface.AmdSmiClkType.MEM)
|
||||
|
||||
clocks = {'gfx': clock_gfx,
|
||||
'mem': clock_mem}
|
||||
@@ -870,11 +850,11 @@ class AMDSMICommands():
|
||||
raise e
|
||||
if args.temperature:
|
||||
try:
|
||||
temperature_edge_current = amdsmi_interface.amdsmi_dev_get_temp_metric(
|
||||
temperature_edge_current = amdsmi_interface.amdsmi_get_temp_metric(
|
||||
args.gpu, amdsmi_interface.AmdSmiTemperatureType.EDGE, amdsmi_interface.AmdSmiTemperatureMetric.CURRENT)
|
||||
temperature_junction_current = amdsmi_interface.amdsmi_dev_get_temp_metric(
|
||||
temperature_junction_current = amdsmi_interface.amdsmi_get_temp_metric(
|
||||
args.gpu, amdsmi_interface.AmdSmiTemperatureType.JUNCTION, amdsmi_interface.AmdSmiTemperatureMetric.CURRENT)
|
||||
temperature_vram_current = amdsmi_interface.amdsmi_dev_get_temp_metric(
|
||||
temperature_vram_current = amdsmi_interface.amdsmi_get_temp_metric(
|
||||
args.gpu, amdsmi_interface.AmdSmiTemperatureType.VRAM, amdsmi_interface.AmdSmiTemperatureMetric.CURRENT)
|
||||
|
||||
temperatures = {'edge': temperature_edge_current,
|
||||
@@ -899,23 +879,44 @@ class AMDSMICommands():
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
if args.ecc:
|
||||
ecc_count = {}
|
||||
try:
|
||||
ecc_count = amdsmi_interface.amdsmi_get_gpu_ecc_error_count(args.gpu)
|
||||
ecc_count['correctable'] = ecc_count.pop('correctable_count')
|
||||
ecc_count['uncorrectable'] = ecc_count.pop('uncorrectable_count')
|
||||
|
||||
values_dict['ecc'] = ecc_count
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED:
|
||||
ecc_count['correctable'] = 'N/A'
|
||||
ecc_count['uncorrectable'] = 'N/A'
|
||||
values_dict['ecc'] = ecc_count
|
||||
else:
|
||||
values_dict['ecc'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
|
||||
if args.ecc_block:
|
||||
ecc_dict = {}
|
||||
try:
|
||||
if self.helpers.has_ras_support(args.gpu):
|
||||
ras_states = amdsmi_interface.amdsmi_get_ras_block_features_enabled(args.gpu)
|
||||
for state in ras_states:
|
||||
if state['status'] == amdsmi_interface.AmdSmiRasErrState.ENABLED:
|
||||
gpu_block = amdsmi_interface.AmdSmiGpuBlock[state['block']]
|
||||
ecc_count = amdsmi_interface.amdsmi_dev_get_ecc_count(args.gpu, gpu_block)
|
||||
ras_states = amdsmi_interface.amdsmi_get_ras_block_features_enabled(args.gpu)
|
||||
for state in ras_states:
|
||||
if state['status'] == amdsmi_interface.AmdSmiRasErrState.ENABLED.name:
|
||||
gpu_block = amdsmi_interface.AmdSmiGpuBlock[state['block']]
|
||||
try:
|
||||
ecc_count = amdsmi_interface.amdsmi_get_gpu_ecc_count(args.gpu, gpu_block)
|
||||
ecc_dict[state['block']] = {'correctable' : ecc_count['correctable_count'],
|
||||
'uncorrectable': ecc_count['uncorrectable_count']}
|
||||
if not ecc_dict:
|
||||
ecc_dict['correctable'] = 'N/A'
|
||||
ecc_dict['uncorrectable'] = 'N/A'
|
||||
'uncorrectable': ecc_count['uncorrectable_count']}
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
ecc_count = e.get_error_info()
|
||||
if self.logger.is_gpuvsmi_compatibility():
|
||||
ecc_count = "N/A"
|
||||
|
||||
values_dict['ecc'] = ecc_dict
|
||||
ecc_dict[state['block']] = {'correctable' : ecc_count,
|
||||
'uncorrectable': ecc_count}
|
||||
values_dict['ecc_block'] = ecc_dict
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
values_dict['ecc'] = e.get_error_info()
|
||||
values_dict['ecc_block'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
|
||||
@@ -936,7 +937,7 @@ class AMDSMICommands():
|
||||
|
||||
if args.voltage:
|
||||
try:
|
||||
volt_metric = amdsmi_interface.amdsmi_dev_get_volt_metric(
|
||||
volt_metric = amdsmi_interface.amdsmi_get_gpu_volt_metric(
|
||||
args.gpu, amdsmi_interface.AmdSmiVoltageType.VDDGFX, amdsmi_interface.AmdSmiVoltageMetric.CURRENT)
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
@@ -950,14 +951,14 @@ class AMDSMICommands():
|
||||
raise e
|
||||
if args.fan:
|
||||
try:
|
||||
fan_speed = amdsmi_interface.amdsmi_dev_get_fan_speed(args.gpu, 0)
|
||||
fan_speed = amdsmi_interface.amdsmi_get_gpu_fan_speed(args.gpu, 0)
|
||||
fan_speed_error = False
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
fan_speed = e.get_error_info()
|
||||
fan_speed_error = True
|
||||
|
||||
try:
|
||||
fan_max = amdsmi_interface.amdsmi_dev_get_fan_speed_max(args.gpu, 0)
|
||||
fan_max = amdsmi_interface.amdsmi_get_gpu_fan_speed_max(args.gpu, 0)
|
||||
if not fan_speed_error and fan_max > 0:
|
||||
fan_percent = round((float(fan_speed) / float(fan_max)) * 100, 2)
|
||||
if self.logger.is_human_readable_format():
|
||||
@@ -970,7 +971,7 @@ class AMDSMICommands():
|
||||
fan_percent = 'Unable to detect fan speed'
|
||||
|
||||
try:
|
||||
fan_rpm = amdsmi_interface.amdsmi_dev_get_fan_rpms(args.gpu, 0)
|
||||
fan_rpm = amdsmi_interface.amdsmi_get_gpu_fan_rpms(args.gpu, 0)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
fan_rpm = e.get_error_info()
|
||||
|
||||
@@ -980,7 +981,7 @@ class AMDSMICommands():
|
||||
'usage' : fan_percent}
|
||||
if args.voltage_curve:
|
||||
try:
|
||||
od_volt = amdsmi_interface.amdsmi_dev_get_od_volt_info(args.gpu)
|
||||
od_volt = amdsmi_interface.amdsmi_get_gpu_od_volt_info(args.gpu)
|
||||
|
||||
voltage_point_dict = {}
|
||||
|
||||
@@ -991,7 +992,7 @@ class AMDSMICommands():
|
||||
else:
|
||||
frequency = 0
|
||||
voltage = 0
|
||||
voltage_point_dict[f'voltage_point_{point}'] = f"{frequency}Mhz {voltage}mV"
|
||||
voltage_point_dict[f'voltage_point_{point}'] = f"{frequency} Mhz {voltage} mV"
|
||||
|
||||
values_dict['voltage_curve'] = voltage_point_dict
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
@@ -1000,7 +1001,7 @@ class AMDSMICommands():
|
||||
raise e
|
||||
if args.overdrive:
|
||||
try:
|
||||
overdrive_level = amdsmi_interface.amdsmi_dev_get_overdrive_level(args.gpu)
|
||||
overdrive_level = amdsmi_interface.amdsmi_get_gpu_overdrive_level(args.gpu)
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
unit = '%'
|
||||
@@ -1015,7 +1016,7 @@ class AMDSMICommands():
|
||||
values_dict['mem_overdrive'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info
|
||||
if args.perf_level:
|
||||
try:
|
||||
perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu)
|
||||
perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu)
|
||||
values_dict['perf_level'] = perf_level
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
values_dict['perf_level'] = e.get_error_info()
|
||||
@@ -1023,40 +1024,29 @@ class AMDSMICommands():
|
||||
raise e
|
||||
if args.replay_count:
|
||||
try:
|
||||
pci_replay_counter = amdsmi_interface.amdsmi_dev_get_pci_replay_counter(args.gpu)
|
||||
pci_replay_counter = amdsmi_interface.amdsmi_get_gpu_pci_replay_counter(args.gpu)
|
||||
values_dict['replay_count'] = pci_replay_counter
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
values_dict['replay_count'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if args.xgmi_err:
|
||||
try:
|
||||
values_dict['xgmi_err'] = amdsmi_interface.amdsmi_dev_xgmi_error_status(args.gpu)
|
||||
values_dict['xgmi_err'] = amdsmi_interface.amdsmi_gpu_xgmi_error_status(args.gpu)
|
||||
except amdsmi_interface.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED:
|
||||
values_dict['xgmi_err'] = 'N/A'
|
||||
elif not self.all_arguments:
|
||||
raise e
|
||||
if args.energy:
|
||||
try:
|
||||
energy = amdsmi_interface.amdsmi_get_power_measure(args.gpu)['energy_accumulator']
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
unit = 'J'
|
||||
energy = f"{energy} {unit}"
|
||||
|
||||
values_dict['energy'] = energy
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
values_dict['energy'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
pass
|
||||
if args.mem_usage:
|
||||
memory_total = {}
|
||||
try:
|
||||
memory_total_vram = amdsmi_interface.amdsmi_dev_get_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.VRAM)
|
||||
memory_total_vis_vram = amdsmi_interface.amdsmi_dev_get_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.VIS_VRAM)
|
||||
memory_total_gtt = amdsmi_interface.amdsmi_dev_get_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.GTT)
|
||||
memory_total_vram = amdsmi_interface.amdsmi_get_gpu_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.VRAM)
|
||||
memory_total_vis_vram = amdsmi_interface.amdsmi_get_gpu_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.VIS_VRAM)
|
||||
memory_total_gtt = amdsmi_interface.amdsmi_get_gpu_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.GTT)
|
||||
|
||||
# Convert mem_usage to megabytes
|
||||
memory_total['vram'] = memory_total_vram // (1024*1024)
|
||||
@@ -1078,9 +1068,9 @@ class AMDSMICommands():
|
||||
raise e
|
||||
|
||||
try:
|
||||
total_used_vram = amdsmi_interface.amdsmi_dev_get_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.VRAM)
|
||||
total_used_vis_vram = amdsmi_interface.amdsmi_dev_get_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.VIS_VRAM)
|
||||
total_used_gtt = amdsmi_interface.amdsmi_dev_get_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.GTT)
|
||||
total_used_vram = amdsmi_interface.amdsmi_get_gpu_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.VRAM)
|
||||
total_used_vis_vram = amdsmi_interface.amdsmi_get_gpu_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.VIS_VRAM)
|
||||
total_used_gtt = amdsmi_interface.amdsmi_get_gpu_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.GTT)
|
||||
|
||||
# Convert mem_usage to megabytes
|
||||
memory_total['used_vram'] = total_used_vram // (1024*1024)
|
||||
@@ -1200,14 +1190,14 @@ class AMDSMICommands():
|
||||
|
||||
# Populate initial processes
|
||||
try:
|
||||
process_list = amdsmi_interface.amdsmi_get_process_list(args.gpu)
|
||||
process_list = amdsmi_interface.amdsmi_get_gpu_process_list(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
raise e
|
||||
|
||||
filtered_process_values = []
|
||||
for process_handle in process_list:
|
||||
try:
|
||||
process_info = amdsmi_interface.amdsmi_get_process_info(args.gpu, process_handle)
|
||||
process_info = amdsmi_interface.amdsmi_get_gpu_process_info(args.gpu, process_handle)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
process_info = e.get_error_info()
|
||||
filtered_process_values.append({'process_info': process_info})
|
||||
@@ -1216,24 +1206,15 @@ class AMDSMICommands():
|
||||
process_info['mem_usage'] = process_info.pop('mem')
|
||||
process_info['usage'] = process_info.pop('engine_usage')
|
||||
|
||||
# Convert mem_usage to megabytes
|
||||
|
||||
mem_usage_mb = (process_info['mem_usage']//1024) // 1024
|
||||
if mem_usage_mb < 0:
|
||||
process_info['mem_usage'] = process_info['mem_usage']//1024
|
||||
mem_usage_unit = 'B'
|
||||
else:
|
||||
process_info['mem_usage'] = mem_usage_mb
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
mem_usage_unit = 'MB'
|
||||
engine_usage_unit = '%'
|
||||
process_info['mem_usage'] = f"{process_info['mem_usage']} {mem_usage_unit}"
|
||||
process_info['mem_usage'] = self.helpers.convert_bytes_to_readable(process_info['mem_usage'])
|
||||
|
||||
engine_usage_unit = "ns"
|
||||
for usage_metric in process_info['usage']:
|
||||
process_info['usage'][usage_metric] = f"{process_info['usage'][usage_metric]} {engine_usage_unit}"
|
||||
|
||||
for usage_metric in process_info['memory_usage']:
|
||||
process_info['memory_usage'][usage_metric] = f"{process_info['memory_usage'][usage_metric]} {engine_usage_unit}"
|
||||
process_info['memory_usage'][usage_metric] = self.helpers.convert_bytes_to_readable(process_info['memory_usage'][usage_metric])
|
||||
|
||||
filtered_process_values.append({'process_info': process_info})
|
||||
|
||||
@@ -1576,7 +1557,7 @@ class AMDSMICommands():
|
||||
|
||||
# Build GPU string for errors
|
||||
try:
|
||||
gpu_bdf = amdsmi_interface.amdsmi_get_device_bdf(args.gpu)
|
||||
gpu_bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException:
|
||||
gpu_bdf = f'BDF Unavailable for {args.gpu}'
|
||||
try:
|
||||
@@ -1591,7 +1572,7 @@ class AMDSMICommands():
|
||||
|
||||
# Check if the performance level is manual, if not then set it to manual
|
||||
try:
|
||||
perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu)
|
||||
perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1599,7 +1580,7 @@ class AMDSMICommands():
|
||||
|
||||
if 'manual' in perf_level.lower():
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1607,14 +1588,14 @@ class AMDSMICommands():
|
||||
|
||||
if clock_type != amdsmi_interface.AmdSmiClkType.PCIE:
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_clk_freq(args.gpu, clock_type, freq_bitmask)
|
||||
amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
raise ValueError(f"Unable to set the {clock_type} clock frequency on {gpu_string}") from e
|
||||
else:
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_pci_bandwidth(args.gpu, freq_bitmask)
|
||||
amdsmi_interface.amdsmi_set_gpu_pci_bandwidth(args.gpu, freq_bitmask)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1626,7 +1607,7 @@ class AMDSMICommands():
|
||||
clock_type = amdsmi_interface.AmdSmiClkType.SYS
|
||||
# Check if the performance level is manual, if not then set it to manual
|
||||
try:
|
||||
perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu)
|
||||
perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1634,14 +1615,14 @@ class AMDSMICommands():
|
||||
|
||||
if 'manual' in perf_level.lower():
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e
|
||||
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_clk_freq(args.gpu, clock_type, freq_bitmask)
|
||||
amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1653,7 +1634,7 @@ class AMDSMICommands():
|
||||
clock_type = amdsmi_interface.AmdSmiClkType.MEM
|
||||
# Check if the performance level is manual, if not then set it to manual
|
||||
try:
|
||||
perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu)
|
||||
perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1661,14 +1642,14 @@ class AMDSMICommands():
|
||||
|
||||
if 'manual' in perf_level.lower():
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e
|
||||
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_clk_freq(args.gpu, clock_type, freq_bitmask)
|
||||
amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1680,7 +1661,7 @@ class AMDSMICommands():
|
||||
clock_type = amdsmi_interface.AmdSmiClkType.PCIE
|
||||
# Check if the performance level is manual, if not then set it to manual
|
||||
try:
|
||||
perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu)
|
||||
perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1688,13 +1669,13 @@ class AMDSMICommands():
|
||||
|
||||
if 'manual' in perf_level.lower():
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_pci_bandwidth(args.gpu, freq_bitmask)
|
||||
amdsmi_interface.amdsmi_set_gpu_pci_bandwidth(args.gpu, freq_bitmask)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1707,7 +1688,7 @@ class AMDSMICommands():
|
||||
level = amdsmi_interface.AmdSmiFreqInd(level)
|
||||
clock_type = amdsmi_interface.AmdSmiClkType.SYS
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_od_clk_info(args.gpu, level, value, clock_type)
|
||||
amdsmi_interface.amdsmi_set_gpu_od_clk_info(args.gpu, level, value, clock_type)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1719,7 +1700,7 @@ class AMDSMICommands():
|
||||
level = amdsmi_interface.AmdSmiFreqInd(level)
|
||||
clock_type = amdsmi_interface.AmdSmiClkType.MEM
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_od_clk_info(args.gpu, level, value, clock_type)
|
||||
amdsmi_interface.amdsmi_set_gpu_od_clk_info(args.gpu, level, value, clock_type)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1729,7 +1710,7 @@ class AMDSMICommands():
|
||||
if isinstance(args.vc, int):
|
||||
point, clk, volt = args.vc
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_od_volt_info(args.gpu, point, clk, volt)
|
||||
amdsmi_interface.amdsmi_set_gpu_od_volt_info(args.gpu, point, clk, volt)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1740,7 +1721,7 @@ class AMDSMICommands():
|
||||
min_value, max_value = args.srange
|
||||
clock_type = amdsmi_interface.AmdSmiClkType.SYS
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_clk_range(args.gpu, min_value, max_value, clock_type)
|
||||
amdsmi_interface.amdsmi_set_gpu_clk_range(args.gpu, min_value, max_value, clock_type)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1751,7 +1732,7 @@ class AMDSMICommands():
|
||||
min_value, max_value = args.srange
|
||||
clock_type = amdsmi_interface.AmdSmiClkType.MEM
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_clk_range(args.gpu, min_value, max_value, clock_type)
|
||||
amdsmi_interface.amdsmi_set_gpu_clk_range(args.gpu, min_value, max_value, clock_type)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1760,7 +1741,7 @@ class AMDSMICommands():
|
||||
self.logger.store_output(args.gpu, 'mrange', f"Successfully set {clock_type} from {min_value}(MHz) to {max_value}(MHz)")
|
||||
if isinstance(args.fan, int):
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_fan_speed(args.gpu, 0, args.fan)
|
||||
amdsmi_interface.amdsmi_set_gpu_fan_speed(args.gpu, 0, args.fan)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1770,7 +1751,7 @@ class AMDSMICommands():
|
||||
if args.perflevel:
|
||||
perf_level = amdsmi_interface.AmdSmiDevPerfLevel[args.perflevel]
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, perf_level)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, perf_level)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1780,7 +1761,7 @@ class AMDSMICommands():
|
||||
if isinstance(args.overdrive, int):
|
||||
# Check if the performance level is manual, if not then set it to manual
|
||||
try:
|
||||
perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu)
|
||||
perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1788,14 +1769,14 @@ class AMDSMICommands():
|
||||
|
||||
if 'manual' in perf_level.lower():
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e
|
||||
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_overdrive_level_v1(args.gpu, args.overdrive)
|
||||
amdsmi_interface.amdsmi_set_gpu_overdrive_level_v1(args.gpu, args.overdrive)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1805,7 +1786,7 @@ class AMDSMICommands():
|
||||
if isinstance(args.memoverdrive, int):
|
||||
# Check if the performance level is manual, if not then set it to manual
|
||||
try:
|
||||
perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu)
|
||||
perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1813,7 +1794,7 @@ class AMDSMICommands():
|
||||
|
||||
if 'manual' in perf_level.lower():
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1843,7 +1824,7 @@ class AMDSMICommands():
|
||||
raise ValueError(f"Requested power cap: {overdrive_power_cap} is the same as the current power cap: {power_caps['power_cap']}")
|
||||
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_power_cap(args.gpu, 0, overdrive_power_cap)
|
||||
amdsmi_interface.amdsmi_set_power_cap(args.gpu, 0, overdrive_power_cap)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1864,7 +1845,7 @@ class AMDSMICommands():
|
||||
self.logger.store_output(args.gpu, 'profile', "Not Yet Implemented")
|
||||
if isinstance(args.perfdeterminism, int):
|
||||
try:
|
||||
amdsmi_interface.amdsmi_set_perf_determinism_mode(args.gpu, args.perfdeterminism)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_determinism_mode(args.gpu, args.perfdeterminism)
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
raise PermissionError('Command requires elevation') from e
|
||||
@@ -1935,7 +1916,7 @@ class AMDSMICommands():
|
||||
if args.gpureset:
|
||||
if self.helpers.is_amd_device(args.gpu):
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_reset_gpu(args.gpu)
|
||||
amdsmi_interface.amdsmi_reset_gpu(args.gpu)
|
||||
result = 'Successfully reset GPU'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
@@ -1950,7 +1931,7 @@ class AMDSMICommands():
|
||||
'clocks' : '',
|
||||
'performance': ''}
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_set_overdrive_level_v1(args.gpu, 0)
|
||||
amdsmi_interface.amdsmi_set_gpu_overdrive_level_v1(args.gpu, 0)
|
||||
reset_clocks_results['overdrive'] = 'Overdrive set to 0'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
@@ -1959,7 +1940,7 @@ class AMDSMICommands():
|
||||
|
||||
try:
|
||||
level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, level_auto)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto)
|
||||
reset_clocks_results['clocks'] = 'Successfully reset clocks'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
@@ -1968,7 +1949,7 @@ class AMDSMICommands():
|
||||
|
||||
try:
|
||||
level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, level_auto)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto)
|
||||
reset_clocks_results['performance'] = 'Performance level reset to auto'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
@@ -1978,7 +1959,7 @@ class AMDSMICommands():
|
||||
self.logger.store_output(args.gpu, 'reset_clocks', reset_clocks_results)
|
||||
if args.fans:
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_reset_fan(args.gpu, 0)
|
||||
amdsmi_interface.amdsmi_reset_gpu_fan(args.gpu, 0)
|
||||
result = 'Successfully reset fan speed to driver control'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
@@ -1991,7 +1972,7 @@ class AMDSMICommands():
|
||||
'performance_level': ''}
|
||||
try:
|
||||
power_profile_mask = amdsmi_interface.AmdSmiPowerProfilePresetMasks.BOOTUP_DEFAULT
|
||||
amdsmi_interface.amdsmi_dev_set_power_profile(args.gpu, 0, power_profile_mask)
|
||||
amdsmi_interface.amdsmi_set_gpu_power_profile(args.gpu, 0, power_profile_mask)
|
||||
reset_profile_results['power_profile'] = 'Successfully reset Power Profile'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
@@ -2000,7 +1981,7 @@ class AMDSMICommands():
|
||||
|
||||
try:
|
||||
level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, level_auto)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto)
|
||||
reset_profile_results['performance_level'] = 'Successfully reset Performance Level'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
@@ -2010,7 +1991,7 @@ class AMDSMICommands():
|
||||
self.logger.store_output(args.gpu, 'reset_profile', reset_profile_results)
|
||||
if args.xgmierr:
|
||||
try:
|
||||
amdsmi_interface.amdsmi_dev_reset_xgmi_error(args.gpu)
|
||||
amdsmi_interface.amdsmi_reset_gpu_xgmi_error(args.gpu)
|
||||
result = 'Successfully reset XGMI Error count'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
@@ -2020,7 +2001,7 @@ class AMDSMICommands():
|
||||
if args.perfdeterminism:
|
||||
try:
|
||||
level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO
|
||||
amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, level_auto)
|
||||
amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto)
|
||||
result = 'Successfully disabled performance determinism'
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM:
|
||||
|
||||
@@ -61,6 +61,7 @@ class AMDSMIHelpers():
|
||||
else:
|
||||
self._is_virtual_os = True
|
||||
|
||||
|
||||
def os_info(self, string_format=True):
|
||||
"""Return operating_system and type information ex. (Linux, Baremetal)
|
||||
params:
|
||||
@@ -141,11 +142,11 @@ class AMDSMIHelpers():
|
||||
gpu_choices = {}
|
||||
gpu_choices_str = ""
|
||||
|
||||
# amdsmi_get_device_handles returns the device_handles storted by gpu_id
|
||||
device_handles = amdsmi_interface.amdsmi_get_device_handles()
|
||||
# amdsmi_get_processor_handles returns the device_handles storted for gpu_id
|
||||
device_handles = amdsmi_interface.amdsmi_get_processor_handles()
|
||||
for gpu_id, device_handle in enumerate(device_handles):
|
||||
bdf = amdsmi_interface.amdsmi_get_device_bdf(device_handle)
|
||||
uuid = amdsmi_interface.amdsmi_get_device_uuid(device_handle)
|
||||
bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(device_handle)
|
||||
uuid = amdsmi_interface.amdsmi_get_gpu_device_uuid(device_handle)
|
||||
gpu_choices[str(gpu_id)] = {
|
||||
"BDF": bdf,
|
||||
"UUID": uuid,
|
||||
@@ -285,9 +286,9 @@ class AMDSMIHelpers():
|
||||
|
||||
def get_gpu_id_from_device_handle(self, input_device_handle):
|
||||
"""Get the gpu index from the device_handle.
|
||||
amdsmi_get_device_handles() returns the list of device_handles in order of gpu_index
|
||||
amdsmi_get_processor_handles() returns the list of device_handles in order of gpu_index
|
||||
"""
|
||||
device_handles = amdsmi_interface.amdsmi_get_device_handles()
|
||||
device_handles = amdsmi_interface.amdsmi_get_processor_handles()
|
||||
for gpu_index, device_handle in enumerate(device_handles):
|
||||
if input_device_handle.value == device_handle.value:
|
||||
return gpu_index
|
||||
@@ -301,10 +302,10 @@ class AMDSMIHelpers():
|
||||
list[BDF]: List of GPU BDFs
|
||||
"""
|
||||
gpu_bdfs = []
|
||||
device_handles = amdsmi_interface.amdsmi_get_device_handles()
|
||||
device_handles = amdsmi_interface.amdsmi_get_processor_handles()
|
||||
|
||||
for device_handle in device_handles:
|
||||
bdf = amdsmi_interface.amdsmi_get_device_bdf(device_handle)
|
||||
bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(device_handle)
|
||||
gpu_bdfs.append(bdf)
|
||||
|
||||
return gpu_bdfs
|
||||
@@ -316,7 +317,7 @@ class AMDSMIHelpers():
|
||||
param device: DRM device identifier
|
||||
"""
|
||||
# Get card vendor id
|
||||
asic_info = amdsmi_interface.amdsmi_get_asic_info(device_handle)
|
||||
asic_info = amdsmi_interface.amdsmi_get_gpu_asic_info(device_handle)
|
||||
return asic_info['vendor_id'] == AMD_VENDOR_ID
|
||||
|
||||
|
||||
@@ -396,3 +397,11 @@ class AMDSMIHelpers():
|
||||
return False
|
||||
except amdsmi_exception.AmdSmiLibraryException:
|
||||
return False
|
||||
|
||||
|
||||
def convert_bytes_to_readable(self, bytes_input):
|
||||
for unit in ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"]:
|
||||
if abs(bytes_input) < 1024:
|
||||
return f"{bytes_input:3.1f} {unit}"
|
||||
bytes_input /= 1024
|
||||
return f"{bytes_input:.1f} YB"
|
||||
|
||||
@@ -29,7 +29,8 @@ import sys
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.append(f'{Path(__file__).resolve().parent}/../../share/amd_smi')
|
||||
sys.path.append(f"{Path(__file__).resolve().parent}/../../share/amd_smi")
|
||||
sys.path.append("/opt/rocm/share/amd_smi")
|
||||
|
||||
from amdsmi import amdsmi_interface
|
||||
from amdsmi import amdsmi_exception
|
||||
|
||||
@@ -48,6 +48,7 @@ class AMDSMILogger():
|
||||
csv = 'csv'
|
||||
human_readable = 'human_readable'
|
||||
|
||||
|
||||
class LoggerCompatibility(Enum):
|
||||
"""Enum for logger compatibility"""
|
||||
amdsmi = 'amdsmi'
|
||||
@@ -55,6 +56,17 @@ class AMDSMILogger():
|
||||
gpuvsmi = 'gpuvsmi'
|
||||
|
||||
|
||||
class CsvStdoutBuilder(object):
|
||||
def __init__(self):
|
||||
self.csv_string = []
|
||||
|
||||
def write(self, row):
|
||||
self.csv_string.append(row)
|
||||
|
||||
def __str__(self):
|
||||
return ''.join(self.csv_string)
|
||||
|
||||
|
||||
def is_json_format(self):
|
||||
return self.format == self.LoggerFormat.json.value
|
||||
|
||||
@@ -79,17 +91,6 @@ class AMDSMILogger():
|
||||
return self.compatibility == self.LoggerCompatibility.gpuvsmi.value
|
||||
|
||||
|
||||
class CsvStdoutBuilder(object):
|
||||
def __init__(self):
|
||||
self.csv_string = []
|
||||
|
||||
def write(self, row):
|
||||
self.csv_string.append(row)
|
||||
|
||||
def __str__(self):
|
||||
return ''.join(self.csv_string)
|
||||
|
||||
|
||||
def _capitalize_keys(self, input_dict):
|
||||
output_dict = {}
|
||||
for key in input_dict.keys():
|
||||
@@ -239,7 +240,6 @@ class AMDSMILogger():
|
||||
else:
|
||||
self.output[argument] = data
|
||||
elif self.is_csv_format():
|
||||
# New way is in gpuvsmi func
|
||||
self.output['gpu'] = int(gpu_id)
|
||||
|
||||
if argument == 'values' or isinstance(data, dict):
|
||||
@@ -416,6 +416,7 @@ class AMDSMILogger():
|
||||
human_readable_output = ''
|
||||
for output in self.multiple_device_output:
|
||||
human_readable_output += self._convert_json_to_human_readable(output)
|
||||
human_readable_output += '\n'
|
||||
else:
|
||||
human_readable_output = self._convert_json_to_human_readable(self.output)
|
||||
|
||||
@@ -432,7 +433,7 @@ class AMDSMILogger():
|
||||
human_readable_output = ''
|
||||
for output in self.watch_output:
|
||||
human_readable_output += self._convert_json_to_human_readable(output)
|
||||
output_file.write(human_readable_output)
|
||||
output_file.write(human_readable_output + '\n')
|
||||
else:
|
||||
with self.destination.open('a') as output_file:
|
||||
output_file.write(human_readable_output)
|
||||
output_file.write(human_readable_output + '\n')
|
||||
|
||||
@@ -415,6 +415,7 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
clock_help = "Average, max, and current clock frequencies"
|
||||
temperature_help = "Current temperatures"
|
||||
ecc_help = "Number of ECC errors"
|
||||
ecc_block_help = "Number of ECC errors per block"
|
||||
pcie_help = "Current PCIe speed and width"
|
||||
voltage_help = "Current GPU voltages"
|
||||
|
||||
@@ -459,6 +460,8 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
metric_parser.add_argument('-c', '--clock', action='store_true', required=False, help=clock_help)
|
||||
metric_parser.add_argument('-t', '--temperature', action='store_true', required=False, help=temperature_help)
|
||||
metric_parser.add_argument('-e', '--ecc', action='store_true', required=False, help=ecc_help)
|
||||
metric_parser.add_argument('-k', '--ecc-block', action='store_true', required=False, help=ecc_block_help)
|
||||
|
||||
metric_parser.add_argument('-P', '--pcie', action='store_true', required=False, help=pcie_help)
|
||||
metric_parser.add_argument('-V', '--voltage', action='store_true', required=False, help=voltage_help)
|
||||
metric_parser.add_argument('-u', '--usage', action='store_true', required=False, help=usage_help)
|
||||
|
||||
@@ -244,49 +244,48 @@ int main() {
|
||||
|
||||
// Get the device count available for the socket.
|
||||
uint32_t device_count = 0;
|
||||
ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr);
|
||||
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// Allocate the memory for the device handlers on the socket
|
||||
std::vector<amdsmi_device_handle> device_handles(device_count);
|
||||
std::vector<amdsmi_processor_handle> processor_handles(device_count);
|
||||
// Get all devices of the socket
|
||||
ret = amdsmi_get_device_handles(sockets[i],
|
||||
&device_count, &device_handles[0]);
|
||||
ret = amdsmi_get_processor_handles(sockets[i],
|
||||
&device_count, &processor_handles[0]);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// For each device of the socket, get name and temperature.
|
||||
for (uint32_t j = 0; j < device_count; j++) {
|
||||
// Get device type. Since the amdsmi is initialized with
|
||||
// AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU.
|
||||
device_type_t device_type = {};
|
||||
ret = amdsmi_get_device_type(device_handles[j], &device_type);
|
||||
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU.
|
||||
processor_type_t processor_type = {};
|
||||
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (device_type != AMD_GPU) {
|
||||
if (processor_type != AMD_GPU) {
|
||||
std::cout << "Expect AMD_GPU device type!\n";
|
||||
return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// Get BDF info
|
||||
amdsmi_bdf_t bdf = {};
|
||||
ret = amdsmi_get_device_bdf(device_handles[j], &bdf);
|
||||
ret = amdsmi_get_gpu_device_bdf(processor_handles[j], &bdf);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_device_bdf:\n");
|
||||
printf(" Output of amdsmi_get_gpu_device_bdf:\n");
|
||||
printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i,
|
||||
bdf.domain_number, bdf.bus_number, bdf.device_number,
|
||||
bdf.function_number);
|
||||
|
||||
// Get handle from BDF
|
||||
amdsmi_device_handle dev_handle;
|
||||
ret = amdsmi_get_device_handle_from_bdf(bdf, &dev_handle);
|
||||
amdsmi_processor_handle dev_handle;
|
||||
ret = amdsmi_get_processor_handle_from_bdf(bdf, &dev_handle);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// Get ASIC info
|
||||
amdsmi_asic_info_t asic_info = {};
|
||||
ret = amdsmi_get_asic_info(device_handles[j], &asic_info);
|
||||
ret = amdsmi_get_gpu_asic_info(processor_handles[j], &asic_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_asic_info:\n");
|
||||
printf(" Output of amdsmi_get_gpu_asic_info:\n");
|
||||
printf("\tMarket Name: %s\n", asic_info.market_name);
|
||||
printf("\tFamilyID: 0x%x\n", asic_info.family);
|
||||
printf("\tDeviceID: 0x%lx\n", asic_info.device_id);
|
||||
printf("\tVendorID: 0x%x\n", asic_info.vendor_id);
|
||||
printf("\tRevisionID: 0x%x\n", asic_info.rev_id);
|
||||
@@ -294,61 +293,58 @@ int main() {
|
||||
|
||||
// Get VBIOS info
|
||||
amdsmi_vbios_info_t vbios_info = {};
|
||||
ret = amdsmi_get_vbios_info(device_handles[j], &vbios_info);
|
||||
ret = amdsmi_get_gpu_vbios_info(processor_handles[j], &vbios_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_vbios_info:\n");
|
||||
printf(" Output of amdsmi_get_gpu_vbios_info:\n");
|
||||
printf("\tVBios Name: %s\n", vbios_info.name);
|
||||
printf("\tBuild Date: %s\n", vbios_info.build_date);
|
||||
printf("\tPart Number: %s\n", vbios_info.part_number);
|
||||
printf("\tVBios Version: %d\n", vbios_info.vbios_version);
|
||||
printf("\tVBios Version String: %s\n\n",
|
||||
vbios_info.vbios_version_string);
|
||||
vbios_info.version);
|
||||
|
||||
// Get power measure
|
||||
amdsmi_power_measure_t power_measure = {};
|
||||
ret = amdsmi_get_power_measure(device_handles[j], &power_measure);
|
||||
amdsmi_power_info_t power_measure = {};
|
||||
ret = amdsmi_get_power_info(processor_handles[j], &power_measure);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_power_measure:\n");
|
||||
printf(" Output of amdsmi_get_power_info:\n");
|
||||
printf("\tCurrent GFX Voltage: %d\n",
|
||||
power_measure.voltage_gfx);
|
||||
power_measure.gfx_voltage);
|
||||
printf("\tAverage socket power: %d\n",
|
||||
power_measure.average_socket_power);
|
||||
printf("\tEnergy accumulator: %ld\n\n",
|
||||
power_measure.energy_accumulator);
|
||||
printf("\tGPU Power limit: %d\n\n", power_measure.power_limit);
|
||||
|
||||
// Get driver version
|
||||
char version[AMDSMI_MAX_DRIVER_VERSION_LENGTH];
|
||||
int version_length = AMDSMI_MAX_DRIVER_VERSION_LENGTH;
|
||||
ret = amdsmi_get_driver_version(device_handles[j], &version_length, version);
|
||||
ret = amdsmi_get_gpu_driver_version(processor_handles[j], &version_length, version);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_driver_version:\n");
|
||||
printf(" Output of amdsmi_get_gpu_driver_version:\n");
|
||||
printf("\tDriver version: %s\n\n", version);
|
||||
|
||||
// Get device uuid
|
||||
unsigned int uuid_length = AMDSMI_GPU_UUID_SIZE;
|
||||
char uuid[AMDSMI_GPU_UUID_SIZE];
|
||||
ret = amdsmi_get_device_uuid(device_handles[j], &uuid_length, uuid);
|
||||
ret = amdsmi_get_gpu_device_uuid(processor_handles[j], &uuid_length, uuid);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_device_uuid:\n");
|
||||
printf(" Output of amdsmi_get_gpu_device_uuid:\n");
|
||||
printf("\tDevice uuid: %s\n\n", uuid);
|
||||
|
||||
// Get engine usage info
|
||||
amdsmi_engine_usage_t engine_usage = {};
|
||||
ret = amdsmi_get_gpu_activity(device_handles[j], &engine_usage);
|
||||
ret = amdsmi_get_gpu_activity(processor_handles[j], &engine_usage);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_gpu_activity:\n");
|
||||
printf("\tAverage GFX Activity: %d\n",
|
||||
engine_usage.gfx_activity);
|
||||
printf("\tAverage MM Activity: %d\n",
|
||||
engine_usage.mm_activity[0]);
|
||||
engine_usage.mm_activity);
|
||||
printf("\tAverage UMC Activity: %d\n\n",
|
||||
engine_usage.umc_activity);
|
||||
|
||||
// Get firmware info
|
||||
amdsmi_fw_info_t fw_information = {};
|
||||
char ucode_name[AMDSMI_MAX_STRING_LENGTH];
|
||||
ret = amdsmi_get_fw_info(device_handles[j], &fw_information);
|
||||
ret = amdsmi_get_fw_info(processor_handles[j], &fw_information);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_fw_info:\n");
|
||||
printf("Number of Microcodes: %d\n", fw_information.num_fw_info);
|
||||
@@ -358,27 +354,25 @@ int main() {
|
||||
}
|
||||
|
||||
// Get GFX clock measurements
|
||||
amdsmi_clk_measure_t gfx_clk_values = {};
|
||||
ret = amdsmi_get_clock_measure(device_handles[j], CLK_TYPE_GFX,
|
||||
amdsmi_clk_info_t gfx_clk_values = {};
|
||||
ret = amdsmi_get_clock_info(processor_handles[j], CLK_TYPE_GFX,
|
||||
&gfx_clk_values);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_clock_measure:\n");
|
||||
printf(" Output of amdsmi_get_clock_info:\n");
|
||||
printf("\tGPU GFX Max Clock: %d\n", gfx_clk_values.max_clk);
|
||||
printf("\tGPU GFX Average Clock: %d\n", gfx_clk_values.avg_clk);
|
||||
printf("\tGPU GFX Current Clock: %d\n", gfx_clk_values.cur_clk);
|
||||
|
||||
// Get MEM clock measurements
|
||||
amdsmi_clk_measure_t mem_clk_values = {};
|
||||
ret = amdsmi_get_clock_measure(device_handles[j], CLK_TYPE_MEM,
|
||||
amdsmi_clk_info_t mem_clk_values = {};
|
||||
ret = amdsmi_get_clock_info(processor_handles[j], CLK_TYPE_MEM,
|
||||
&mem_clk_values);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf("\tGPU MEM Max Clock: %d\n", mem_clk_values.max_clk);
|
||||
printf("\tGPU MEM Average Clock: %d\n", mem_clk_values.avg_clk);
|
||||
printf("\tGPU MEM Current Clock: %d\n\n", mem_clk_values.cur_clk);
|
||||
|
||||
// Get PCIe status
|
||||
amdsmi_pcie_info_t pcie_info = {};
|
||||
ret = amdsmi_get_pcie_link_status(device_handles[j], &pcie_info);
|
||||
ret = amdsmi_get_pcie_link_status(processor_handles[j], &pcie_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_pcie_link_status:\n");
|
||||
printf("\tPCIe lanes: %d\n", pcie_info.pcie_lanes);
|
||||
@@ -386,7 +380,7 @@ int main() {
|
||||
|
||||
// Get PCIe caps
|
||||
amdsmi_pcie_info_t pcie_caps_info = {};
|
||||
ret = amdsmi_get_pcie_link_caps(device_handles[j], &pcie_caps_info);
|
||||
ret = amdsmi_get_pcie_link_caps(processor_handles[j], &pcie_caps_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_pcie_link_caps:\n");
|
||||
printf("\tPCIe max lanes: %d\n", pcie_caps_info.pcie_lanes);
|
||||
@@ -394,16 +388,16 @@ int main() {
|
||||
|
||||
// Get VRAM temperature limit
|
||||
int64_t temperature = 0;
|
||||
ret = amdsmi_dev_get_temp_metric(
|
||||
device_handles[j], TEMPERATURE_TYPE_VRAM,
|
||||
ret = amdsmi_get_temp_metric(
|
||||
processor_handles[j], TEMPERATURE_TYPE_VRAM,
|
||||
AMDSMI_TEMP_CRITICAL, &temperature);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_dev_get_temp_metric:\n");
|
||||
printf(" Output of amdsmi_get_temp_metric:\n");
|
||||
printf("\tGPU VRAM temp limit: %ld\n", temperature);
|
||||
|
||||
// Get GFX temperature limit
|
||||
ret = amdsmi_dev_get_temp_metric(
|
||||
device_handles[j], TEMPERATURE_TYPE_EDGE,
|
||||
ret = amdsmi_get_temp_metric(
|
||||
processor_handles[j], TEMPERATURE_TYPE_EDGE,
|
||||
AMDSMI_TEMP_CRITICAL, &temperature);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf("\tGPU GFX temp limit: %ld\n\n", temperature);
|
||||
@@ -416,13 +410,13 @@ int main() {
|
||||
TEMPERATURE_TYPE_EDGE, TEMPERATURE_TYPE_JUNCTION,
|
||||
TEMPERATURE_TYPE_VRAM, TEMPERATURE_TYPE_PLX};
|
||||
for (const auto &temp_type : temp_types) {
|
||||
ret = amdsmi_dev_get_temp_metric(
|
||||
device_handles[j], temp_type,
|
||||
ret = amdsmi_get_temp_metric(
|
||||
processor_handles[j], temp_type,
|
||||
AMDSMI_TEMP_CURRENT,
|
||||
&temp_measurements[(int)(temp_type)]);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
}
|
||||
printf(" Output of amdsmi_dev_get_temp_metric:\n");
|
||||
printf(" Output of amdsmi_get_temp_metric:\n");
|
||||
printf("\tGPU Edge temp measurement: %ld\n",
|
||||
temp_measurements[TEMPERATURE_TYPE_EDGE]);
|
||||
printf("\tGPU Junction temp measurement: %ld\n",
|
||||
@@ -442,11 +436,11 @@ int main() {
|
||||
"ENABLED"};
|
||||
amdsmi_ras_err_state_t state = {};
|
||||
int index = 0;
|
||||
printf(" Output of amdsmi_get_ras_block_features_enabled:\n");
|
||||
printf(" Output of amdsmi_get_gpu_ras_block_features_enabled:\n");
|
||||
for (auto block = AMDSMI_GPU_BLOCK_FIRST;
|
||||
block <= AMDSMI_GPU_BLOCK_LAST;
|
||||
block = (amdsmi_gpu_block_t)(block * 2)) {
|
||||
ret = amdsmi_get_ras_block_features_enabled(device_handles[j], block,
|
||||
ret = amdsmi_get_gpu_ras_block_features_enabled(processor_handles[j], block,
|
||||
&state);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf("\tBlock: %s\n", block_names[index]);
|
||||
@@ -459,15 +453,15 @@ int main() {
|
||||
char bad_page_status_names[3][15] = {"RESERVED", "PENDING",
|
||||
"UNRESERVABLE"};
|
||||
uint32_t num_pages = 0;
|
||||
ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages,
|
||||
ret = amdsmi_get_gpu_bad_page_info(processor_handles[j], &num_pages,
|
||||
nullptr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_bad_page_info:\n");
|
||||
printf(" Output of amdsmi_get_gpu_bad_page_info:\n");
|
||||
if (!num_pages) {
|
||||
printf("\tNo bad pages found.\n");
|
||||
} else {
|
||||
std::vector<amdsmi_retired_page_record_t> bad_page_info(num_pages);
|
||||
ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages,
|
||||
ret = amdsmi_get_gpu_bad_page_info(processor_handles[j], &num_pages,
|
||||
bad_page_info.data());
|
||||
CHK_AMDSMI_RET(ret)
|
||||
for (uint32_t page_it = 0; page_it < num_pages; page_it += 1) {
|
||||
@@ -484,9 +478,9 @@ int main() {
|
||||
|
||||
// Get ECC error counts
|
||||
amdsmi_error_count_t err_cnt_info = {};
|
||||
ret = amdsmi_get_ecc_error_count(device_handles[j], &err_cnt_info);
|
||||
ret = amdsmi_get_gpu_ecc_error_count(processor_handles[j], &err_cnt_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_ecc_error_count:\n");
|
||||
printf(" Output of amdsmi_get_gpu_ecc_error_count:\n");
|
||||
printf("\tCorrectable errors: %lu\n", err_cnt_info.correctable_count);
|
||||
printf("\tUncorrectable errors: %lu\n\n",
|
||||
err_cnt_info.uncorrectable_count);
|
||||
@@ -500,10 +494,10 @@ int main() {
|
||||
|
||||
// Get frequency ranges
|
||||
amdsmi_frequency_range_t freq_ranges = {};
|
||||
ret = amdsmi_get_target_frequency_range(
|
||||
device_handles[j], CLK_TYPE_GFX, &freq_ranges);
|
||||
ret = amdsmi_get_gpu_target_frequency_range(
|
||||
processor_handles[j], CLK_TYPE_GFX, &freq_ranges);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_target_frequency_range:\n");
|
||||
printf(" Output of amdsmi_get_gpu_target_frequency_range:\n");
|
||||
printf("\tSupported min freq: %lu\n",
|
||||
freq_ranges.supported_freq_range.lower_bound);
|
||||
printf("\tSupported max freq: %lu\n",
|
||||
@@ -514,7 +508,7 @@ int main() {
|
||||
freq_ranges.current_freq_range.upper_bound);
|
||||
|
||||
uint32_t num_process = 0;
|
||||
ret = amdsmi_get_process_list(device_handles[j], nullptr,
|
||||
ret = amdsmi_get_gpu_process_list(processor_handles[j], nullptr,
|
||||
&num_process);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (!num_process) {
|
||||
@@ -524,22 +518,22 @@ int main() {
|
||||
amdsmi_proc_info_t info_list[num_process];
|
||||
amdsmi_proc_info_t process = {};
|
||||
uint64_t mem = 0, gtt_mem = 0, cpu_mem = 0, vram_mem = 0;
|
||||
uint64_t gfx = 0, comp = 0, dma = 0, enc = 0, dec = 0;
|
||||
uint64_t gfx = 0, enc = 0;
|
||||
char bdf_str[20];
|
||||
sprintf(bdf_str, "%04lx:%02x:%02x.%d", bdf.domain_number,
|
||||
bdf.bus_number, bdf.device_number, bdf.function_number);
|
||||
int num = 0;
|
||||
ret = amdsmi_get_process_list(device_handles[j], process_list,
|
||||
ret = amdsmi_get_gpu_process_list(processor_handles[j], process_list,
|
||||
&num_process);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
for (uint32_t it = 0; it < num_process; it += 1) {
|
||||
if (getpid() == process_list[it]) {
|
||||
continue;
|
||||
}
|
||||
ret = amdsmi_get_process_info(device_handles[j],
|
||||
ret = amdsmi_get_gpu_process_info(processor_handles[j],
|
||||
process_list[it], &process);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
printf("amdsmi_get_process_info() failed for "
|
||||
printf("amdsmi_get_gpu_process_info() failed for "
|
||||
"process_list[%d], returned %d\n",
|
||||
it, ret);
|
||||
continue;
|
||||
@@ -556,8 +550,8 @@ int main() {
|
||||
"engine usage (ns) |\n");
|
||||
printf("| | | | "
|
||||
"| | | | "
|
||||
" | gfx comp dma enc dec |\n");
|
||||
printf("+=======+==================+============+=============="
|
||||
" | gfx enc |\n");
|
||||
printf("+=======+"
|
||||
"+=============+=============+=============+============"
|
||||
"==+=========================================+\n");
|
||||
for (int it = 0; it < num; it++) {
|
||||
@@ -571,41 +565,30 @@ int main() {
|
||||
pwd = getpwuid(st.st_uid);
|
||||
if (!pwd)
|
||||
printf("| %5d | %16s | %10d | %s | %7ld KiB | %7ld KiB "
|
||||
"| %7ld KiB | %7ld KiB | %lu %lu %lu "
|
||||
"%lu %lu |\n",
|
||||
"| %7ld KiB | %7ld KiB | %lu %lu |\n",
|
||||
info_list[it].pid, info_list[it].name, st.st_uid,
|
||||
bdf_str, info_list[it].mem / 1024,
|
||||
info_list[it].memory_usage.gtt_mem / 1024,
|
||||
info_list[it].memory_usage.cpu_mem / 1024,
|
||||
info_list[it].memory_usage.vram_mem / 1024,
|
||||
info_list[it].engine_usage.gfx,
|
||||
info_list[it].engine_usage.compute,
|
||||
info_list[it].engine_usage.dma,
|
||||
info_list[it].engine_usage.enc,
|
||||
info_list[it].engine_usage.dec);
|
||||
info_list[it].engine_usage.enc);
|
||||
else
|
||||
printf("| %5d | %16s | %10s | %s | %7ld KiB | %7ld KiB "
|
||||
"| %7ld KiB | %7ld KiB | %lu %lu %lu "
|
||||
"%lu %lu |\n",
|
||||
"| %7ld KiB | %7ld KiB | %lu %lu |\n",
|
||||
info_list[it].pid, info_list[it].name,
|
||||
pwd->pw_name, bdf_str, info_list[it].mem / 1024,
|
||||
info_list[it].memory_usage.gtt_mem / 1024,
|
||||
info_list[it].memory_usage.cpu_mem / 1024,
|
||||
info_list[it].memory_usage.vram_mem / 1024,
|
||||
info_list[it].engine_usage.gfx,
|
||||
info_list[it].engine_usage.compute,
|
||||
info_list[it].engine_usage.dma,
|
||||
info_list[it].engine_usage.enc,
|
||||
info_list[it].engine_usage.dec);
|
||||
info_list[it].engine_usage.enc);
|
||||
mem += info_list[it].mem / 1024;
|
||||
gtt_mem += info_list[it].memory_usage.gtt_mem / 1024;
|
||||
cpu_mem += info_list[it].memory_usage.cpu_mem / 1024;
|
||||
vram_mem += info_list[it].memory_usage.vram_mem / 1024;
|
||||
gfx = info_list[it].engine_usage.gfx;
|
||||
comp = info_list[it].engine_usage.compute;
|
||||
dma = info_list[it].engine_usage.dma;
|
||||
enc = info_list[it].engine_usage.enc;
|
||||
dec = info_list[it].engine_usage.dec;
|
||||
printf(
|
||||
"+-------+------------------+------------+-------------"
|
||||
"-+-------------+-------------+-------------+----------"
|
||||
@@ -614,8 +597,8 @@ int main() {
|
||||
printf("| TOTAL:| %s | %7ld "
|
||||
"KiB | %7ld KiB | %7ld KiB | %7ld KiB | %lu %lu "
|
||||
"%lu %lu %lu |\n",
|
||||
bdf_str, mem, gtt_mem, cpu_mem, vram_mem, gfx, comp, dma,
|
||||
enc, dec);
|
||||
bdf_str, mem, gtt_mem, cpu_mem, vram_mem, gfx,
|
||||
enc);
|
||||
printf("+=======+==================+============+=============="
|
||||
"+=============+=============+=============+============"
|
||||
"=+==========================================+\n");
|
||||
@@ -623,9 +606,9 @@ int main() {
|
||||
|
||||
// Get device name
|
||||
amdsmi_board_info_t board_info = {};
|
||||
ret = amdsmi_get_board_info(device_handles[j], &board_info);
|
||||
ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_board_info:\n");
|
||||
printf(" Output of amdsmi_get_gpu_board_info:\n");
|
||||
std::cout << "\tdevice [" << j
|
||||
<< "]\n\t\tProduct name: " << board_info.product_name
|
||||
<< "\n"
|
||||
@@ -636,39 +619,23 @@ int main() {
|
||||
|
||||
// Get temperature
|
||||
int64_t val_i64 = 0;
|
||||
ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE,
|
||||
ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
|
||||
AMDSMI_TEMP_CURRENT, &val_i64);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_dev_get_temp_metric:\n");
|
||||
printf(" Output of amdsmi_get_temp_metric:\n");
|
||||
std::cout << "\t\tTemperature: " << val_i64 << "C"
|
||||
<< "\n\n";
|
||||
|
||||
// Get frame buffer
|
||||
amdsmi_vram_info_t vram_usage = {};
|
||||
ret = amdsmi_get_vram_usage(device_handles[j], &vram_usage);
|
||||
ret = amdsmi_get_gpu_vram_usage(processor_handles[j], &vram_usage);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_vram_usage:\n");
|
||||
printf(" Output of amdsmi_get_gpu_vram_usage:\n");
|
||||
std::cout << "\t\tFrame buffer usage (MB): " << vram_usage.vram_used
|
||||
<< "/" << vram_usage.vram_total << "\n\n";
|
||||
|
||||
// Get Cap info
|
||||
amdsmi_gpu_caps_t caps_info = {};
|
||||
ret = amdsmi_get_caps_info(device_handles[j], &caps_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_caps_info:\n");
|
||||
std::cout << "\t\tGFX IP Major: " << caps_info.gfx.gfxip_major
|
||||
<< "\n"
|
||||
<< "\t\tGFX IP Minor: " << caps_info.gfx.gfxip_minor
|
||||
<< "\n"
|
||||
<< "\t\tCU IP Count: " << caps_info.gfx.gfxip_cu_count
|
||||
<< "\n"
|
||||
<< "\t\tDMA IP Count: " << caps_info.dma_ip_count << "\n"
|
||||
<< "\t\tGFX IP Count: " << caps_info.gfx_ip_count << "\n"
|
||||
<< "\t\tMM IP Count: " << int(caps_info.mm.mm_ip_count)
|
||||
<< "\n\n";
|
||||
|
||||
amdsmi_power_cap_info_t cap_info = {};
|
||||
ret = amdsmi_get_power_cap_info(device_handles[j], 0, &cap_info);
|
||||
ret = amdsmi_get_power_cap_info(processor_handles[j], 0, &cap_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_power_cap_info:\n");
|
||||
std::cout << "\t\t Power Cap: " << cap_info.power_cap
|
||||
|
||||
@@ -96,42 +96,41 @@ int main() {
|
||||
|
||||
// Get the device count available for the socket.
|
||||
uint32_t device_count = 0;
|
||||
ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr);
|
||||
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// Allocate the memory for the device handlers on the socket
|
||||
std::vector<amdsmi_device_handle> device_handles(device_count);
|
||||
std::vector<amdsmi_processor_handle> processor_handles(device_count);
|
||||
// Get all devices of the socket
|
||||
ret = amdsmi_get_device_handles(sockets[i],
|
||||
&device_count, &device_handles[0]);
|
||||
ret = amdsmi_get_processor_handles(sockets[i],
|
||||
&device_count, &processor_handles[0]);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// For each device of the socket, get name and temperature.
|
||||
for (uint32_t j = 0; j < device_count; j++) {
|
||||
// Get device type. Since the amdsmi is initialized with
|
||||
// AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU.
|
||||
device_type_t device_type = {};
|
||||
ret = amdsmi_get_device_type(device_handles[j], &device_type);
|
||||
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU.
|
||||
processor_type_t processor_type = {};
|
||||
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
if (device_type != AMD_GPU) {
|
||||
if (processor_type != AMD_GPU) {
|
||||
std::cout << "Expect AMD_GPU device type!\n";
|
||||
return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
amdsmi_bdf_t bdf = {};
|
||||
ret = amdsmi_get_device_bdf(device_handles[j], &bdf);
|
||||
ret = amdsmi_get_gpu_device_bdf(processor_handles[j], &bdf);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_device_bdf:\n");
|
||||
printf(" Output of amdsmi_get_gpu_device_bdf:\n");
|
||||
printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i,
|
||||
bdf.domain_number, bdf.bus_number, bdf.device_number,
|
||||
bdf.function_number);
|
||||
|
||||
amdsmi_asic_info_t asic_info = {};
|
||||
ret = amdsmi_get_asic_info(device_handles[j], &asic_info);
|
||||
ret = amdsmi_get_gpu_asic_info(processor_handles[j], &asic_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_asic_info:\n");
|
||||
printf(" Output of amdsmi_get_gpu_asic_info:\n");
|
||||
printf("\tMarket Name: %s\n", asic_info.market_name);
|
||||
printf("\tFamilyID: 0x%x\n", asic_info.family);
|
||||
printf("\tDeviceID: 0x%lx\n", asic_info.device_id);
|
||||
printf("\tVendorID: 0x%x\n", asic_info.vendor_id);
|
||||
printf("\tRevisionID: 0x%x\n", asic_info.rev_id);
|
||||
@@ -139,31 +138,30 @@ int main() {
|
||||
|
||||
// Get VBIOS info
|
||||
amdsmi_vbios_info_t vbios_info = {};
|
||||
ret = amdsmi_get_vbios_info(device_handles[j], &vbios_info);
|
||||
ret = amdsmi_get_gpu_vbios_info(processor_handles[j], &vbios_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_vbios_info:\n");
|
||||
printf(" Output of amdsmi_get_gpu_vbios_info:\n");
|
||||
printf("\tVBios Name: %s\n", vbios_info.name);
|
||||
printf("\tBuild Date: %s\n", vbios_info.build_date);
|
||||
printf("\tPart Number: %s\n", vbios_info.part_number);
|
||||
printf("\tVBios Version: %d\n", vbios_info.vbios_version);
|
||||
printf("\tVBios Version String: %s\n\n",
|
||||
vbios_info.vbios_version_string);
|
||||
vbios_info.version);
|
||||
|
||||
// Get engine usage info
|
||||
amdsmi_engine_usage_t engine_usage = {};
|
||||
ret = amdsmi_get_gpu_activity(device_handles[j], &engine_usage);
|
||||
ret = amdsmi_get_gpu_activity(processor_handles[j], &engine_usage);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_gpu_activity:\n");
|
||||
printf("\tAverage GFX Activity: %d\n",
|
||||
engine_usage.gfx_activity);
|
||||
printf("\tAverage MM Activity: %d\n",
|
||||
engine_usage.mm_activity[0]);
|
||||
engine_usage.mm_activity);
|
||||
printf("\tAverage UMC Activity: %d\n\n",
|
||||
engine_usage.umc_activity);
|
||||
|
||||
// Get firmware info
|
||||
amdsmi_fw_info_t fw_information = {};
|
||||
ret = amdsmi_get_fw_info(device_handles[j], &fw_information);
|
||||
ret = amdsmi_get_fw_info(processor_handles[j], &fw_information);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_fw_info:\n");
|
||||
printf("\tFirmware version: %d\n", fw_information.num_fw_info);
|
||||
@@ -226,13 +224,13 @@ int main() {
|
||||
TEMPERATURE_TYPE_EDGE, TEMPERATURE_TYPE_JUNCTION,
|
||||
TEMPERATURE_TYPE_VRAM, TEMPERATURE_TYPE_PLX};
|
||||
for (const auto &temp_type : temp_types) {
|
||||
ret = amdsmi_dev_get_temp_metric(
|
||||
device_handles[j], temp_type,
|
||||
ret = amdsmi_get_temp_metric(
|
||||
processor_handles[j], temp_type,
|
||||
AMDSMI_TEMP_CURRENT,
|
||||
&temp_measurements[(int)(temp_type)]);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
}
|
||||
printf(" Output of amdsmi_dev_get_temp_metric:\n");
|
||||
printf(" Output of amdsmi_get_temp_metric:\n");
|
||||
printf("\tGPU Edge temp measurement: %ld\n",
|
||||
temp_measurements[TEMPERATURE_TYPE_EDGE]);
|
||||
printf("\tGPU Junction temp measurement: %ld\n",
|
||||
@@ -246,15 +244,15 @@ int main() {
|
||||
char bad_page_status_names[3][15] = {"RESERVED", "PENDING",
|
||||
"UNRESERVABLE"};
|
||||
uint32_t num_pages = 0;
|
||||
ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages,
|
||||
ret = amdsmi_get_gpu_bad_page_info(processor_handles[j], &num_pages,
|
||||
nullptr);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_bad_page_info:\n");
|
||||
printf(" Output of amdsmi_get_gpu_bad_page_info:\n");
|
||||
if (!num_pages) {
|
||||
printf("\tNo bad pages found.\n");
|
||||
} else {
|
||||
std::vector<amdsmi_retired_page_record_t> bad_page_info(num_pages);
|
||||
ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages,
|
||||
ret = amdsmi_get_gpu_bad_page_info(processor_handles[j], &num_pages,
|
||||
bad_page_info.data());
|
||||
CHK_AMDSMI_RET(ret)
|
||||
for (uint32_t page_it = 0; page_it < num_pages; page_it += 1) {
|
||||
@@ -271,9 +269,9 @@ int main() {
|
||||
|
||||
// Get ECC error counts
|
||||
amdsmi_error_count_t err_cnt_info = {};
|
||||
ret = amdsmi_get_ecc_error_count(device_handles[j], &err_cnt_info);
|
||||
ret = amdsmi_get_gpu_ecc_error_count(processor_handles[j], &err_cnt_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_ecc_error_count:\n");
|
||||
printf(" Output of amdsmi_get_gpu_ecc_error_count:\n");
|
||||
printf("\tCorrectable errors: %lu\n", err_cnt_info.correctable_count);
|
||||
printf("\tUncorrectable errors: %lu\n\n",
|
||||
err_cnt_info.uncorrectable_count);
|
||||
@@ -287,9 +285,9 @@ int main() {
|
||||
|
||||
// Get device name
|
||||
amdsmi_board_info_t board_info = {};
|
||||
ret = amdsmi_get_board_info(device_handles[j], &board_info);
|
||||
ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_board_info:\n");
|
||||
printf(" Output of amdsmi_get_gpu_board_info:\n");
|
||||
std::cout << "\tdevice [" << j
|
||||
<< "]\n\t\tProduct name: " << board_info.product_name
|
||||
<< "\n"
|
||||
@@ -300,39 +298,23 @@ int main() {
|
||||
|
||||
// Get temperature
|
||||
int64_t val_i64 = 0;
|
||||
ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE,
|
||||
ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
|
||||
AMDSMI_TEMP_CURRENT, &val_i64);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_dev_get_temp_metric:\n");
|
||||
printf(" Output of amdsmi_get_temp_metric:\n");
|
||||
std::cout << "\t\tTemperature: " << val_i64 << "C"
|
||||
<< "\n\n";
|
||||
|
||||
// Get frame buffer
|
||||
amdsmi_vram_info_t vram_usage = {};
|
||||
ret = amdsmi_get_vram_usage(device_handles[j], &vram_usage);
|
||||
ret = amdsmi_get_gpu_vram_usage(processor_handles[j], &vram_usage);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_vram_usage:\n");
|
||||
printf(" Output of amdsmi_get_gpu_vram_usage:\n");
|
||||
std::cout << "\t\tFrame buffer usage (MB): " << vram_usage.vram_used
|
||||
<< "/" << vram_usage.vram_total << "\n\n";
|
||||
|
||||
// Get Cap info
|
||||
amdsmi_gpu_caps_t caps_info = {};
|
||||
ret = amdsmi_get_caps_info(device_handles[j], &caps_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_caps_info:\n");
|
||||
std::cout << "\t\tGFX IP Major: " << caps_info.gfx.gfxip_major
|
||||
<< "\n"
|
||||
<< "\t\tGFX IP Minor: " << caps_info.gfx.gfxip_minor
|
||||
<< "\n"
|
||||
<< "\t\tCU IP Count: " << caps_info.gfx.gfxip_cu_count
|
||||
<< "\n"
|
||||
<< "\t\tDMA IP Count: " << caps_info.dma_ip_count << "\n"
|
||||
<< "\t\tGFX IP Count: " << caps_info.gfx_ip_count << "\n"
|
||||
<< "\t\tMM IP Count: " << int(caps_info.mm.mm_ip_count)
|
||||
<< "\n\n";
|
||||
|
||||
amdsmi_power_cap_info_t cap_info = {};
|
||||
ret = amdsmi_get_power_cap_info(device_handles[j], 0, &cap_info);
|
||||
ret = amdsmi_get_power_cap_info(processor_handles[j], 0, &cap_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_power_cap_info:\n");
|
||||
std::cout << "\t\t Power Cap: " << cap_info.power_cap / 1000000
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,20 +45,20 @@
|
||||
#define AMD_SMI_INCLUDE_IMPL_AMD_SMI_GPU_DEVICE_H_
|
||||
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_device.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_drm.h"
|
||||
#include "shared_mutex.h" // NOLINT
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
class AMDSmiGPUDevice: public AMDSmiDevice {
|
||||
class AMDSmiGPUDevice: public AMDSmiProcessor {
|
||||
public:
|
||||
AMDSmiGPUDevice(uint32_t gpu_id, uint32_t fd, std::string path, amdsmi_bdf_t bdf, AMDSmiDrm& drm):
|
||||
AMDSmiDevice(AMD_GPU), gpu_id_(gpu_id), fd_(fd), path_(path), bdf_(bdf), drm_(drm) {}
|
||||
AMDSmiProcessor(AMD_GPU), gpu_id_(gpu_id), fd_(fd), path_(path), bdf_(bdf), drm_(drm) {}
|
||||
|
||||
AMDSmiGPUDevice(uint32_t gpu_id, AMDSmiDrm& drm):
|
||||
AMDSmiDevice(AMD_GPU), gpu_id_(gpu_id), drm_(drm) {
|
||||
AMDSmiProcessor(AMD_GPU), gpu_id_(gpu_id), drm_(drm) {
|
||||
if (check_if_drm_is_supported()) this->get_drm_data();
|
||||
}
|
||||
~AMDSmiGPUDevice() {
|
||||
|
||||
+8
-8
@@ -41,25 +41,25 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
class AMDSmiDevice {
|
||||
class AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiDevice(device_type_t device) : device_type_(device) {}
|
||||
virtual ~AMDSmiDevice() {}
|
||||
device_type_t get_device_type() const { return device_type_;}
|
||||
explicit AMDSmiProcessor(processor_type_t processor) : processor_type_(processor) {}
|
||||
virtual ~AMDSmiProcessor() {}
|
||||
processor_type_t get_processor_type() const { return processor_type_;}
|
||||
private:
|
||||
device_type_t device_type_;
|
||||
processor_type_t processor_type_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_device.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
@@ -58,12 +58,12 @@ class AMDSmiSocket {
|
||||
explicit AMDSmiSocket(const std::string& id) : socket_identifier_(id) {}
|
||||
~AMDSmiSocket();
|
||||
const std::string& get_socket_id() const { return socket_identifier_;}
|
||||
void add_device(AMDSmiDevice* device) { devices_.push_back(device); }
|
||||
std::vector<AMDSmiDevice*>& get_devices() { return devices_;}
|
||||
amdsmi_status_t get_device_count(uint32_t* device_count) const;
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
private:
|
||||
std::string socket_identifier_;
|
||||
std::vector<AMDSmiDevice*> devices_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <set>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_socket.h"
|
||||
#include "amd_smi/impl/amd_smi_device.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_drm.h"
|
||||
|
||||
namespace amd {
|
||||
@@ -69,11 +69,11 @@ class AMDSmiSystem {
|
||||
amdsmi_status_t handle_to_socket(amdsmi_socket_handle socket_handle,
|
||||
AMDSmiSocket** socket);
|
||||
|
||||
amdsmi_status_t handle_to_device(amdsmi_device_handle device_handle,
|
||||
AMDSmiDevice** device);
|
||||
amdsmi_status_t handle_to_processor(amdsmi_processor_handle processor_handle,
|
||||
AMDSmiProcessor** device);
|
||||
|
||||
amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index,
|
||||
amdsmi_device_handle* device_handle);
|
||||
amdsmi_processor_handle* processor_handle);
|
||||
|
||||
private:
|
||||
AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {}
|
||||
@@ -82,7 +82,7 @@ class AMDSmiSystem {
|
||||
uint64_t init_flag_;
|
||||
AMDSmiDrm drm_;
|
||||
std::vector<AMDSmiSocket*> sockets_;
|
||||
std::set<AMDSmiDevice*> devices_; // Track valid devices
|
||||
std::set<AMDSmiProcessor*> processors_; // Track valid processors
|
||||
};
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,145 +24,143 @@ from .amdsmi_interface import amdsmi_init
|
||||
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_processor_type
|
||||
from .amdsmi_interface import amdsmi_get_processor_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
|
||||
from .amdsmi_interface import amdsmi_get_gpu_device_bdf
|
||||
from .amdsmi_interface import amdsmi_get_gpu_device_uuid
|
||||
from .amdsmi_interface import amdsmi_get_processor_handle_from_bdf
|
||||
|
||||
# # SW Version Information
|
||||
from .amdsmi_interface import amdsmi_get_driver_version
|
||||
from .amdsmi_interface import amdsmi_get_gpu_driver_version
|
||||
|
||||
# # ASIC and Bus Static Information
|
||||
from .amdsmi_interface import amdsmi_get_asic_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_caps_info
|
||||
|
||||
# # Microcode and VBIOS Information
|
||||
from .amdsmi_interface import amdsmi_get_vbios_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_vbios_info
|
||||
from .amdsmi_interface import amdsmi_get_fw_info
|
||||
|
||||
# # GPU Monitoring
|
||||
from .amdsmi_interface import amdsmi_get_gpu_activity
|
||||
from .amdsmi_interface import amdsmi_get_vram_usage
|
||||
from .amdsmi_interface import amdsmi_get_power_measure
|
||||
from .amdsmi_interface import amdsmi_get_clock_measure
|
||||
from .amdsmi_interface import amdsmi_get_gpu_vram_usage
|
||||
from .amdsmi_interface import amdsmi_get_power_info
|
||||
from .amdsmi_interface import amdsmi_get_clock_info
|
||||
|
||||
from .amdsmi_interface import amdsmi_get_pcie_link_status
|
||||
from .amdsmi_interface import amdsmi_get_pcie_link_caps
|
||||
from .amdsmi_interface import amdsmi_get_bad_page_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_bad_page_info
|
||||
|
||||
# # Power Management
|
||||
from .amdsmi_interface import amdsmi_get_target_frequency_range
|
||||
from .amdsmi_interface import amdsmi_get_gpu_target_frequency_range
|
||||
|
||||
# # Process Information
|
||||
from .amdsmi_interface import amdsmi_get_process_list
|
||||
from .amdsmi_interface import amdsmi_get_process_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_process_list
|
||||
from .amdsmi_interface import amdsmi_get_gpu_process_info
|
||||
|
||||
# # ECC Error Information
|
||||
from .amdsmi_interface import amdsmi_get_ecc_error_count
|
||||
from .amdsmi_interface import amdsmi_get_gpu_ecc_error_count
|
||||
|
||||
# # Board Information
|
||||
from .amdsmi_interface import amdsmi_get_board_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_board_info
|
||||
|
||||
# # Ras Information
|
||||
from .amdsmi_interface import amdsmi_get_ras_block_features_enabled
|
||||
from .amdsmi_interface import amdsmi_get_gpu_ras_block_features_enabled
|
||||
|
||||
# # Supported Function Checks
|
||||
from .amdsmi_interface import amdsmi_dev_open_supported_func_iterator
|
||||
from .amdsmi_interface import amdsmi_dev_open_supported_variant_iterator
|
||||
from .amdsmi_interface import amdsmi_dev_close_supported_func_iterator
|
||||
from .amdsmi_interface import amdsmi_open_supported_func_iterator
|
||||
from .amdsmi_interface import amdsmi_open_supported_variant_iterator
|
||||
from .amdsmi_interface import amdsmi_close_supported_func_iterator
|
||||
from .amdsmi_interface import amdsmi_next_func_iter
|
||||
from .amdsmi_interface import amdsmi_get_func_iter_value
|
||||
|
||||
# # Unsupported Functions In Virtual Environment
|
||||
from .amdsmi_interface import amdsmi_dev_set_pci_bandwidth
|
||||
from .amdsmi_interface import amdsmi_dev_set_power_cap
|
||||
from .amdsmi_interface import amdsmi_dev_set_power_profile
|
||||
from .amdsmi_interface import amdsmi_dev_set_clk_range
|
||||
from .amdsmi_interface import amdsmi_dev_set_od_clk_info
|
||||
from .amdsmi_interface import amdsmi_dev_set_od_volt_info
|
||||
from .amdsmi_interface import amdsmi_dev_set_perf_level_v1
|
||||
from .amdsmi_interface import amdsmi_dev_set_perf_level
|
||||
from .amdsmi_interface import amdsmi_dev_get_power_profile_presets
|
||||
from .amdsmi_interface import amdsmi_dev_reset_gpu
|
||||
from .amdsmi_interface import amdsmi_set_perf_determinism_mode
|
||||
from .amdsmi_interface import amdsmi_dev_set_fan_speed
|
||||
from .amdsmi_interface import amdsmi_dev_reset_fan
|
||||
from .amdsmi_interface import amdsmi_dev_set_clk_freq
|
||||
from .amdsmi_interface import amdsmi_dev_set_overdrive_level_v1
|
||||
from .amdsmi_interface import amdsmi_dev_set_overdrive_level
|
||||
from .amdsmi_interface import amdsmi_set_gpu_pci_bandwidth
|
||||
from .amdsmi_interface import amdsmi_set_power_cap
|
||||
from .amdsmi_interface import amdsmi_set_gpu_power_profile
|
||||
from .amdsmi_interface import amdsmi_set_gpu_clk_range
|
||||
from .amdsmi_interface import amdsmi_set_gpu_od_clk_info
|
||||
from .amdsmi_interface import amdsmi_set_gpu_od_volt_info
|
||||
from .amdsmi_interface import amdsmi_set_gpu_perf_level_v1
|
||||
from .amdsmi_interface import amdsmi_set_gpu_perf_level
|
||||
from .amdsmi_interface import amdsmi_get_gpu_power_profile_presets
|
||||
from .amdsmi_interface import amdsmi_reset_gpu
|
||||
from .amdsmi_interface import amdsmi_set_gpu_perf_determinism_mode
|
||||
from .amdsmi_interface import amdsmi_set_gpu_fan_speed
|
||||
from .amdsmi_interface import amdsmi_reset_gpu_fan
|
||||
from .amdsmi_interface import amdsmi_set_clk_freq
|
||||
from .amdsmi_interface import amdsmi_set_gpu_overdrive_level_v1
|
||||
from .amdsmi_interface import amdsmi_set_gpu_overdrive_level
|
||||
|
||||
# # Physical State Queries
|
||||
from .amdsmi_interface import amdsmi_dev_get_fan_rpms
|
||||
from .amdsmi_interface import amdsmi_dev_get_fan_speed
|
||||
from .amdsmi_interface import amdsmi_dev_get_fan_speed_max
|
||||
from .amdsmi_interface import amdsmi_dev_get_temp_metric
|
||||
from .amdsmi_interface import amdsmi_dev_get_volt_metric
|
||||
from .amdsmi_interface import amdsmi_get_gpu_fan_rpms
|
||||
from .amdsmi_interface import amdsmi_get_gpu_fan_speed
|
||||
from .amdsmi_interface import amdsmi_get_gpu_fan_speed_max
|
||||
from .amdsmi_interface import amdsmi_get_temp_metric
|
||||
from .amdsmi_interface import amdsmi_get_gpu_volt_metric
|
||||
|
||||
# # Clock, Power and Performance Query
|
||||
from .amdsmi_interface import amdsmi_dev_get_busy_percent
|
||||
from .amdsmi_interface import amdsmi_get_busy_percent
|
||||
from .amdsmi_interface import amdsmi_get_utilization_count
|
||||
from .amdsmi_interface import amdsmi_dev_get_perf_level
|
||||
from .amdsmi_interface import amdsmi_set_perf_determinism_mode
|
||||
from .amdsmi_interface import amdsmi_dev_get_overdrive_level
|
||||
from .amdsmi_interface import amdsmi_dev_get_gpu_clk_freq
|
||||
from .amdsmi_interface import amdsmi_dev_get_od_volt_info
|
||||
from .amdsmi_interface import amdsmi_dev_get_gpu_metrics_info
|
||||
from .amdsmi_interface import amdsmi_dev_get_od_volt_curve_regions
|
||||
from .amdsmi_interface import amdsmi_dev_get_power_profile_presets
|
||||
from .amdsmi_interface import amdsmi_get_gpu_perf_level
|
||||
from .amdsmi_interface import amdsmi_set_gpu_perf_determinism_mode
|
||||
from .amdsmi_interface import amdsmi_get_gpu_overdrive_level
|
||||
from .amdsmi_interface import amdsmi_get_clk_freq
|
||||
from .amdsmi_interface import amdsmi_get_gpu_od_volt_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_metrics_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_od_volt_curve_regions
|
||||
from .amdsmi_interface import amdsmi_get_gpu_power_profile_presets
|
||||
|
||||
# # Performance Counters
|
||||
from .amdsmi_interface import amdsmi_dev_counter_group_supported
|
||||
from .amdsmi_interface import amdsmi_dev_create_counter
|
||||
from .amdsmi_interface import amdsmi_dev_destroy_counter
|
||||
from .amdsmi_interface import amdsmi_control_counter
|
||||
from .amdsmi_interface import amdsmi_read_counter
|
||||
from .amdsmi_interface import amdsmi_counter_get_available_counters
|
||||
from .amdsmi_interface import amdsmi_gpu_counter_group_supported
|
||||
from .amdsmi_interface import amdsmi_gpu_create_counter
|
||||
from .amdsmi_interface import amdsmi_gpu_destroy_counter
|
||||
from .amdsmi_interface import amdsmi_gpu_control_counter
|
||||
from .amdsmi_interface import amdsmi_gpu_read_counter
|
||||
from .amdsmi_interface import amdsmi_get_gpu_available_counters
|
||||
|
||||
# # Error Query
|
||||
from .amdsmi_interface import amdsmi_dev_get_ecc_count
|
||||
from .amdsmi_interface import amdsmi_dev_get_ecc_enabled
|
||||
from .amdsmi_interface import amdsmi_dev_get_ecc_status
|
||||
from .amdsmi_interface import amdsmi_get_gpu_ecc_count
|
||||
from .amdsmi_interface import amdsmi_get_gpu_ecc_enabled
|
||||
from .amdsmi_interface import amdsmi_get_gpu_ecc_status
|
||||
from .amdsmi_interface import amdsmi_status_string
|
||||
|
||||
# # System Information Query
|
||||
from .amdsmi_interface import amdsmi_get_compute_process_info
|
||||
from .amdsmi_interface import amdsmi_get_compute_process_info_by_pid
|
||||
from .amdsmi_interface import amdsmi_get_compute_process_gpus
|
||||
from .amdsmi_interface import amdsmi_dev_xgmi_error_status
|
||||
from .amdsmi_interface import amdsmi_dev_reset_xgmi_error
|
||||
from .amdsmi_interface import amdsmi_get_gpu_compute_process_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_compute_process_info_by_pid
|
||||
from .amdsmi_interface import amdsmi_get_gpu_compute_process_gpus
|
||||
from .amdsmi_interface import amdsmi_gpu_xgmi_error_status
|
||||
from .amdsmi_interface import amdsmi_reset_gpu_xgmi_error
|
||||
|
||||
# # PCIE information
|
||||
from .amdsmi_interface import amdsmi_dev_get_pci_id
|
||||
from .amdsmi_interface import amdsmi_dev_get_pci_bandwidth
|
||||
from .amdsmi_interface import amdsmi_dev_get_pci_throughput
|
||||
from .amdsmi_interface import amdsmi_dev_get_pci_replay_counter
|
||||
from .amdsmi_interface import amdsmi_topo_get_numa_affinity
|
||||
from .amdsmi_interface import amdsmi_get_gpu_pci_id
|
||||
from .amdsmi_interface import amdsmi_get_gpu_pci_bandwidth
|
||||
from .amdsmi_interface import amdsmi_get_gpu_pci_throughput
|
||||
from .amdsmi_interface import amdsmi_get_gpu_pci_replay_counter
|
||||
from .amdsmi_interface import amdsmi_get_gpu_topo_numa_affinity
|
||||
|
||||
# # Power information
|
||||
from .amdsmi_interface import amdsmi_dev_get_power_ave
|
||||
from .amdsmi_interface import amdsmi_dev_get_energy_count
|
||||
from .amdsmi_interface import amdsmi_get_energy_count
|
||||
|
||||
# # Memory information
|
||||
from .amdsmi_interface import amdsmi_dev_get_memory_total
|
||||
from .amdsmi_interface import amdsmi_dev_get_memory_usage
|
||||
from .amdsmi_interface import amdsmi_dev_get_memory_busy_percent
|
||||
from .amdsmi_interface import amdsmi_dev_get_memory_reserved_pages
|
||||
from .amdsmi_interface import amdsmi_get_gpu_memory_total
|
||||
from .amdsmi_interface import amdsmi_get_gpu_memory_usage
|
||||
from .amdsmi_interface import amdsmi_get_gpu_memory_busy_percent
|
||||
from .amdsmi_interface import amdsmi_get_gpu_memory_reserved_pages
|
||||
|
||||
# # Events
|
||||
from .amdsmi_interface import AmdSmiEventReader
|
||||
|
||||
# # Device Identification information
|
||||
from .amdsmi_interface import amdsmi_dev_get_vendor_name
|
||||
from .amdsmi_interface import amdsmi_dev_get_id
|
||||
from .amdsmi_interface import amdsmi_dev_get_vram_vendor
|
||||
from .amdsmi_interface import amdsmi_dev_get_drm_render_minor
|
||||
from .amdsmi_interface import amdsmi_dev_get_subsystem_id
|
||||
from .amdsmi_interface import amdsmi_dev_get_subsystem_name
|
||||
from .amdsmi_interface import amdsmi_get_gpu_vendor_name
|
||||
from .amdsmi_interface import amdsmi_get_gpu_id
|
||||
from .amdsmi_interface import amdsmi_get_gpu_vram_vendor
|
||||
from .amdsmi_interface import amdsmi_get_gpu_drm_render_minor
|
||||
from .amdsmi_interface import amdsmi_get_gpu_subsystem_id
|
||||
from .amdsmi_interface import amdsmi_get_gpu_subsystem_name
|
||||
|
||||
# # Version information
|
||||
from .amdsmi_interface import amdsmi_get_version
|
||||
@@ -171,7 +169,7 @@ from .amdsmi_interface import amdsmi_get_version_str
|
||||
# # Hardware topology query
|
||||
from .amdsmi_interface import amdsmi_topo_get_numa_node_number
|
||||
from .amdsmi_interface import amdsmi_topo_get_link_weight
|
||||
from .amdsmi_interface import amdsmi_get_minmax_bandwidth
|
||||
from .amdsmi_interface import amdsmi_get_minmax_bandwidth
|
||||
from .amdsmi_interface import amdsmi_topo_get_link_type
|
||||
from .amdsmi_interface import amdsmi_is_P2P_accessible
|
||||
from .amdsmi_interface import amdsmi_get_xgmi_info
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -10,11 +10,14 @@ name = "amdsmi"
|
||||
authors = [
|
||||
{name = "AMD", email = "amd-smi.support@amd.com"},
|
||||
]
|
||||
version = '0.3'
|
||||
version = '1.0'
|
||||
license = {file = "amdsmi/LICENSE"}
|
||||
readme = {file = "amdsmi/README.md", content-type = "text/markdown"}
|
||||
description = "SMI LIB - AMD GPU Monitoring Library"
|
||||
requires-python = ">=3.7"
|
||||
dependencies = [
|
||||
'PyYAML >= 5.0',
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://github.com/RadeonOpenCompute/amdsmi"
|
||||
|
||||
@@ -100,16 +100,16 @@ class CmdLineParser:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _get_device_handle_from_id(self, gpu_id, vf_id=None):
|
||||
devices = smi_api.amdsmi_get_device_handles()
|
||||
def _get_processor_handle_from_id(self, gpu_id, vf_id=None):
|
||||
devices = smi_api.amdsmi_get_processor_handles()
|
||||
self._check_range("gpu id", gpu_id, 0, len(devices) - 1)
|
||||
device_handle = devices[gpu_id]
|
||||
processor_handle = devices[gpu_id]
|
||||
|
||||
if vf_id is not None:
|
||||
partitions = smi_api.amdsmi_get_vf_partition_info(device_handle)
|
||||
partitions = smi_api.amdsmi_get_vf_partition_info(processor_handle)
|
||||
self._check_range("vf id", vf_id, 0, len(partitions) - 1)
|
||||
device_handle = smi_api.amdsmi_get_vf_handle_from_vf_index(device_handle, vf_id)
|
||||
return device_handle
|
||||
processor_handle = smi_api.amdsmi_get_vf_handle_from_vf_index(processor_handle, vf_id)
|
||||
return processor_handle
|
||||
|
||||
def _parse_vf_id_if_exists(self):
|
||||
gpu_id = None
|
||||
@@ -156,32 +156,32 @@ class CmdLineParser:
|
||||
|
||||
return self.command_entry[0]
|
||||
|
||||
def get_device_handle(self):
|
||||
device_handles = []
|
||||
def get_processor_handle(self):
|
||||
processor_handles = []
|
||||
|
||||
def parse_device_handle(position):
|
||||
self._check_if_arg_exists("Device identifier", "device bdf or device id", position)
|
||||
def parse_processor_handle(possition):
|
||||
self._check_if_arg_exists("Device identifier", "device bdf or device id", possition)
|
||||
|
||||
ids = self._parse_vf_id_if_exists()
|
||||
if ids["gpu_id"] is not None and ids["vf_id"] is not None:
|
||||
device_handle = self._get_device_handle_from_id(ids["gpu_id"], ids["vf_id"])
|
||||
processor_handle = self._get_processor_handle_from_id(ids["gpu_id"], ids["vf_id"])
|
||||
else:
|
||||
gpu_arg = self.cmd_args[position]
|
||||
if gpu_arg.isdigit():
|
||||
device_handle = self._get_device_handle_from_id(int(gpu_arg))
|
||||
processor_handle = self._get_processor_handle_from_id(int(gpu_arg))
|
||||
else:
|
||||
self._check_bdf(gpu_arg)
|
||||
device_handle = smi_api.amdsmi_get_device_handle_from_bdf(gpu_arg)
|
||||
device_handles.append(device_handle)
|
||||
processor_handle = smi_api.amdsmi_get_processor_handle_from_bdf(gpu_arg)
|
||||
processor_handles.append(processor_handle)
|
||||
|
||||
for i in range(len(self.command_entry)):
|
||||
if f"device_identifier{i + 1}" in self.command_entry[1]:
|
||||
parse_device_handle(i + 2)
|
||||
parse_processor_handle(i + 2)
|
||||
|
||||
if len(device_handles) == 0:
|
||||
if len(processor_handles) == 0:
|
||||
return None
|
||||
|
||||
return device_handles
|
||||
return processor_handles
|
||||
|
||||
def get_command_args(self):
|
||||
offset = 2 + self.extra_args
|
||||
@@ -234,7 +234,7 @@ class Formatter:
|
||||
self.print_dict(result)
|
||||
elif isinstance(result, list):
|
||||
self.print_list(result)
|
||||
elif isinstance(result, smi_api.amdsmi_wrapper.amdsmi_device_handle):
|
||||
elif isinstance(result, smi_api.amdsmi_wrapper.amdsmi_processor_handle):
|
||||
self.print_handle("\n" + result)
|
||||
else:
|
||||
print(result)
|
||||
@@ -263,7 +263,7 @@ class Formatter:
|
||||
print("{}{:25} :{}".format(space, self.style.background(key), str(value)))
|
||||
|
||||
def print_handle(self, handle):
|
||||
bdf = smi_api.amdsmi_get_device_bdf(handle)
|
||||
bdf = smi_api.amdsmi_get_gpu_device_bdf(handle)
|
||||
print("{:25} :{}".format(self.style.background("BDF"), str(bdf)))
|
||||
|
||||
def print_usage(self):
|
||||
@@ -287,84 +287,83 @@ class Formatter:
|
||||
| |
|
||||
| """ + self.style.header("COMMANDS:") + """ |
|
||||
| |
|
||||
| """ + self.style.text(" 1 Get device vendor name. Api: amdsmi_dev_get_vendor_name <bdf>") + """ |
|
||||
| """ + self.style.text(" 2 Get device id. Api: amdsmi_dev_get_id <bdf>") + """ |
|
||||
| """ + self.style.text(" 3 Get device vram vendor. Api: amdsmi_dev_get_vram_vendor <bdf>") + """ |
|
||||
| """ + self.style.text(" 4 Get device drm render minor. Api: amdsmi_dev_get_drm_render_minor <bdf>") + """ |
|
||||
| """ + self.style.text(" 5 Get device subsystem id. Api: amdsmi_dev_get_subsystem_id <bdf>") + """ |
|
||||
| """ + self.style.text(" 6 Get device subsystem name. Api: amdsmi_dev_get_subsystem_name <bdf>") + """ |
|
||||
| """ + self.style.text(" 7 Get device pci id. Api: amdsmi_dev_get_pci_id <bdf>") + """ |
|
||||
| """ + self.style.text(" 8 Get device pci bandwidth. Api: amdsmi_dev_get_pci_bandwidth <bdf>") + """ |
|
||||
| """ + self.style.text(" 9 Get device pci throughput. Api: amdsmi_dev_get_pci_throughput <bdf>") + """ |
|
||||
| """ + self.style.text("10 Get device pci replay counter. Api: amdsmi_dev_get_pci_replay_counter <bdf>") + """ |
|
||||
| """ + self.style.text("11 Get topo numa affinity. Api: amdsmi_topo_get_numa_affinity <bdf>") + """ |
|
||||
| """ + self.style.text("12 Get device power ave. Api: amdsmi_dev_get_power_ave <bdf><sensor_id>") + """ |
|
||||
| """ + self.style.text("13 Get device energy count. Api: amdsmi_dev_get_energy_count <bdf>") + """ |
|
||||
| """ + self.style.text("14 Get device memory total. Api: amdsmi_dev_get_memory_total <bdf>") + """ |
|
||||
| """ + self.style.text("15 Get device memory usage. Api: amdsmi_dev_get_memory_usage <bdf>") + """ |
|
||||
| """ + self.style.text("16 Get device memory busy percent. Api: amdsmi_dev_get_memory_busy_percent <bdf>") + """ |
|
||||
| """ + self.style.text("17 Get device memory reserved pages. Api: amdsmi_dev_get_memory_reserved_pages <bdf>") + """ |
|
||||
| """ + self.style.text("18 Get device fan rpms. Api: amdsmi_dev_get_fan_rpms <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("19 Get device fan speed. Api: amdsmi_dev_get_fan_speed <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("20 Get device fan speed max. Api: amdsmi_dev_get_fan_speed_max <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("21 Get device temp metric. Api: amdsmi_dev_get_temp_metric <bdf>") + """ |
|
||||
| """ + self.style.text("22 Get device volt metric. Api: amdsmi_dev_get_volt_metric <bdf>") + """ |
|
||||
| """ + self.style.text("23 Get device busy percent. Api: amdsmi_dev_get_busy_percent <bdf>") + """ |
|
||||
| """ + self.style.text(" 1 Get device vendor name. Api: amdsmi_get_gpu_vendor_name <bdf>") + """ |
|
||||
| """ + self.style.text(" 2 Get device id. Api: amdsmi_get_gpu_id <bdf>") + """ |
|
||||
| """ + self.style.text(" 3 Get device vram vendor. Api: amdsmi_get_gpu_vram_vendor <bdf>") + """ |
|
||||
| """ + self.style.text(" 4 Get device drm render minor. Api: amdsmi_get_gpu_drm_render_minor <bdf>") + """ |
|
||||
| """ + self.style.text(" 5 Get device subsystem id. Api: amdsmi_get_gpu_subsystem_id <bdf>") + """ |
|
||||
| """ + self.style.text(" 6 Get device subsystem name. Api: amdsmi_get_gpu_subsystem_name <bdf>") + """ |
|
||||
| """ + self.style.text(" 7 Get device pci id. Api: amdsmi_get_gpu_pci_id <bdf>") + """ |
|
||||
| """ + self.style.text(" 8 Get device pci bandwidth. Api: amdsmi_get_gpu_pci_bandwidth <bdf>") + """ |
|
||||
| """ + self.style.text(" 9 Get device pci throughput. Api: amdsmi_get_gpu_pci_throughput <bdf>") + """ |
|
||||
| """ + self.style.text("10 Get device pci replay counter. Api: amdsmi_get_gpu_pci_replay_counter <bdf>") + """ |
|
||||
| """ + self.style.text("11 Get topo numa affinity. Api: amdsmi_get_gpu_topo_numa_affinity <bdf>") + """ |
|
||||
| """ + self.style.text("13 Get device energy count. Api: amdsmi_get_energy_count <bdf>") + """ |
|
||||
| """ + self.style.text("14 Get device memory total. Api: amdsmi_get_gpu_memory_total <bdf>") + """ |
|
||||
| """ + self.style.text("15 Get device memory usage. Api: amdsmi_get_gpu_memory_usage <bdf>") + """ |
|
||||
| """ + self.style.text("16 Get device memory busy percent. Api: amdsmi_get_gpu_memory_busy_percent <bdf>") + """ |
|
||||
| """ + self.style.text("17 Get device memory reserved pages. Api: amdsmi_get_gpu_memory_reserved_pages <bdf>") + """ |
|
||||
| """ + self.style.text("18 Get device fan rpms. Api: amdsmi_get_gpu_fan_rpms <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("19 Get device fan speed. Api: amdsmi_get_gpu_fan_speed <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("20 Get device fan speed max. Api: amdsmi_get_gpu_fan_speed_max <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("21 Get device temp metric. Api: amdsmi_get_temp_metric <bdf>") + """ |
|
||||
| """ + self.style.text("22 Get device volt metric. Api: amdsmi_get_gpu_volt_metric <bdf>") + """ |
|
||||
| """ + self.style.text("23 Get device busy percent. Api: amdsmi_get_busy_percent <bdf>") + """ |
|
||||
| """ + self.style.text("24 Get utilization count. Api: amdsmi_get_utilization_count <bdf>") + """ |
|
||||
| """ + self.style.text("25 Get device perf level. Api: amdsmi_dev_get_perf_level <bdf>") + """ |
|
||||
| """ + self.style.text("26 Set perf determinism mode. Api: amdsmi_set_perf_determinism_mode <bdf><clock_value>") + """ |
|
||||
| """ + self.style.text("27 Get device overdrive level. Api: amdsmi_dev_get_overdrive_level <bdf>") + """ |
|
||||
| """ + self.style.text("28 Get device gpu clk freq. Api: amdsmi_dev_get_gpu_clk_freq <bdf>") + """ |
|
||||
| """ + self.style.text("29 Get device od volt. Api: amdsmi_dev_get_od_volt_info <bdf>") + """ |
|
||||
| """ + self.style.text("30 Get device gpu metrics. Api: amdsmi_dev_get_gpu_metrics_info <bdf>") + """ |
|
||||
| """ + self.style.text("31 Get device od volt curve regions. Api: amdsmi_dev_get_od_volt_curve_regions <bdf><num_regions>") + """ |
|
||||
| """ + self.style.text("32 Get device power profile presets. Api: amdsmi_dev_get_power_profile_presets <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("25 Get device perf level. Api: amdsmi_get_gpu_perf_level <bdf>") + """ |
|
||||
| """ + self.style.text("26 Set perf determinism mode. Api: amdsmi_set_gpu_perf_determinism_mode <bdf><clock_value>") + """ |
|
||||
| """ + self.style.text("27 Get device overdrive level. Api: amdsmi_get_gpu_overdrive_level <bdf>") + """ |
|
||||
| """ + self.style.text("28 Get device gpu clk freq. Api: amdsmi_get_clk_freq <bdf>") + """ |
|
||||
| """ + self.style.text("29 Get device od volt. Api: amdsmi_get_gpu_od_volt_info <bdf>") + """ |
|
||||
| """ + self.style.text("30 Get device gpu metrics. Api: amdsmi_get_gpu_metrics_info <bdf>") + """ |
|
||||
| """ + self.style.text("31 Get device od volt curve regions. Api: amdsmi_get_gpu_od_volt_curve_regions <bdf><num_regions>") + """ |
|
||||
| """ + self.style.text("32 Get device power profile presets. Api: amdsmi_get_gpu_power_profile_presets <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("33 Get the build version. Api: amdsmi_get_version <None>") + """ |
|
||||
| """ + self.style.text("34 Get version string. Api: amdsmi_get_version_str <None>") + """ |
|
||||
| """ + self.style.text("35 Get device ecc counter. Api: amdsmi_dev_get_ecc_count <bdf>") + """ |
|
||||
| """ + self.style.text("36 Get device ecc enable. Api: amdsmi_dev_get_ecc_enabled <bdf>") + """ |
|
||||
| """ + self.style.text("37 Get device ecc status. Api: amdsmi_dev_get_ecc_status <bdf>") + """ |
|
||||
| """ + self.style.text("35 Get device ecc counter. Api: amdsmi_get_gpu_ecc_count <bdf>") + """ |
|
||||
| """ + self.style.text("36 Get device ecc enable. Api: amdsmi_get_gpu_ecc_enabled <bdf>") + """ |
|
||||
| """ + self.style.text("37 Get device ecc status. Api: amdsmi_get_gpu_ecc_status <bdf>") + """ |
|
||||
| """ + self.style.text("38 Get status string. Api: amdsmi_status_string <status>") + """ |
|
||||
| """ + self.style.text("39 Get compute process info. Api: amdsmi_get_compute_process_info <None>") + """ |
|
||||
| """ + self.style.text("40 Get compute process info by pid. Api: amdsmi_get_compute_process_info_by_pid <pid>") + """ |
|
||||
| """ + self.style.text("41 Get compute process gpus. Api: amdsmi_get_compute_process_gpus <pid>") + """ |
|
||||
| """ + self.style.text("42 Get device xgmi_error_status. Api: amdsmi_dev_xgmi_error_status <bdf>") + """ |
|
||||
| """ + self.style.text("43 Get device xgmi error reset. Api: amdsmi_dev_reset_xgmi_error <bdf>") + """ |
|
||||
| """ + self.style.text("39 Get compute process info. Api: amdsmi_get_gpu_compute_process_info <None>") + """ |
|
||||
| """ + self.style.text("40 Get compute process info by pid. Api: amdsmi_get_gpu_compute_process_info_by_pid <pid>") + """ |
|
||||
| """ + self.style.text("41 Get compute process gpus. Api: amdsmi_get_gpu_compute_process_gpus <pid>") + """ |
|
||||
| """ + self.style.text("42 Get device xgmi_error_status. Api: amdsmi_gpu_xgmi_error_status <bdf>") + """ |
|
||||
| """ + self.style.text("43 Get device xgmi error reset. Api: amdsmi_reset_gpu_xgmi_error <bdf>") + """ |
|
||||
| """ + self.style.text("44 Get topo get numa node number. Api: amdsmi_topo_get_numa_node_number <bdf>") + """ |
|
||||
| """ + self.style.text("45 Get topo get link weight. Api: amdsmi_topo_get_link_weight <bdf><bdf>") + """ |
|
||||
| """ + self.style.text("46 Get minmax_bandwidth_get. Api: amdsmi_get_minmax_bandwidth <bdf><bdf>") + """ |
|
||||
| """ + self.style.text("47 Get topo get link type. Api: amdsmi_topo_get_link_type <bdf><bdf>") + """ |
|
||||
| """ + self.style.text("48 Get is P2P accessible. Api: amdsmi_is_P2P_accessible <bdf><bdf>") + """ |
|
||||
| """ + self.style.text("49 Get asic info. Api: amdsmi_get_asic_info <bdf>") + """ |
|
||||
| """ + self.style.text("50 Get device_handles. Api: amdsmi_get_device_handles <None>") + """ |
|
||||
| """ + self.style.text("51 Get event notification. Api: amdsmi_get_event_notification <bdf>") + """ |
|
||||
| """ + self.style.text("52 Init event notification. Api: amdsmi_init_event_notification <bdf>") + """ |
|
||||
| """ + self.style.text("53 Set event notification mask. Api: amdsmi_set_event_notification_mask <bdf><mask>") + """ |
|
||||
| """ + self.style.text("54 Get event notification. Api: amdsmi_stop_event_notification <bdf>") + """ |
|
||||
| """ + self.style.text("49 Get asic info. Api: amdsmi_get_gpu_asic_info <bdf>") + """ |
|
||||
| """ + self.style.text("50 Get processor_handles. Api: amdsmi_get_processor_handles <None>") + """ |
|
||||
| """ + self.style.text("51 Get event notification. Api: amdsmi_get_gpu_event_notification <bdf>") + """ |
|
||||
| """ + self.style.text("52 Init event notification. Api: amdsmi_init_gpu_event_notification <bdf>") + """ |
|
||||
| """ + self.style.text("53 Set event notification mask. Api: amdsmi_set_gpu_event_notification_mask <bdf><mask>") + """ |
|
||||
| """ + self.style.text("54 Get event notification. Api: amdsmi_stop_gpu_event_notification <bdf>") + """ |
|
||||
| """ + self.style.text("55 Init. Api: amdsmi_init <None>") + """ |
|
||||
| """ + self.style.text("56 Shut down. Api: amdsmi_shut_down <None>") + """ |
|
||||
| """ + self.style.text("57 Get fw info. Api: amdsmi_get_fw_info <bdf>") + """ |
|
||||
| """ + self.style.text("58 Get vbios info. Api: amdsmi_get_vbios_info <bdf>") + """ |
|
||||
| """ + self.style.text("59 Get counter available counters. Api: amdsmi_counter_get_available_counters <bdf>") + """ |
|
||||
| """ + self.style.text("60 Get counter control. Api: amdsmi_control_counter <bdf>") + """ |
|
||||
| """ + self.style.text("61 Get counter read. Api: amdsmi_read_counter <bdf>") + """ |
|
||||
| """ + self.style.text("62 Set dev clk range. Api: amdsmi_dev_set_clk_range <bdf><min_clk><max_clk>") + """ |
|
||||
| """ + self.style.text("63 Get dev counter group supported. Api: amdsmi_dev_counter_group_supported <bdf>") + """ |
|
||||
| """ + self.style.text("64 Reset dev fan. Api: amdsmi_dev_reset_fan <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("65 Set dev fan speed. Api: amdsmi_dev_set_fan_speed <bdf><sensor_idx><fan_speed>") + """ |
|
||||
| """ + self.style.text("66 Set dev gpu clk freq. Api: amdsmi_dev_set_clk_freq <bdf><freq_bitmask>") + """ |
|
||||
| """ + self.style.text("67 Reset dev gpu. Api: amdsmi_dev_reset_gpu <bdf>") + """ |
|
||||
| """ + self.style.text("68 Set dev od clk info. Api: amdsmi_dev_set_od_clk_info <bdf><value>") + """ |
|
||||
| """ + self.style.text("69 Set dev od volt info. Api: amdsmi_dev_set_od_volt_info <bdf><vpoint><clk_value><volt_value>") + """|
|
||||
| """ + self.style.text("70 Set dev overdrive level. Api: amdsmi_dev_set_overdrive_level <bdf><overdrive_value>") + """ |
|
||||
| """ + self.style.text("71 Set v1 dev overdrive level. Api: amdsmi_dev_set_overdrive_level_v1 <bdf><overdrive_value>") + """ |
|
||||
| """ + self.style.text("72 Set dev pci bandwidth. Api: amdsmi_dev_set_pci_bandwidth <bdf><bitmask>") + """ |
|
||||
| """ + self.style.text("73 Set dev perf level. Api: amdsmi_dev_set_perf_level <bdf>") + """ |
|
||||
| """ + self.style.text("74 Set dev perf level v1. Api: amdsmi_dev_set_perf_level_v1 <bdf>") + """ |
|
||||
| """ + self.style.text("75 Set dev power cap. Api: amdsmi_dev_set_power_cap <bdf><sensor_ind><cap>") + """ |
|
||||
| """ + self.style.text("76 Set dev power profile. Api: amdsmi_dev_set_power_profile <bdf><reserved>") + """ |
|
||||
| """ + self.style.text("77 Close dev supported func iterator. Api: amdsmi_dev_close_supported_func_iterator <bdf>") + """ |
|
||||
| """ + self.style.text("78 Pen dev supported func iterator. Api: amdsmi_dev_open_supported_func_iterator <bdf>") + """ |
|
||||
| """ + self.style.text("58 Get vbios info. Api: amdsmi_get_gpu_vbios_info <bdf>") + """ |
|
||||
| """ + self.style.text("59 Get counter available counters. Api: amdsmi_get_gpu_available_counters <bdf>") + """ |
|
||||
| """ + self.style.text("60 Get counter control. Api: amdsmi_gpu_control_counter <bdf>") + """ |
|
||||
| """ + self.style.text("61 Get counter read. Api: amdsmi_gpu_read_counter <bdf>") + """ |
|
||||
| """ + self.style.text("62 Set dev clk range. Api: amdsmi_set_gpu_clk_range <bdf><min_clk><max_clk>") + """ |
|
||||
| """ + self.style.text("63 Get dev counter group supported. Api: amdsmi_gpu_counter_group_supported <bdf>") + """ |
|
||||
| """ + self.style.text("64 Reset dev fan. Api: amdsmi_reset_gpu_fan <bdf><sensor_idx>") + """ |
|
||||
| """ + self.style.text("65 Set dev fan speed. Api: amdsmi_set_gpu_fan_speed <bdf><sensor_idx><fan_speed>") + """ |
|
||||
| """ + self.style.text("66 Set dev gpu clk freq. Api: amdsmi_set_clk_freq <bdf><freq_bitmask>") + """ |
|
||||
| """ + self.style.text("67 Reset dev gpu. Api: amdsmi_reset_gpu <bdf>") + """ |
|
||||
| """ + self.style.text("68 Set dev od clk info. Api: amdsmi_set_gpu_od_clk_info <bdf><value>") + """ |
|
||||
| """ + self.style.text("69 Set dev od volt info. Api: amdsmi_set_gpu_od_volt_info <bdf><vpoint><clk_value><volt_value>") + """|
|
||||
| """ + self.style.text("70 Set dev overdrive level. Api: amdsmi_set_gpu_overdrive_level <bdf><overdrive_value>") + """ |
|
||||
| """ + self.style.text("71 Set v1 dev overdrive level. Api: amdsmi_set_gpu_overdrive_level_v1 <bdf><overdrive_value>") + """ |
|
||||
| """ + self.style.text("72 Set dev pci bandwidth. Api: amdsmi_set_gpu_pci_bandwidth <bdf><bitmask>") + """ |
|
||||
| """ + self.style.text("73 Set dev perf level. Api: amdsmi_set_gpu_perf_level <bdf>") + """ |
|
||||
| """ + self.style.text("74 Set dev perf level v1. Api: amdsmi_set_gpu_perf_level_v1 <bdf>") + """ |
|
||||
| """ + self.style.text("75 Set dev power cap. Api: amdsmi_set_power_cap <bdf><sensor_ind><cap>") + """ |
|
||||
| """ + self.style.text("76 Set dev power profile. Api: amdsmi_set_gpu_power_profile <bdf><reserved>") + """ |
|
||||
| """ + self.style.text("77 Close dev supported func iterator. Api: amdsmi_close_supported_func_iterator <bdf>") + """ |
|
||||
| """ + self.style.text("78 Pen dev supported func iterator. Api: amdsmi_open_supported_func_iterator <bdf>") + """ |
|
||||
| """ + self.style.text("79 Get func iter next. Api: amdsmi_next_func_iter <bdf>") + """ |
|
||||
| """ + self.style.text("80 Get power cap info. Api: amdsmi_get_power_cap_info <bdf>") + """ |
|
||||
| """ + self.style.text("81 Get xgmi info. Api: amdsmi_get_xgmi_info <bdf>") + """ |
|
||||
@@ -375,15 +374,11 @@ class Formatter:
|
||||
##############################################
|
||||
# SMI tool wrapper
|
||||
##############################################
|
||||
def amdsmi_tool_dev_power_ave_get(dev, dic):
|
||||
sensor_id = dic["sensor_id"]
|
||||
return smi_api.amdsmi_dev_get_power_ave(dev, ctypes.c_uint32(sensor_id))
|
||||
|
||||
def amdsmi_tool_dev_memory_total_get(dev):
|
||||
result = {}
|
||||
for memory_type in smi_api.AmdSmiMemoryType:
|
||||
try:
|
||||
value = smi_api.amdsmi_dev_get_memory_total(dev, memory_type)
|
||||
value = smi_api.amdsmi_get_gpu_memory_total(dev, memory_type)
|
||||
result.update({memory_type.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(memory_type.name, e))
|
||||
@@ -394,7 +389,7 @@ def amdsmi_tool_dev_memory_usage_get(dev):
|
||||
result = {}
|
||||
for memory_type in smi_api.AmdSmiMemoryType:
|
||||
try:
|
||||
value = smi_api.amdsmi_dev_get_memory_usage(dev, memory_type)
|
||||
value = smi_api.amdsmi_get_gpu_memory_usage(dev, memory_type)
|
||||
result.update({memory_type.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(memory_type.name, e))
|
||||
@@ -403,22 +398,22 @@ def amdsmi_tool_dev_memory_usage_get(dev):
|
||||
|
||||
def amdsmi_tool_dev_fan_rpms_get(dev, dic):
|
||||
sensor_idx = dic["sensor_idx"]
|
||||
return smi_api.amdsmi_dev_get_fan_rpms(dev, sensor_idx)
|
||||
return smi_api.amdsmi_get_gpu_fan_rpms(dev, sensor_idx)
|
||||
|
||||
def amdsmi_tool_dev_fan_speed_get(dev, dic):
|
||||
sensor_idx = dic["sensor_idx"]
|
||||
return smi_api.amdsmi_dev_get_fan_speed(dev, sensor_idx)
|
||||
return smi_api.amdsmi_get_gpu_fan_speed(dev, sensor_idx)
|
||||
|
||||
def amdsmi_tool_dev_fan_speed_max_get(dev, dic):
|
||||
sensor_idx = dic["sensor_idx"]
|
||||
return smi_api.amdsmi_dev_get_fan_speed_max(dev, sensor_idx)
|
||||
return smi_api.amdsmi_get_gpu_fan_speed_max(dev, sensor_idx)
|
||||
|
||||
def amdsmi_tool_dev_temp_metric_get(dev):
|
||||
result = {}
|
||||
for temperature_type in smi_api.AmdSmiTemperatureType:
|
||||
for temperature_metric in smi_api.AmdSmiTemperatureMetric:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_get_temp_metric(dev, temperature_type, temperature_metric)
|
||||
value = smi_api. amdsmi_get_temp_metric(dev, temperature_type, temperature_metric)
|
||||
result.update({"AmdSmiTemperatureType: " + temperature_type.name + ", AmdSmiTemperatureMetric: " + temperature_metric.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{},{}:\t{}".format(temperature_type.name, temperature_metric.name, e))
|
||||
@@ -430,7 +425,7 @@ def amdsmi_tool_dev_volt_metric_get(dev):
|
||||
for voltage_type in smi_api.AmdSmiVoltageType:
|
||||
for voltage_metric in smi_api.AmdSmiVoltageMetric:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_get_volt_metric(dev, voltage_type, voltage_metric)
|
||||
value = smi_api. amdsmi_get_gpu_volt_metric(dev, voltage_type, voltage_metric)
|
||||
result.update({"AmdSmiVoltageType: " + voltage_type.name + ", AmdSmiVoltageMetric: " + voltage_metric.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{},{}:\t{}".format(voltage_type.name, voltage_metric.name, e))
|
||||
@@ -450,11 +445,11 @@ def amdsmi_tool_utilization_count_get(dev):
|
||||
|
||||
def amdsmi_tool_perf_determinism_mode_set(dev, dic):
|
||||
clock_value = dic["clock_value"]
|
||||
return smi_api.amdsmi_set_perf_determinism_mode(dev, clock_value)
|
||||
return smi_api.amdsmi_set_gpu_perf_determinism_mode(dev, clock_value)
|
||||
|
||||
def amdsmi_tool_dev_power_profile_presets_get(dev, dic):
|
||||
sensor_idx = dic["sensor_idx"]
|
||||
return smi_api. amdsmi_dev_get_power_profile_presets(dev, sensor_idx)
|
||||
return smi_api. amdsmi_get_gpu_power_profile_presets(dev, sensor_idx)
|
||||
|
||||
def amdsmi_tool_version_str_get():
|
||||
result = {}
|
||||
@@ -469,31 +464,31 @@ def amdsmi_tool_version_str_get():
|
||||
|
||||
def amdsmi_tool_dev_fan_reset(dev, dic):
|
||||
sensor_idx = dic["sensor_idx"]
|
||||
return smi_api.amdsmi_dev_reset_fan(dev, sensor_idx)
|
||||
return smi_api.amdsmi_reset_gpu_fan(dev, sensor_idx)
|
||||
|
||||
def amdsmi_tool_dev_fan_speed_set(dev, dic):
|
||||
sensor_idx = dic["sensor_idx"]
|
||||
fan_speed = dic["fan_speed"]
|
||||
return smi_api.amdsmi_dev_set_fan_speed(dev, sensor_idx, fan_speed)
|
||||
return smi_api.amdsmi_set_gpu_fan_speed(dev, sensor_idx, fan_speed)
|
||||
|
||||
def amdsmi_tool_dev_overdrive_level_set(dev, dic):
|
||||
overdrive_value = dic["overdrive_value"]
|
||||
return smi_api. amdsmi_dev_set_overdrive_level(dev, overdrive_value)
|
||||
return smi_api. amdsmi_set_gpu_overdrive_level(dev, overdrive_value)
|
||||
|
||||
def amdsmi_tool_dev_overdrive_level_set_v1(dev, dic):
|
||||
overdrive_value = dic["overdrive_value"]
|
||||
return smi_api. amdsmi_dev_set_overdrive_level(dev, overdrive_value)
|
||||
return smi_api. amdsmi_set_gpu_overdrive_level(dev, overdrive_value)
|
||||
|
||||
def amdsmi_tool_dev_pci_bandwidth_set(dev, dic):
|
||||
bitmask = dic["bitmask"]
|
||||
return smi_api. amdsmi_dev_set_pci_bandwidth(dev, bitmask)
|
||||
return smi_api. amdsmi_set_gpu_pci_bandwidth(dev, bitmask)
|
||||
|
||||
|
||||
def amdsmi_tool_dev_gpu_clk_freq_get(dev):
|
||||
result = {}
|
||||
for clock_type in smi_api.AmdSmiClkType:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_get_gpu_clk_freq(dev, clock_type)
|
||||
value = smi_api. amdsmi_get_clk_freq(dev, clock_type)
|
||||
result.update({clock_type.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(clock_type.name, e))
|
||||
@@ -502,14 +497,14 @@ def amdsmi_tool_dev_gpu_clk_freq_get(dev):
|
||||
|
||||
def amdsmi_tool_dev_od_volt_curve_regions_get(dev, dic):
|
||||
num_regions = dic["num_regions"]
|
||||
return smi_api. amdsmi_dev_get_od_volt_curve_regions(dev, num_regions)
|
||||
return smi_api. amdsmi_get_gpu_od_volt_curve_regions(dev, num_regions)
|
||||
|
||||
|
||||
def amdsmi_tool_dev_ecc_count_get(dev):
|
||||
result = {}
|
||||
for gpu_block in smi_api.AmdSmiGpuBlock:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_get_ecc_count(dev, gpu_block)
|
||||
value = smi_api. amdsmi_get_gpu_ecc_count(dev, gpu_block)
|
||||
result.update({gpu_block.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(gpu_block.name, e))
|
||||
@@ -520,7 +515,7 @@ def amdsmi_tool_dev_ecc_status_get(dev):
|
||||
result = {}
|
||||
for gpu_block in smi_api.AmdSmiGpuBlock:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_get_ecc_status(dev, gpu_block)
|
||||
value = smi_api. amdsmi_get_gpu_ecc_status(dev, gpu_block)
|
||||
result.update({gpu_block.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(gpu_block.name, e))
|
||||
@@ -533,11 +528,11 @@ def amdsmi_tool_status_string(dic):
|
||||
|
||||
def amdsmi_tool_compute_process_gpus_get(dic):
|
||||
pid = dic["pid"]
|
||||
return smi_api.amdsmi_get_compute_process_gpus(pid)
|
||||
return smi_api.amdsmi_get_gpu_compute_process_gpus(pid)
|
||||
|
||||
def amdsmi_tool_compute_process_info_by_pid_get(dic):
|
||||
pid = dic["pid"]
|
||||
return smi_api.amdsmi_get_compute_process_info_by_pid(pid)
|
||||
return smi_api.amdsmi_get_gpu_compute_process_info_by_pid(pid)
|
||||
|
||||
def amdsmi_tool_topo_get_link_weight(dev):
|
||||
return smi_api.amdsmi_topo_get_link_weight(dev[0], dev[1])
|
||||
@@ -564,14 +559,14 @@ def amdsmi_tool_event_notification_get(dev):
|
||||
return result
|
||||
|
||||
def amdsmi_tool_event_notification_init(dev):
|
||||
return smi_api.amdsmi_wrapper.amdsmi_init_event_notification(dev)
|
||||
return smi_api.amdsmi_wrapper.amdsmi_init_gpu_event_notification(dev)
|
||||
|
||||
def amdsmi_tool_event_notification_mask_set(dev, dic):
|
||||
mask = dic["mask"]
|
||||
return smi_api.amdsmi_wrapper. amdsmi_set_event_notification_mask(dev, ctypes.c_uint64(mask))
|
||||
return smi_api.amdsmi_wrapper. amdsmi_set_gpu_event_notification_mask(dev, ctypes.c_uint64(mask))
|
||||
|
||||
def amdsmi_tool_event_notification_stop(dev):
|
||||
return smi_api.amdsmi_wrapper.amdsmi_stop_event_notification(dev)
|
||||
return smi_api.amdsmi_wrapper.amdsmi_stop_gpu_event_notification(dev)
|
||||
|
||||
def amdsmi_tool_shut_down():
|
||||
smi_api.amdsmi_init()
|
||||
@@ -582,7 +577,7 @@ def amdsmi_tool_counter_available_counters_get(dev):
|
||||
result = {}
|
||||
for event_group in smi_api.AmdSmiEventGroup:
|
||||
try:
|
||||
value = smi_api. amdsmi_counter_get_available_counters(dev, event_group)
|
||||
value = smi_api. amdsmi_get_gpu_available_counters(dev, event_group)
|
||||
result.update({event_group.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(event_group.name, e))
|
||||
@@ -594,8 +589,8 @@ def amdsmi_tool_counter_control(dev):
|
||||
for event_type in smi_api.AmdSmiEventType:
|
||||
for counter_command in smi_api.AmdSmiCounterCommand:
|
||||
try:
|
||||
event_handle = smi_api.amdsmi_dev_create_counter(dev, event_type)
|
||||
value = smi_api.amdsmi_control_counter(event_handle, counter_command)
|
||||
event_handle = smi_api.amdsmi_gpu_create_counter(dev, event_type)
|
||||
value = smi_api.amdsmi_gpu_control_counter(event_handle, counter_command)
|
||||
result.update({event_type.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(event_type.name, e))
|
||||
@@ -606,8 +601,8 @@ def amdsmi_tool_counter_read(dev):
|
||||
result = {}
|
||||
for event_type in smi_api.AmdSmiEventType:
|
||||
try:
|
||||
event_handle = smi_api.amdsmi_dev_create_counter(dev, event_type)
|
||||
value = smi_api.amdsmi_read_counter(event_handle)
|
||||
event_handle = smi_api.amdsmi_gpu_create_counter(dev, event_type)
|
||||
value = smi_api.amdsmi_gpu_read_counter(event_handle)
|
||||
result.update({event_type.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(event_type.name, e))
|
||||
@@ -620,7 +615,7 @@ def amdsmi_tool_dev_clk_range_set(dev, dic):
|
||||
max_clk = dic["max_clk"]
|
||||
for clock_type in smi_api.AmdSmiClkType:
|
||||
try:
|
||||
value = smi_api.amdsmi_dev_set_clk_range(dev, min_clk, max_clk, clock_type)
|
||||
value = smi_api.amdsmi_set_gpu_clk_range(dev, min_clk, max_clk, clock_type)
|
||||
result.update({clock_type.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(clock_type.name, e))
|
||||
@@ -631,7 +626,7 @@ def amdsmi_tool_dev_counter_group_supported(dev):
|
||||
result = {}
|
||||
for event_group in smi_api.AmdSmiEventGroup:
|
||||
try:
|
||||
value = smi_api.amdsmi_dev_counter_group_supported(dev, event_group)
|
||||
value = smi_api.amdsmi_gpu_counter_group_supported(dev, event_group)
|
||||
result.update({event_group.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(event_group.name, e))
|
||||
@@ -643,7 +638,7 @@ def amdsmi_tool_dev_gpu_clk_freq_set(dev, dic):
|
||||
freq_bitmask = dic["freq_bitmask"]
|
||||
for clock_type in smi_api.AmdSmiClkType:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_set_clk_freq(dev, clock_type, freq_bitmask)
|
||||
value = smi_api. amdsmi_set_clk_freq(dev, clock_type, freq_bitmask)
|
||||
result.update({clock_type.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(clock_type.name, e))
|
||||
@@ -656,7 +651,7 @@ def amdsmi_tool_dev_od_clk_info_set(dev, dic):
|
||||
for freq_ind in smi_api.AmdSmiFreqInd:
|
||||
for clock_type in smi_api.AmdSmiClkType:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_set_od_clk_info(dev, freq_ind, value, clock_type)
|
||||
value = smi_api. amdsmi_set_gpu_od_clk_info(dev, freq_ind, value, clock_type)
|
||||
result.update({"AmdSmiFreqInd: " + freq_ind.name + ", AmdSmiClkType: " + clock_type.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{},{}:\t{}".format(freq_ind.name, clock_type.name, e))
|
||||
@@ -667,13 +662,13 @@ def amdsmi_tool_dev_od_volt_info_set(dev, dic):
|
||||
vpoint = dic["vpoint"]
|
||||
clk_value = dic["clk_value"]
|
||||
volt_value = dic["volt_value"]
|
||||
return smi_api. amdsmi_dev_set_od_volt_info(dev, vpoint, clk_value, volt_value)
|
||||
return smi_api. amdsmi_set_gpu_od_volt_info(dev, vpoint, clk_value, volt_value)
|
||||
|
||||
def amdsmi_tool_dev_perf_level_set(dev):
|
||||
result = {}
|
||||
for dev_perf_level in smi_api.AmdSmiDevPerfLevel:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_set_perf_level(dev, dev_perf_level)
|
||||
value = smi_api. amdsmi_set_gpu_perf_level(dev, dev_perf_level)
|
||||
result.update({dev_perf_level.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(dev_perf_level.name, e))
|
||||
@@ -684,7 +679,7 @@ def amdsmi_tool_dev_perf_level_set_v1(dev):
|
||||
result = {}
|
||||
for dev_perf_level in smi_api.AmdSmiDevPerfLevel:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_set_perf_level_v1(dev, dev_perf_level)
|
||||
value = smi_api. amdsmi_set_gpu_perf_level_v1(dev, dev_perf_level)
|
||||
result.update({dev_perf_level.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(dev_perf_level.name, e))
|
||||
@@ -694,14 +689,14 @@ def amdsmi_tool_dev_perf_level_set_v1(dev):
|
||||
def amdsmi_tool_dev_power_cap_set(dev, dic):
|
||||
sensor_ind = dic["sensor_ind"]
|
||||
cap = dic["cap"]
|
||||
return smi_api. amdsmi_dev_set_power_cap(dev, sensor_ind, cap)
|
||||
return smi_api. amdsmi_set_power_cap(dev, sensor_ind, cap)
|
||||
|
||||
def amdsmi_tool_dev_power_profile_set(dev, dic):
|
||||
result = {}
|
||||
reserved = dic["reserved"]
|
||||
for power_profile_preset_maks in smi_api.AmdSmiPowerProfilePresetMasks:
|
||||
try:
|
||||
value = smi_api. amdsmi_dev_set_power_profile(dev, reserved, power_profile_preset_maks)
|
||||
value = smi_api. amdsmi_set_gpu_power_profile(dev, reserved, power_profile_preset_maks)
|
||||
result.update({power_profile_preset_maks.name: value})
|
||||
except smi_api.AmdSmiException as e:
|
||||
print("{}:\t{}".format(power_profile_preset_maks.name, e))
|
||||
@@ -709,11 +704,11 @@ def amdsmi_tool_dev_power_profile_set(dev, dic):
|
||||
return result
|
||||
|
||||
def amdsmi_tool_dev_supported_func_iterator_close(dev):
|
||||
obj_handle = smi_api.amdsmi_dev_open_supported_func_iterator(dev)
|
||||
return smi_api.amdsmi_dev_close_supported_func_iterator(obj_handle)
|
||||
obj_handle = smi_api.amdsmi_open_supported_func_iterator(dev)
|
||||
return smi_api.amdsmi_close_supported_func_iterator(obj_handle)
|
||||
|
||||
def amdsmi_tool_func_iter_next(dev):
|
||||
obj_handle = smi_api.amdsmi_dev_open_supported_func_iterator(dev)
|
||||
obj_handle = smi_api.amdsmi_open_supported_func_iterator(dev)
|
||||
return smi_api.amdsmi_next_func_iter(obj_handle)
|
||||
|
||||
##############################################
|
||||
@@ -722,44 +717,44 @@ def amdsmi_tool_func_iter_next(dev):
|
||||
|
||||
commands = {
|
||||
# idx: [func, {arg_name : [arg_type, is_arg_obligatory]}]
|
||||
1: [smi_api.amdsmi_dev_get_vendor_name, {
|
||||
1: [smi_api.amdsmi_get_gpu_vendor_name, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
2: [smi_api.amdsmi_dev_get_id, {
|
||||
2: [smi_api.amdsmi_get_gpu_id, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
3: [smi_api.amdsmi_dev_get_vram_vendor, {
|
||||
3: [smi_api.amdsmi_get_gpu_vram_vendor, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
4: [smi_api.amdsmi_dev_get_drm_render_minor, {
|
||||
4: [smi_api.amdsmi_get_gpu_drm_render_minor, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
5: [smi_api.amdsmi_dev_get_subsystem_id, {
|
||||
5: [smi_api.amdsmi_get_gpu_subsystem_id, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
6: [smi_api.amdsmi_dev_get_subsystem_name, {
|
||||
6: [smi_api.amdsmi_get_gpu_subsystem_name, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
7: [smi_api.amdsmi_dev_get_pci_id, {
|
||||
7: [smi_api.amdsmi_get_gpu_pci_id, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
8: [smi_api.amdsmi_dev_get_pci_bandwidth, {
|
||||
8: [smi_api.amdsmi_get_gpu_pci_bandwidth, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
9: [smi_api.amdsmi_dev_get_pci_throughput, {
|
||||
9: [smi_api.amdsmi_get_gpu_pci_throughput, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
10: [smi_api. amdsmi_dev_get_pci_replay_counter, {
|
||||
10: [smi_api. amdsmi_get_gpu_pci_replay_counter, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
11: [smi_api.amdsmi_topo_get_numa_affinity, {
|
||||
11: [smi_api.amdsmi_get_gpu_topo_numa_affinity, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
12: [amdsmi_tool_dev_power_ave_get, {
|
||||
"device_identifier1": [None, True],
|
||||
"sensor_id": [int, True]
|
||||
}],
|
||||
13: [smi_api.amdsmi_dev_get_energy_count, {
|
||||
13: [smi_api.amdsmi_get_energy_count, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
14: [amdsmi_tool_dev_memory_total_get, {
|
||||
@@ -768,10 +763,10 @@ commands = {
|
||||
15: [amdsmi_tool_dev_memory_usage_get, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
16: [smi_api.amdsmi_dev_get_memory_busy_percent, {
|
||||
16: [smi_api.amdsmi_get_gpu_memory_busy_percent, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
17: [smi_api.amdsmi_dev_get_memory_reserved_pages, {
|
||||
17: [smi_api.amdsmi_get_gpu_memory_reserved_pages, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
18: [amdsmi_tool_dev_fan_rpms_get, {
|
||||
@@ -792,29 +787,29 @@ commands = {
|
||||
22: [amdsmi_tool_dev_volt_metric_get, {
|
||||
"device_identifier1": [None, True],
|
||||
}],
|
||||
23: [smi_api.amdsmi_dev_get_busy_percent, {
|
||||
23: [smi_api.amdsmi_get_busy_percent, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
24: [amdsmi_tool_utilization_count_get, {
|
||||
"device_identifier1": [None, True],
|
||||
}],
|
||||
25: [smi_api.amdsmi_dev_get_perf_level, {
|
||||
25: [smi_api.amdsmi_get_gpu_perf_level, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
26: [amdsmi_tool_perf_determinism_mode_set, {
|
||||
"device_identifier1": [None, True],
|
||||
"clock_value": [int, True]
|
||||
}],
|
||||
27: [smi_api.amdsmi_dev_get_overdrive_level, {
|
||||
27: [smi_api.amdsmi_get_gpu_overdrive_level, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
28: [amdsmi_tool_dev_gpu_clk_freq_get, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
29: [smi_api. amdsmi_dev_get_od_volt_info, {
|
||||
29: [smi_api. amdsmi_get_gpu_od_volt_info, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
30: [smi_api. amdsmi_dev_get_gpu_metrics_info, {
|
||||
30: [smi_api. amdsmi_get_gpu_metrics_info, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
31: [amdsmi_tool_dev_od_volt_curve_regions_get, {
|
||||
@@ -830,7 +825,7 @@ commands = {
|
||||
35: [amdsmi_tool_dev_ecc_count_get, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
36: [smi_api. amdsmi_dev_get_ecc_enabled, {
|
||||
36: [smi_api. amdsmi_get_gpu_ecc_enabled, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
37: [amdsmi_tool_dev_ecc_status_get, {
|
||||
@@ -839,17 +834,17 @@ commands = {
|
||||
38: [amdsmi_tool_status_string, {
|
||||
"status": [int, True]
|
||||
}],
|
||||
39: [smi_api.amdsmi_get_compute_process_info, {}],
|
||||
39: [smi_api.amdsmi_get_gpu_compute_process_info, {}],
|
||||
40: [amdsmi_tool_compute_process_info_by_pid_get, {
|
||||
"pid": [int, True]
|
||||
}],
|
||||
41: [amdsmi_tool_compute_process_gpus_get, {
|
||||
"pid": [int, True]
|
||||
}],
|
||||
42: [smi_api.amdsmi_dev_xgmi_error_status, {
|
||||
42: [smi_api.amdsmi_gpu_xgmi_error_status, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
43: [smi_api.amdsmi_dev_reset_xgmi_error, {
|
||||
43: [smi_api.amdsmi_reset_gpu_xgmi_error, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
44: [smi_api.amdsmi_topo_get_numa_node_number, {
|
||||
@@ -871,10 +866,10 @@ commands = {
|
||||
"device_identifier1": [None, True],
|
||||
"device_identifier2": [None, True]
|
||||
}],
|
||||
49: [smi_api.amdsmi_get_asic_info, {
|
||||
49: [smi_api.amdsmi_get_gpu_asic_info, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
50: [smi_api.amdsmi_get_device_handles, {}],
|
||||
50: [smi_api.amdsmi_get_processor_handles, {}],
|
||||
51: [amdsmi_tool_event_notification_get, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
@@ -893,7 +888,7 @@ commands = {
|
||||
57: [smi_api.amdsmi_get_fw_info, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
58: [smi_api.amdsmi_get_vbios_info, {
|
||||
58: [smi_api.amdsmi_get_gpu_vbios_info, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
59: [amdsmi_tool_counter_available_counters_get, {
|
||||
@@ -926,7 +921,7 @@ commands = {
|
||||
"device_identifier1": [None, True],
|
||||
"freq_bitmask": [int, True]
|
||||
}],
|
||||
67: [smi_api.amdsmi_dev_reset_gpu, {
|
||||
67: [smi_api.amdsmi_reset_gpu, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
68: [amdsmi_tool_dev_od_clk_info_set, {
|
||||
@@ -969,7 +964,7 @@ commands = {
|
||||
77: [amdsmi_tool_dev_supported_func_iterator_close, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
78: [smi_api.amdsmi_dev_open_supported_func_iterator, {
|
||||
78: [smi_api.amdsmi_open_supported_func_iterator, {
|
||||
"device_identifier1": [None, True]
|
||||
}],
|
||||
79: [amdsmi_tool_func_iter_next, {
|
||||
@@ -994,22 +989,22 @@ if __name__ == "__main__":
|
||||
smi_api.amdsmi_init()
|
||||
|
||||
command = parser.get_command_handle()
|
||||
device_handles = parser.get_device_handle()
|
||||
processor_handles = parser.get_processor_handle()
|
||||
command_args = parser.get_command_args()
|
||||
result = None
|
||||
|
||||
if not device_handles and not command_args:
|
||||
if not processor_handles and not command_args:
|
||||
result = command()
|
||||
elif not device_handles and command_args:
|
||||
elif not processor_handles and command_args:
|
||||
result = command(command_args)
|
||||
elif len(device_handles) == 1 and not command_args:
|
||||
result = command(device_handles[0])
|
||||
elif len(device_handles) > 1 and not command_args:
|
||||
result = command(device_handles)
|
||||
elif len(device_handles) == 1 and command_args:
|
||||
result = command(device_handles[0], command_args)
|
||||
elif len(processor_handles) == 1 and not command_args:
|
||||
result = command(processor_handles[0])
|
||||
elif len(processor_handles) > 1 and not command_args:
|
||||
result = command(processor_handles)
|
||||
elif len(processor_handles) == 1 and command_args:
|
||||
result = command(processor_handles[0], command_args)
|
||||
else:
|
||||
result = command(device_handles, command_args)
|
||||
result = command(processor_handles, command_args)
|
||||
|
||||
formatter.print_output(result)
|
||||
|
||||
|
||||
@@ -198,6 +198,10 @@ class ScopedAcquire {
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedAcquire);
|
||||
};
|
||||
|
||||
// The best effort way to decide whether it is in VM guest environment:
|
||||
// In VM environment, the /proc/cpuinfo set hypervisor flag by default
|
||||
bool is_vm_guest();
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
@@ -850,6 +850,11 @@ rsmi_dev_overdrive_level_get(uint32_t dv_ind, uint32_t *od) {
|
||||
CHK_SUPPORT_NAME_ONLY(od)
|
||||
DEVICE_MUTEX
|
||||
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
rsmi_status_t ret = get_dev_value_str(amd::smi::kDevOverDriveLevel, dv_ind,
|
||||
&val_str);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
@@ -886,6 +891,12 @@ rsmi_dev_overdrive_level_set_v1(uint32_t dv_ind, uint32_t od) {
|
||||
if (od > kMaxOverdriveLevel) {
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
DEVICE_MUTEX
|
||||
return set_dev_value(amd::smi::kDevOverDriveLevel, dv_ind, od);
|
||||
CATCH
|
||||
@@ -905,6 +916,11 @@ rsmi_dev_perf_level_set_v1(uint32_t dv_ind, rsmi_dev_perf_level_t perf_level) {
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
DEVICE_MUTEX
|
||||
return set_dev_value(amd::smi::kDevPerfLevel, dv_ind, perf_level);
|
||||
CATCH
|
||||
@@ -992,6 +1008,10 @@ static rsmi_status_t get_power_profiles(uint32_t dv_ind,
|
||||
}
|
||||
assert(val_vec.size() <= RSMI_MAX_NUM_POWER_PROFILES);
|
||||
if (val_vec.size() > RSMI_MAX_NUM_POWER_PROFILES + 1 || val_vec.size() < 1) {
|
||||
// Guest may not have power related information.
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
return RSMI_STATUS_UNEXPECTED_SIZE;
|
||||
}
|
||||
// -1 for the header line, below
|
||||
@@ -1177,6 +1197,11 @@ rsmi_status_t rsmi_dev_clk_range_set(uint32_t dv_ind, uint64_t minclkvalue,
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// Can only set the clock type for sys and mem type
|
||||
if (clkType != RSMI_CLK_TYPE_SYS && clkType != RSMI_CLK_TYPE_MEM) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
@@ -1601,6 +1626,11 @@ rsmi_dev_gpu_clk_freq_set(uint32_t dv_ind,
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_gpu_clk_freq_get(dv_ind, clk_type, &freqs);
|
||||
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
@@ -2058,6 +2088,10 @@ rsmi_dev_pci_bandwidth_set(uint32_t dv_ind, uint64_t bw_bitmask) {
|
||||
TRY
|
||||
REQUIRE_ROOT_ACCESS
|
||||
DEVICE_MUTEX
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
ret = rsmi_dev_pci_bandwidth_get(dv_ind, &bws);
|
||||
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
@@ -2369,6 +2403,11 @@ rsmi_dev_fan_speed_set(uint32_t dv_ind, uint32_t sensor_ind, uint64_t speed) {
|
||||
REQUIRE_ROOT_ACCESS
|
||||
DEVICE_MUTEX
|
||||
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_fan_speed_max_get(dv_ind, sensor_ind, &max_speed);
|
||||
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
@@ -2580,6 +2619,11 @@ rsmi_dev_power_cap_set(uint32_t dv_ind, uint32_t sensor_ind, uint64_t cap) {
|
||||
REQUIRE_ROOT_ACCESS
|
||||
DEVICE_MUTEX
|
||||
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_power_cap_range_get(dv_ind, sensor_ind, &max, &min);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return ret;
|
||||
@@ -2622,6 +2666,10 @@ rsmi_dev_power_profile_set(uint32_t dv_ind, uint32_t dummy,
|
||||
|
||||
(void)dummy;
|
||||
DEVICE_MUTEX
|
||||
// Bare Metal only feature
|
||||
if (amd::smi::is_vm_guest()) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
rsmi_status_t ret = set_power_profile(dv_ind, profile);
|
||||
return ret;
|
||||
CATCH
|
||||
|
||||
@@ -234,5 +234,24 @@ rsmi_status_t ErrnoToRsmiStatus(int err) {
|
||||
}
|
||||
}
|
||||
|
||||
bool is_vm_guest() {
|
||||
// the cpuinfo will set hypervisor flag in VM guest
|
||||
const std::string hypervisor = "hypervisor";
|
||||
std::string line;
|
||||
|
||||
// default to false if cannot find the file
|
||||
std::ifstream infile("/proc/cpuinfo");
|
||||
if (infile.fail()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (std::getline(infile, line)) {
|
||||
if (line.find(hypervisor) != std::string::npos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
@@ -41,7 +41,7 @@ set(SRC_LIST
|
||||
set(INC_LIST
|
||||
"${INC_DIR}/amdsmi.h"
|
||||
"${INC_DIR}/impl/amd_smi_common.h"
|
||||
"${INC_DIR}/impl/amd_smi_device.h"
|
||||
"${INC_DIR}/impl/amd_smi_processor.h"
|
||||
"${INC_DIR}/impl/amd_smi_drm.h"
|
||||
"${INC_DIR}/impl/amd_smi_gpu_device.h"
|
||||
"${INC_DIR}/impl/amd_smi_lib_loader.h"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -49,14 +49,14 @@ namespace amd {
|
||||
namespace smi {
|
||||
|
||||
AMDSmiSocket::~AMDSmiSocket() {
|
||||
for (uint32_t i = 0; i < devices_.size(); i++) {
|
||||
delete devices_[i];
|
||||
for (uint32_t i = 0; i < processors_.size(); i++) {
|
||||
delete processors_[i];
|
||||
}
|
||||
devices_.clear();
|
||||
processors_.clear();
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSocket::get_device_count(uint32_t* device_count) const {
|
||||
*device_count = static_cast<uint32_t>(devices_.size());
|
||||
amdsmi_status_t AMDSmiSocket::get_processor_count(uint32_t* processor_count) const {
|
||||
*processor_count = static_cast<uint32_t>(processors_.size());
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace smi {
|
||||
amdsmi_status_t AMDSmiSystem::init(uint64_t flags) {
|
||||
init_flag_ = flags;
|
||||
amdsmi_status_t amd_smi_status;
|
||||
// populate sockets and devices
|
||||
// populate sockets and processors
|
||||
if (flags & AMDSMI_INIT_AMD_GPUS) {
|
||||
amd_smi_status = populate_amd_gpu_devices();
|
||||
if (amd_smi_status != AMDSMI_STATUS_SUCCESS)
|
||||
@@ -104,9 +104,9 @@ amdsmi_status_t AMDSmiSystem::populate_amd_gpu_devices() {
|
||||
sockets_.push_back(socket);
|
||||
}
|
||||
|
||||
AMDSmiDevice* device = new AMDSmiGPUDevice(i, drm_);
|
||||
socket->add_device(device);
|
||||
devices_.insert(device);
|
||||
AMDSmiProcessor* device = new AMDSmiGPUDevice(i, drm_);
|
||||
socket->add_processor(device);
|
||||
processors_.insert(device);
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ amdsmi_status_t AMDSmiSystem::cleanup() {
|
||||
for (uint32_t i = 0; i < sockets_.size(); i++) {
|
||||
delete sockets_[i];
|
||||
}
|
||||
devices_.clear();
|
||||
processors_.clear();
|
||||
sockets_.clear();
|
||||
init_flag_ = AMDSMI_INIT_ALL_DEVICES;
|
||||
rsmi_status_t ret = rsmi_shut_down();
|
||||
@@ -164,37 +164,37 @@ amdsmi_status_t AMDSmiSystem::handle_to_socket(
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::handle_to_device(
|
||||
amdsmi_device_handle device_handle,
|
||||
AMDSmiDevice** device) {
|
||||
if (device_handle == nullptr || device == nullptr) {
|
||||
amdsmi_status_t AMDSmiSystem::handle_to_processor(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
AMDSmiProcessor** processor) {
|
||||
if (processor_handle == nullptr || processor == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
*device = static_cast<AMDSmiDevice*>(device_handle);
|
||||
*processor = static_cast<AMDSmiProcessor*>(processor_handle);
|
||||
|
||||
// double check handlers is here
|
||||
if (std::find(devices_.begin(), devices_.end(), *device)
|
||||
!= devices_.end()) {
|
||||
if (std::find(processors_.begin(), processors_.end(), *processor)
|
||||
!= processors_.end()) {
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
return AMDSMI_STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::gpu_index_to_handle(uint32_t gpu_index,
|
||||
amdsmi_device_handle* device_handle) {
|
||||
if (device_handle == nullptr)
|
||||
amdsmi_processor_handle* processor_handle) {
|
||||
if (processor_handle == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
auto iter = devices_.begin();
|
||||
for (; iter != devices_.end(); iter++) {
|
||||
auto iter = processors_.begin();
|
||||
for (; iter != processors_.end(); iter++) {
|
||||
auto cur_device = (*iter);
|
||||
if (cur_device->get_device_type() != AMD_GPU)
|
||||
if (cur_device->get_processor_type() != AMD_GPU)
|
||||
continue;
|
||||
amd::smi::AMDSmiGPUDevice* gpu_device =
|
||||
static_cast<amd::smi::AMDSmiGPUDevice*>(cur_device);
|
||||
uint32_t cur_gpu_index = gpu_device->get_gpu_id();
|
||||
if (gpu_index == cur_gpu_index) {
|
||||
*device_handle = cur_device;
|
||||
*processor_handle = cur_device;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,76 +149,71 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid,
|
||||
std::string file = path + dir->d_name;
|
||||
std::ifstream fdinfo(file.c_str());
|
||||
|
||||
for (std::string line; getline(fdinfo, line);) {
|
||||
if (line.find("pasid:") != std::string::npos) {
|
||||
int pasid;
|
||||
for (std::string bdfline; getline(fdinfo, bdfline);) {
|
||||
if (bdfline.find("drm-pdev:") != std::string::npos) {
|
||||
char fd_bdf_str[13];
|
||||
|
||||
if (sscanf(line.c_str(), "pasid: %d", &pasid) != 1)
|
||||
/* Only check against fdinfo files that contain a bdf */
|
||||
if (sscanf(bdfline.c_str(), "drm-pdev: %s", &fd_bdf_str) != 1)
|
||||
continue;
|
||||
|
||||
auto it = std::find(pasids.begin(), pasids.end(), pasid);
|
||||
/* Populate amdsmi_proc_info_t struct only if the bdf in
|
||||
* the fdinfo file matches the passed bdf */
|
||||
if (strncmp(bdf_str, fd_bdf_str, 13) == 0){
|
||||
std::ifstream fdinfo(file.c_str());
|
||||
|
||||
if (it == pasids.end())
|
||||
pasids.push_back(pasid);
|
||||
} else if (line.find("drm-memory-gtt:") != std::string::npos) {
|
||||
unsigned long mem;
|
||||
for (std::string line; getline(fdinfo, line);) {
|
||||
if (line.find("pasid:") != std::string::npos) {
|
||||
int pasid;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-memory-gtt: %lu", &mem) != 1)
|
||||
continue;
|
||||
if (sscanf(line.c_str(), "pasid: %d", &pasid) != 1)
|
||||
continue;
|
||||
|
||||
info.mem += mem * 1024;
|
||||
info.memory_usage.gtt_mem += mem * 1024;
|
||||
} else if (line.find("drm-memory-cpu:") != std::string::npos) {
|
||||
unsigned long mem;
|
||||
auto it = std::find(pasids.begin(), pasids.end(), pasid);
|
||||
|
||||
if (sscanf(line.c_str(), "drm-memory-cpu: %lu", &mem) != 1)
|
||||
continue;
|
||||
if (it == pasids.end())
|
||||
pasids.push_back(pasid);
|
||||
} else if (line.find("drm-memory-gtt:") != std::string::npos) {
|
||||
unsigned long mem;
|
||||
|
||||
info.mem += mem * 1024;
|
||||
info.memory_usage.cpu_mem += mem * 1024;
|
||||
} else if (line.find("drm-memory-vram:") != std::string::npos) {
|
||||
unsigned long mem;
|
||||
if (sscanf(line.c_str(), "drm-memory-gtt: %lu", &mem) != 1)
|
||||
continue;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-memory-vram: %lu", &mem) != 1)
|
||||
continue;
|
||||
info.mem += mem * 1024;
|
||||
info.memory_usage.gtt_mem += mem * 1024;
|
||||
} else if (line.find("drm-memory-cpu:") != std::string::npos) {
|
||||
unsigned long mem;
|
||||
|
||||
info.mem += mem * 1024;
|
||||
info.memory_usage.vram_mem += mem * 1024;
|
||||
} else if (line.find("drm-engine-gfx") != std::string::npos) {
|
||||
uint64_t engine_gfx;
|
||||
if (sscanf(line.c_str(), "drm-memory-cpu: %lu", &mem) != 1)
|
||||
continue;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-engine-gfx: %lu", &engine_gfx) != 1)
|
||||
continue;
|
||||
info.mem += mem * 1024;
|
||||
info.memory_usage.cpu_mem += mem * 1024;
|
||||
} else if (line.find("drm-memory-vram:") != std::string::npos) {
|
||||
unsigned long mem;
|
||||
|
||||
info.engine_usage.gfx = engine_gfx;
|
||||
} else if (line.find("drm-engine-compute") != std::string::npos) {
|
||||
uint64_t engine_compute;
|
||||
if (sscanf(line.c_str(), "drm-memory-vram: %lu", &mem) != 1)
|
||||
continue;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-engine-compute: %lu", &engine_compute) != 1)
|
||||
continue;
|
||||
info.mem += mem * 1024;
|
||||
info.memory_usage.vram_mem += mem * 1024;
|
||||
} else if (line.find("drm-engine-gfx") != std::string::npos) {
|
||||
uint64_t engine_gfx;
|
||||
|
||||
info.engine_usage.compute = engine_compute;
|
||||
} else if (line.find("drm-engine-dma") != std::string::npos) {
|
||||
uint64_t engine_dma;
|
||||
if (sscanf(line.c_str(), "drm-engine-gfx: %lu", &engine_gfx) != 1)
|
||||
continue;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-engine-dma: %lu", &engine_dma) != 1)
|
||||
continue;
|
||||
info.engine_usage.gfx = engine_gfx;
|
||||
} else if (line.find("drm-engine-enc") != std::string::npos) {
|
||||
uint64_t engine_enc;
|
||||
|
||||
info.engine_usage.dma = engine_dma;
|
||||
} else if (line.find("drm-engine-enc") != std::string::npos) {
|
||||
uint64_t engine_enc;
|
||||
if (sscanf(line.c_str(), "drm-engine-enc: %lu", &engine_enc) != 1)
|
||||
continue;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-engine-enc: %lu", &engine_enc) != 1)
|
||||
continue;
|
||||
|
||||
info.engine_usage.enc = engine_enc;
|
||||
} else if (line.find("drm-engine-dec") != std::string::npos) {
|
||||
uint64_t engine_dec;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-engine-dec: %lu", &engine_dec) != 1)
|
||||
continue;
|
||||
|
||||
info.engine_usage.dec = engine_dec;
|
||||
info.engine_usage.enc = engine_enc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,3 +70,8 @@ install(
|
||||
TARGETS ${TEST} gtest gtest_main
|
||||
DESTINATION ${SHARE_INSTALL_PREFIX}/tests
|
||||
COMPONENT tests)
|
||||
|
||||
install(
|
||||
FILES amdsmitst.exclude
|
||||
DESTINATION ${SHARE_INSTALL_PREFIX}/tests
|
||||
COMPONENT tests)
|
||||
|
||||
@@ -102,11 +102,11 @@ void TestAPISupportRead::Run(void) {
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
std::cout << "Supported AMDSMI Functions:" << std::endl;
|
||||
std::cout << "\tVariants (Monitors)" << std::endl;
|
||||
}
|
||||
err = amdsmi_dev_open_supported_func_iterator(device_handles_[i], &iter_handle);
|
||||
err = amdsmi_open_supported_func_iterator(processor_handles_[i], &iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
while (1) {
|
||||
@@ -115,7 +115,7 @@ void TestAPISupportRead::Run(void) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Function Name: " << value.name << std::endl;
|
||||
}
|
||||
err = amdsmi_dev_open_supported_variant_iterator(iter_handle, &var_iter);
|
||||
err = amdsmi_open_supported_variant_iterator(iter_handle, &var_iter);
|
||||
if (err != AMDSMI_STATUS_NO_DATA) {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -133,7 +133,7 @@ void TestAPISupportRead::Run(void) {
|
||||
std::cout << " (";
|
||||
}
|
||||
err =
|
||||
amdsmi_dev_open_supported_variant_iterator(var_iter, &sub_var_iter);
|
||||
amdsmi_open_supported_variant_iterator(var_iter, &sub_var_iter);
|
||||
if (err != AMDSMI_STATUS_NO_DATA) {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
@@ -150,7 +150,7 @@ void TestAPISupportRead::Run(void) {
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
err = amdsmi_dev_close_supported_func_iterator(&sub_var_iter);
|
||||
err = amdsmi_close_supported_func_iterator(&sub_var_iter);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void TestAPISupportRead::Run(void) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
err = amdsmi_dev_close_supported_func_iterator(&var_iter);
|
||||
err = amdsmi_close_supported_func_iterator(&var_iter);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
@@ -178,10 +178,10 @@ void TestAPISupportRead::Run(void) {
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// err = amdsmi_dev_open_supported_variant_iterator(iter_handle, &var_iter);
|
||||
// err = amdsmi_open_supported_variant_iterator(iter_handle, &var_iter);
|
||||
//
|
||||
}
|
||||
err = amdsmi_dev_close_supported_func_iterator(&iter_handle);
|
||||
err = amdsmi_close_supported_func_iterator(&iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ void TestErrCntRead::Run(void) {
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_get_ecc_enabled(device_handles_[i], &enabled_mask);
|
||||
err = amdsmi_get_gpu_ecc_enabled(processor_handles_[i], &enabled_mask);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
@@ -108,7 +108,7 @@ void TestErrCntRead::Run(void) {
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_ecc_enabled(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_ecc_enabled(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
continue;
|
||||
@@ -116,7 +116,7 @@ void TestErrCntRead::Run(void) {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_ecc_enabled(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_ecc_enabled(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -126,7 +126,7 @@ void TestErrCntRead::Run(void) {
|
||||
}
|
||||
for (uint32_t b = AMDSMI_GPU_BLOCK_FIRST;
|
||||
b <= AMDSMI_GPU_BLOCK_LAST; b = b*2) {
|
||||
err = amdsmi_dev_get_ecc_status(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
err = amdsmi_get_gpu_ecc_status(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
&err_state);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -135,11 +135,11 @@ void TestErrCntRead::Run(void) {
|
||||
" block: " << GetErrStateNameStr(err_state) << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_ecc_status(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
err = amdsmi_get_gpu_ecc_status(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b), &ec);
|
||||
err = amdsmi_get_gpu_ecc_count(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b), &ec);
|
||||
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -148,7 +148,7 @@ void TestErrCntRead::Run(void) {
|
||||
": Not supported for this device" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
err = amdsmi_get_gpu_ecc_count(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
@@ -164,7 +164,7 @@ void TestErrCntRead::Run(void) {
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
err = amdsmi_get_gpu_ecc_count(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ void TestEvtNotifReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
ret = amdsmi_init_event_notification(device_handles_[dv_ind]);
|
||||
ret = amdsmi_init_gpu_event_notification(processor_handles_[dv_ind]);
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
@@ -119,7 +119,7 @@ void TestEvtNotifReadWrite::Run(void) {
|
||||
return;
|
||||
}
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
|
||||
ret = amdsmi_set_event_notification_mask(device_handles_[dv_ind], mask);
|
||||
ret = amdsmi_set_gpu_event_notification_mask(processor_handles_[dv_ind], mask);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -127,13 +127,13 @@ void TestEvtNotifReadWrite::Run(void) {
|
||||
uint32_t num_elem = 10;
|
||||
bool read_again = false;
|
||||
|
||||
ret = amdsmi_get_event_notification(10000, &num_elem, data);
|
||||
ret = amdsmi_get_gpu_event_notification(10000, &num_elem, data);
|
||||
if (ret == AMDSMI_STATUS_SUCCESS || ret == AMDSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
EXPECT_LE(num_elem, 10) <<
|
||||
"Expected the number of elements found to be <= buffer size (10)";
|
||||
IF_VERB(STANDARD) {
|
||||
for (uint32_t i = 0; i < num_elem; ++i) {
|
||||
std::cout << "\tdv_handle=" << data[i].device_handle <<
|
||||
std::cout << "\tdv_handle=" << data[i].processor_handle <<
|
||||
" Type: " << NameFromEvtNotifType(data[i].event) <<
|
||||
" Mesg: " << data[i].message << std::endl;
|
||||
if (data[i].event == AMDSMI_EVT_NOTIF_GPU_PRE_RESET) {
|
||||
@@ -155,19 +155,19 @@ void TestEvtNotifReadWrite::Run(void) {
|
||||
} else {
|
||||
// This should always fail. We want to print out the return code.
|
||||
EXPECT_EQ(ret, AMDSMI_STATUS_SUCCESS) <<
|
||||
"Unexpected return code for amdsmi_get_event_notification()";
|
||||
"Unexpected return code for amdsmi_get_gpu_event_notification()";
|
||||
}
|
||||
|
||||
// In case GPU Pre reset event was collected in the previous read,
|
||||
// read again to get the GPU Post reset event.
|
||||
if (read_again) {
|
||||
ret = amdsmi_get_event_notification(10000, &num_elem, data);
|
||||
ret = amdsmi_get_gpu_event_notification(10000, &num_elem, data);
|
||||
if (ret == AMDSMI_STATUS_SUCCESS || ret == AMDSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
EXPECT_LE(num_elem, 10) <<
|
||||
"Expected the number of elements found to be <= buffer size (10)";
|
||||
IF_VERB(STANDARD) {
|
||||
for (uint32_t i = 0; i < num_elem; ++i) {
|
||||
std::cout << "\tdv_handle=" << data[i].device_handle <<
|
||||
std::cout << "\tdv_handle=" << data[i].processor_handle <<
|
||||
" Type: " << NameFromEvtNotifType(data[i].event) <<
|
||||
" Mesg: " << data[i].message << std::endl;
|
||||
}
|
||||
@@ -186,12 +186,12 @@ void TestEvtNotifReadWrite::Run(void) {
|
||||
} else {
|
||||
// This should always fail. We want to print out the return code.
|
||||
EXPECT_EQ(ret, AMDSMI_STATUS_SUCCESS) <<
|
||||
"Unexpected return code for amdsmi_get_event_notification()";
|
||||
"Unexpected return code for amdsmi_get_gpu_event_notification()";
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
ret = amdsmi_stop_event_notification(device_handles_[dv_ind]);
|
||||
ret = amdsmi_stop_gpu_event_notification(processor_handles_[dv_ind]);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,12 +96,12 @@ void TestFanRead::Run(void) {
|
||||
}
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Fan Speed: ";
|
||||
}
|
||||
err = amdsmi_dev_get_fan_speed(device_handles_[i], 0, &val_i64);
|
||||
err = amdsmi_get_gpu_fan_speed(processor_handles_[i], 0, &val_i64);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << ": " <<
|
||||
@@ -114,30 +114,30 @@ void TestFanRead::Run(void) {
|
||||
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_fan_speed(device_handles_[i], 0, nullptr);
|
||||
err = amdsmi_get_gpu_fan_speed(processor_handles_[i], 0, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
err = amdsmi_dev_get_fan_speed_max(device_handles_[i], 0, &val_ui64);
|
||||
err = amdsmi_get_gpu_fan_speed_max(processor_handles_[i], 0, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << val_i64/static_cast<float>(val_ui64)*100;
|
||||
std::cout << "% ("<< val_i64 << "/" << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_fan_speed_max(device_handles_[i], 0, nullptr);
|
||||
err = amdsmi_get_gpu_fan_speed_max(processor_handles_[i], 0, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current fan RPMs: ";
|
||||
}
|
||||
err = amdsmi_dev_get_fan_rpms(device_handles_[i], 0, &val_i64);
|
||||
err = amdsmi_get_gpu_fan_rpms(processor_handles_[i], 0, &val_i64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << val_i64 << std::endl;
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_fan_rpms(device_handles_[i], 0, nullptr);
|
||||
err = amdsmi_get_gpu_fan_rpms(processor_handles_[i], 0, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ void TestFanReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
PrintDeviceHeader(processor_handles_[dv_ind]);
|
||||
|
||||
ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &orig_speed);
|
||||
ret = amdsmi_get_gpu_fan_speed(processor_handles_[dv_ind], 0, &orig_speed);
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << ": " <<
|
||||
@@ -120,7 +120,7 @@ void TestFanReadWrite::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_get_fan_speed_max(device_handles_[dv_ind], 0, &max_speed);
|
||||
ret = amdsmi_get_gpu_fan_speed_max(processor_handles_[dv_ind], 0, &max_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
new_speed = 1.1 * orig_speed;
|
||||
@@ -136,12 +136,12 @@ void TestFanReadWrite::Run(void) {
|
||||
std::cout << "Setting fan speed to " << new_speed << std::endl;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_set_fan_speed(device_handles_[dv_ind], 0, new_speed);
|
||||
ret = amdsmi_set_gpu_fan_speed(processor_handles_[dv_ind], 0, new_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
sleep(4);
|
||||
|
||||
ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &cur_speed);
|
||||
ret = amdsmi_get_gpu_fan_speed(processor_handles_[dv_ind], 0, &cur_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -163,12 +163,12 @@ void TestFanReadWrite::Run(void) {
|
||||
std::cout << "Resetting fan control to auto..." << std::endl;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_reset_fan(device_handles_[dv_ind], 0);
|
||||
ret = amdsmi_reset_gpu_fan(processor_handles_[dv_ind], 0);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
sleep(3);
|
||||
|
||||
ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &cur_speed);
|
||||
ret = amdsmi_get_gpu_fan_speed(processor_handles_[dv_ind], 0, &cur_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
|
||||
@@ -116,12 +116,12 @@ void TestFrequenciesRead::Run(void) {
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
auto freq_output = [&](amdsmi_clk_type_t t, const char *name) {
|
||||
err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, &f);
|
||||
err = amdsmi_get_clk_freq(processor_handles_[i], t, &f);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get " << name <<
|
||||
": Not supported on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, nullptr);
|
||||
err = amdsmi_get_clk_freq(processor_handles_[i], t, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
} else if (err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) {
|
||||
std::cout << "\t**Get " << name <<
|
||||
@@ -133,13 +133,13 @@ void TestFrequenciesRead::Run(void) {
|
||||
std::cout << f.num_supported << std::endl;
|
||||
print_frequencies(&f);
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, nullptr);
|
||||
err = amdsmi_get_clk_freq(processor_handles_[i], t, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
freq_output(CLK_TYPE_MEM, "Supported GPU Memory");
|
||||
freq_output(CLK_TYPE_SYS, "Supported GPU");
|
||||
@@ -147,12 +147,12 @@ void TestFrequenciesRead::Run(void) {
|
||||
freq_output(CLK_TYPE_DCEF, "Display Controller Engine Clock");
|
||||
freq_output(CLK_TYPE_SOC, "SOC Clock");
|
||||
|
||||
err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], &b);
|
||||
err = amdsmi_get_gpu_pci_bandwidth(processor_handles_[i], &b);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get PCIE Bandwidth: Not supported on this machine"
|
||||
<< std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_pci_bandwidth(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else if (err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) {
|
||||
std::cout << "\t**Get PCIE Bandwidth "
|
||||
@@ -164,7 +164,7 @@ void TestFrequenciesRead::Run(void) {
|
||||
std::cout << b.transfer_rate.num_supported << std::endl;
|
||||
print_frequencies(&b.transfer_rate, b.lanes);
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_pci_bandwidth(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ void TestFrequenciesReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
PrintDeviceHeader(processor_handles_[dv_ind]);
|
||||
|
||||
for (uint32_t clk = (uint32_t)CLK_TYPE_FIRST;
|
||||
clk <= CLK_TYPE__MAX; ++clk) {
|
||||
@@ -113,7 +113,7 @@ void TestFrequenciesReadWrite::Run(void) {
|
||||
std::cout << amdsmi_clk << std::endl;
|
||||
if (amdsmi_clk == CLK_TYPE_PCIE)
|
||||
return false;
|
||||
ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[dv_ind], amdsmi_clk, &f);
|
||||
ret = amdsmi_get_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f);
|
||||
std::cout << ret << std::endl;
|
||||
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED ||
|
||||
@@ -151,7 +151,7 @@ void TestFrequenciesReadWrite::Run(void) {
|
||||
FreqEnumToStr(amdsmi_clk) << " to 0b" << freq_bm_str << " ..." <<
|
||||
std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_clk_freq(device_handles_[dv_ind], amdsmi_clk, freq_bitmask);
|
||||
ret = amdsmi_set_clk_freq(processor_handles_[dv_ind], amdsmi_clk, freq_bitmask);
|
||||
//Certain ASICs does not allow to set particular clocks. If set function for a clock returns
|
||||
//permission error despite root access, manually set ret value to success and return
|
||||
if (ret == AMDSMI_STATUS_NO_PERM && geteuid() == 0) {
|
||||
@@ -166,7 +166,7 @@ void TestFrequenciesReadWrite::Run(void) {
|
||||
return;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[dv_ind], amdsmi_clk, &f);
|
||||
ret = amdsmi_get_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
@@ -175,12 +175,12 @@ void TestFrequenciesReadWrite::Run(void) {
|
||||
std::cout << "Frequency is now index " << f.current << std::endl;
|
||||
std::cout << "Resetting mask to all frequencies." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_clk_freq(device_handles_[dv_ind], amdsmi_clk, 0xFFFFFFFF);
|
||||
ret = amdsmi_set_clk_freq(processor_handles_[dv_ind], amdsmi_clk, 0xFFFFFFFF);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ void TestFrequenciesReadWrite::Run(void) {
|
||||
freq_write();
|
||||
CHK_ERR_ASRT(ret)
|
||||
#if 0
|
||||
ret = amdsmi_dev_get_gpu_clk_freq(dv_ind, amdsmi_clk, &f);
|
||||
ret = amdsmi_get_clk_freq(dv_ind, amdsmi_clk, &f);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -215,20 +215,20 @@ void TestFrequenciesReadWrite::Run(void) {
|
||||
std::cout << "Setting frequency mask for clock " << amdsmi_clk <<
|
||||
" to 0b" << freq_bm_str << " ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_clk_freq(dv_ind, amdsmi_clk, freq_bitmask);
|
||||
ret = amdsmi_set_clk_freq(dv_ind, amdsmi_clk, freq_bitmask);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_get_gpu_clk_freq(dv_ind, amdsmi_clk, &f);
|
||||
ret = amdsmi_get_clk_freq(dv_ind, amdsmi_clk, &f);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Frequency is now index " << f.current << std::endl;
|
||||
std::cout << "Resetting mask to all frequencies." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_clk_freq(dv_ind, amdsmi_clk, 0xFFFFFFFF);
|
||||
ret = amdsmi_set_clk_freq(dv_ind, amdsmi_clk, 0xFFFFFFFF);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_set_perf_level(dv_ind, AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
ret = amdsmi_set_gpu_perf_level(dv_ind, AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ void TestGPUBusyRead::Run(void) {
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_get_busy_percent(device_handles_[i], &val_ui32);
|
||||
err = amdsmi_get_busy_percent(processor_handles_[i], &val_ui32);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
|
||||
@@ -97,13 +97,13 @@ void TestGpuMetricsRead::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU METRICS:\n";
|
||||
}
|
||||
amdsmi_gpu_metrics_t smu;
|
||||
err = amdsmi_dev_get_gpu_metrics_info(device_handles_[i], &smu);
|
||||
err = amdsmi_get_gpu_metrics_info(processor_handles_[i], &smu);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -188,7 +188,7 @@ void TestGpuMetricsRead::Run(void) {
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_gpu_metrics_info(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_metrics_info(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ void TestHWTopologyRead::Run(void) {
|
||||
std::vector<uint32_t> numa_numbers(num_devices);
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_devices; ++dv_ind) {
|
||||
amdsmi_device_handle dev_handle = device_handles_[dv_ind];
|
||||
amdsmi_processor_handle dev_handle = processor_handles_[dv_ind];
|
||||
err = amdsmi_topo_get_numa_node_number(dev_handle, &numa_numbers[dv_ind]);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -138,8 +138,8 @@ void TestHWTopologyRead::Run(void) {
|
||||
gpu_links[dv_ind_src][dv_ind_dst].accessible = true;
|
||||
} else {
|
||||
AMDSMI_IO_LINK_TYPE type;
|
||||
err = amdsmi_topo_get_link_type(device_handles_[dv_ind_src],
|
||||
device_handles_[dv_ind_dst],
|
||||
err = amdsmi_topo_get_link_type(processor_handles_[dv_ind_src],
|
||||
processor_handles_[dv_ind_dst],
|
||||
&gpu_links[dv_ind_src][dv_ind_dst].hops, &type);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -170,8 +170,8 @@ void TestHWTopologyRead::Run(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
err = amdsmi_topo_get_link_weight(device_handles_[dv_ind_src],
|
||||
device_handles_[dv_ind_dst],
|
||||
err = amdsmi_topo_get_link_weight(processor_handles_[dv_ind_src],
|
||||
processor_handles_[dv_ind_dst],
|
||||
&gpu_links[dv_ind_src][dv_ind_dst].weight);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -185,8 +185,8 @@ void TestHWTopologyRead::Run(void) {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
err = amdsmi_is_P2P_accessible(device_handles_[dv_ind_src],
|
||||
device_handles_[dv_ind_dst],
|
||||
err = amdsmi_is_P2P_accessible(processor_handles_[dv_ind_src],
|
||||
processor_handles_[dv_ind_dst],
|
||||
&gpu_links[dv_ind_src][dv_ind_dst].accessible);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
|
||||
@@ -105,11 +105,11 @@ void TestIdInfoRead::Run(void) {
|
||||
}
|
||||
|
||||
// Get the device ID, name, vendor ID and vendor name for the device
|
||||
err = amdsmi_dev_get_id(device_handles_[i], &id);
|
||||
err = amdsmi_get_gpu_id(processor_handles_[i], &id);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
amdsmi_status_t ret;
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_get_id(device_handles_[i], nullptr);
|
||||
ret = amdsmi_get_gpu_id(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -118,25 +118,25 @@ void TestIdInfoRead::Run(void) {
|
||||
std::cout << "\t**Device ID: 0x" << std::hex << id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_id(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_id(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
// vendor_id, unique_id
|
||||
amdsmi_asic_info_t asci_info;
|
||||
err = amdsmi_get_asic_info(device_handles_[0], &asci_info);
|
||||
err = amdsmi_get_gpu_asic_info(processor_handles_[0], &asci_info);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// device name, brand, serial_number
|
||||
amdsmi_board_info_t board_info;
|
||||
err = amdsmi_get_board_info(device_handles_[0], &board_info);
|
||||
err = amdsmi_get_gpu_board_info(processor_handles_[0], &board_info);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
err = amdsmi_dev_get_vram_vendor(device_handles_[i], buffer, kBufferLen);
|
||||
err = amdsmi_get_gpu_vram_vendor(processor_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Vram Vendor string not supported on this system." << std::endl;
|
||||
err = amdsmi_dev_get_vram_vendor(device_handles_[i], nullptr, kBufferLen);
|
||||
err = amdsmi_get_gpu_vram_vendor(processor_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -145,10 +145,10 @@ void TestIdInfoRead::Run(void) {
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_dev_get_drm_render_minor(device_handles_[i], &drm_render_minor);
|
||||
err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], &drm_render_minor);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_drm_render_minor(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -156,15 +156,15 @@ void TestIdInfoRead::Run(void) {
|
||||
std::cout << "\t**DRM Render Minor: " << drm_render_minor << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_drm_render_minor(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
err = amdsmi_dev_get_vendor_name(device_handles_[i], buffer, kBufferLen);
|
||||
err = amdsmi_get_gpu_vendor_name(processor_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Device Vendor name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen);
|
||||
err = amdsmi_get_gpu_vendor_name(processor_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -172,15 +172,15 @@ void TestIdInfoRead::Run(void) {
|
||||
std::cout << "\t**Device Vendor name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen);
|
||||
err = amdsmi_get_gpu_vendor_name(processor_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
// Get the device ID, name, vendor ID and vendor name for the sub-device
|
||||
err = amdsmi_dev_get_subsystem_id(device_handles_[i], &id);
|
||||
err = amdsmi_get_gpu_subsystem_id(processor_handles_[i], &id);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_subsystem_id(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_subsystem_id(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -188,15 +188,15 @@ void TestIdInfoRead::Run(void) {
|
||||
std::cout << "\t**Subsystem ID: 0x" << std::hex << id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_subsystem_id(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_subsystem_id(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
err = amdsmi_dev_get_subsystem_name(device_handles_[i], buffer, kBufferLen);
|
||||
err = amdsmi_get_gpu_subsystem_name(processor_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Subsystem name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_subsystem_name(device_handles_[i], nullptr, kBufferLen);
|
||||
err = amdsmi_get_gpu_subsystem_name(processor_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -204,7 +204,7 @@ void TestIdInfoRead::Run(void) {
|
||||
std::cout << "\t**Subsystem name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_subsystem_name(device_handles_[i], nullptr, kBufferLen);
|
||||
err = amdsmi_get_gpu_subsystem_name(processor_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
@@ -213,13 +213,13 @@ void TestIdInfoRead::Run(void) {
|
||||
asci_info.subvendor_id << std::endl;
|
||||
}
|
||||
|
||||
err = amdsmi_dev_get_vendor_name(device_handles_[i], buffer, kBufferLen);
|
||||
err = amdsmi_get_gpu_vendor_name(processor_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Subsystem Vendor name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen);
|
||||
err = amdsmi_get_gpu_vendor_name(processor_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -227,11 +227,11 @@ void TestIdInfoRead::Run(void) {
|
||||
std::cout << "\t**Subsystem Vendor name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen);
|
||||
err = amdsmi_get_gpu_vendor_name(processor_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
err = amdsmi_dev_get_pci_id(device_handles_[i], &val_ui64);
|
||||
err = amdsmi_get_gpu_pci_id(processor_handles_[i], &val_ui64);
|
||||
// Don't check for AMDSMI_STATUS_NOT_SUPPORTED since this should always be
|
||||
// supported. It is not based on a sysfs file.
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -240,7 +240,7 @@ void TestIdInfoRead::Run(void) {
|
||||
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_pci_id(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_pci_id(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@ void TestMemPageInfoRead::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], &num_pages, nullptr);
|
||||
err = amdsmi_get_gpu_memory_reserved_pages(processor_handles_[i], &num_pages, nullptr);
|
||||
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
@@ -104,7 +104,7 @@ void TestMemPageInfoRead::Run(void) {
|
||||
<< std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], nullptr, nullptr);
|
||||
err = amdsmi_get_gpu_memory_reserved_pages(processor_handles_[i], nullptr, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
@@ -115,7 +115,7 @@ void TestMemPageInfoRead::Run(void) {
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], nullptr, nullptr);
|
||||
err = amdsmi_get_gpu_memory_reserved_pages(processor_handles_[i], nullptr, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void TestMemPageInfoRead::Run(void) {
|
||||
|
||||
assert(records != nullptr);
|
||||
|
||||
err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], &num_pages, records);
|
||||
err = amdsmi_get_gpu_memory_reserved_pages(processor_handles_[i], &num_pages, records);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Getting Memory Page Retirement Status not "
|
||||
"supported for this device" << std::endl;
|
||||
|
||||
@@ -116,11 +116,11 @@ void TestMemUtilRead::Run(void) {
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
#if 0
|
||||
err = amdsmi_dev_get_memory_busy_percent(i, &mem_busy_percent);
|
||||
err_chk("amdsmi_dev_get_memory_busy_percent()");
|
||||
err = amdsmi_get_gpu_memory_busy_percent(i, &mem_busy_percent);
|
||||
err_chk("amdsmi_get_gpu_memory_busy_percent()");
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
@@ -131,16 +131,16 @@ void TestMemUtilRead::Run(void) {
|
||||
#endif
|
||||
for (uint32_t mem_type = AMDSMI_MEM_TYPE_FIRST;
|
||||
mem_type <= AMDSMI_MEM_TYPE_LAST; ++mem_type) {
|
||||
err = amdsmi_dev_get_memory_total(device_handles_[i],
|
||||
err = amdsmi_get_gpu_memory_total(processor_handles_[i],
|
||||
static_cast<amdsmi_memory_type_t>(mem_type), &total);
|
||||
err_chk("amdsmi_dev_get_memory_total()");
|
||||
err_chk("amdsmi_get_gpu_memory_total()");
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
err = amdsmi_dev_get_memory_usage(device_handles_[i],
|
||||
err = amdsmi_get_gpu_memory_usage(processor_handles_[i],
|
||||
static_cast<amdsmi_memory_type_t>(mem_type), &usage);
|
||||
err_chk("amdsmi_dev_get_memory_usage()");
|
||||
err_chk("amdsmi_get_gpu_memory_usage()");
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ void TestMetricsCounterRead::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU METRICS ENERGY COUNTER:\n";
|
||||
@@ -106,7 +106,7 @@ void TestMetricsCounterRead::Run(void) {
|
||||
uint64_t power;
|
||||
uint64_t timestamp;
|
||||
float counter_resolution;
|
||||
err = amdsmi_dev_get_energy_count(device_handles_[i], &power, &counter_resolution, ×tamp);
|
||||
err = amdsmi_get_energy_count(processor_handles_[i], &power, &counter_resolution, ×tamp);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -128,14 +128,14 @@ void TestMetricsCounterRead::Run(void) {
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_energy_count(device_handles_[i], nullptr, nullptr, nullptr);
|
||||
err = amdsmi_get_energy_count(processor_handles_[i], nullptr, nullptr, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
// Coarse Grain counters
|
||||
amdsmi_utilization_counter_t utilization_counters[2];
|
||||
utilization_counters[0].type = AMDSMI_COARSE_GRAIN_GFX_ACTIVITY;
|
||||
utilization_counters[1].type = AMDSMI_COARSE_GRAIN_MEM_ACTIVITY;
|
||||
err = amdsmi_get_utilization_count(device_handles_[i], utilization_counters,
|
||||
err = amdsmi_get_utilization_count(processor_handles_[i], utilization_counters,
|
||||
2, ×tamp);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -158,7 +158,7 @@ void TestMetricsCounterRead::Run(void) {
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_utilization_count(device_handles_[i], nullptr,
|
||||
err = amdsmi_get_utilization_count(processor_handles_[i], nullptr,
|
||||
1 , nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
} // end for
|
||||
|
||||
@@ -197,117 +197,116 @@ void TestMutualExclusion::Run(void) {
|
||||
std::cout << "at " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
} \
|
||||
}
|
||||
ret = amdsmi_dev_get_id(device_handles_[0], &dmy_ui16);
|
||||
ret = amdsmi_get_gpu_id(processor_handles_[0], &dmy_ui16);
|
||||
|
||||
// vendor_id, unique_id
|
||||
amdsmi_asic_info_t asci_info;
|
||||
ret = amdsmi_get_asic_info(device_handles_[0], &asci_info);
|
||||
ret = amdsmi_get_gpu_asic_info(processor_handles_[0], &asci_info);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
|
||||
// device name, brand, serial_number
|
||||
amdsmi_board_info_t board_info;
|
||||
ret = amdsmi_get_board_info(device_handles_[0], &board_info);
|
||||
ret = amdsmi_get_gpu_board_info(processor_handles_[0], &board_info);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
|
||||
ret = amdsmi_dev_get_vendor_name(device_handles_[0], dmy_str, 10);
|
||||
ret = amdsmi_get_gpu_vendor_name(processor_handles_[0], dmy_str, 10);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_vram_vendor(device_handles_[0], dmy_str, 10);
|
||||
ret = amdsmi_get_gpu_vram_vendor(processor_handles_[0], dmy_str, 10);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_subsystem_id(device_handles_[0], &dmy_ui16);
|
||||
ret = amdsmi_get_gpu_subsystem_id(processor_handles_[0], &dmy_ui16);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_pci_id(device_handles_[0], &dmy_ui64);
|
||||
ret = amdsmi_get_gpu_pci_id(processor_handles_[0], &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_pci_throughput(device_handles_[0], &dmy_ui64, &dmy_ui64, &dmy_ui64);
|
||||
ret = amdsmi_get_gpu_pci_throughput(processor_handles_[0], &dmy_ui64, &dmy_ui64, &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_pci_replay_counter(device_handles_[0], &dmy_ui64);
|
||||
ret = amdsmi_get_gpu_pci_replay_counter(processor_handles_[0], &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_set_pci_bandwidth(device_handles_[0], 0);
|
||||
ret = amdsmi_set_gpu_pci_bandwidth(processor_handles_[0], 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_fan_rpms(device_handles_[0], dmy_ui32, &dmy_i64);
|
||||
ret = amdsmi_get_gpu_fan_rpms(processor_handles_[0], dmy_ui32, &dmy_i64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_fan_speed(device_handles_[0], 0, &dmy_i64);
|
||||
ret = amdsmi_get_gpu_fan_speed(processor_handles_[0], 0, &dmy_i64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_fan_speed_max(device_handles_[0], 0, &dmy_ui64);
|
||||
ret = amdsmi_get_gpu_fan_speed_max(processor_handles_[0], 0, &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_temp_metric(device_handles_[0], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &dmy_i64);
|
||||
ret = amdsmi_get_temp_metric(processor_handles_[0], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &dmy_i64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_reset_fan(device_handles_[0], 0);
|
||||
ret = amdsmi_reset_gpu_fan(processor_handles_[0], 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_set_fan_speed(device_handles_[0], dmy_ui32, 0);
|
||||
ret = amdsmi_set_gpu_fan_speed(processor_handles_[0], dmy_ui32, 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_perf_level(device_handles_[0], &dmy_perf_lvl);
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[0], &dmy_perf_lvl);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_overdrive_level(device_handles_[0], &dmy_ui32);
|
||||
ret = amdsmi_get_gpu_overdrive_level(processor_handles_[0], &dmy_ui32);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[0], CLK_TYPE_SYS, &dmy_freqs);
|
||||
ret = amdsmi_get_clk_freq(processor_handles_[0], CLK_TYPE_SYS, &dmy_freqs);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_od_volt_info(device_handles_[0], &dmy_od_volt);
|
||||
ret = amdsmi_get_gpu_od_volt_info(processor_handles_[0], &dmy_od_volt);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_od_volt_curve_regions(device_handles_[0], &dmy_ui32, &dmy_vlt_reg);
|
||||
ret = amdsmi_get_gpu_od_volt_curve_regions(processor_handles_[0], &dmy_ui32, &dmy_vlt_reg);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_set_overdrive_level_v1(device_handles_[0], dmy_i32);
|
||||
ret = amdsmi_set_gpu_overdrive_level_v1(processor_handles_[0], dmy_i32);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_set_clk_freq(device_handles_[0], CLK_TYPE_SYS, 0);
|
||||
ret = amdsmi_set_clk_freq(processor_handles_[0], CLK_TYPE_SYS, 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_ecc_count(device_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt);
|
||||
ret = amdsmi_get_gpu_ecc_count(processor_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_ecc_enabled(device_handles_[0], &dmy_ui64);
|
||||
ret = amdsmi_get_gpu_ecc_enabled(processor_handles_[0], &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_get_ecc_status(device_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_ras_err_st);
|
||||
ret = amdsmi_get_gpu_ecc_status(processor_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_ras_err_st);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
|
||||
/* Other functions holding device mutexes. Listed for reference.
|
||||
amdsmi_dev_sku_get
|
||||
amdsmi_dev_set_perf_level_v1
|
||||
amdsmi_dev_set_od_clk_info
|
||||
amdsmi_dev_set_od_volt_info
|
||||
amdsmi_set_gpu_perf_level_v1
|
||||
amdsmi_set_gpu_od_clk_info
|
||||
amdsmi_set_gpu_od_volt_info
|
||||
amdsmi_dev_firmware_version_get
|
||||
amdsmi_dev_firmware_version_get
|
||||
amdsmi_dev_name_get
|
||||
amdsmi_dev_brand_get
|
||||
amdsmi_dev_get_vram_vendor
|
||||
amdsmi_dev_get_subsystem_name
|
||||
amdsmi_dev_get_drm_render_minor
|
||||
amdsmi_dev_get_vendor_name
|
||||
amdsmi_dev_get_pci_bandwidth
|
||||
amdsmi_dev_set_pci_bandwidth
|
||||
amdsmi_dev_get_pci_throughput
|
||||
amdsmi_dev_get_temp_metric
|
||||
amdsmi_dev_get_volt_metric
|
||||
amdsmi_dev_get_fan_speed
|
||||
amdsmi_dev_get_fan_rpms
|
||||
amdsmi_dev_reset_fan
|
||||
amdsmi_dev_set_fan_speed
|
||||
amdsmi_dev_get_fan_speed_max
|
||||
amdsmi_dev_get_od_volt_info
|
||||
amdsmi_dev_get_gpu_metrics_info
|
||||
amdsmi_dev_get_od_volt_curve_regions
|
||||
amdsmi_get_gpu_vram_vendor
|
||||
amdsmi_get_gpu_subsystem_name
|
||||
amdsmi_get_gpu_drm_render_minor
|
||||
amdsmi_get_gpu_vendor_name
|
||||
amdsmi_get_gpu_pci_bandwidth
|
||||
amdsmi_set_gpu_pci_bandwidth
|
||||
amdsmi_get_gpu_pci_throughput
|
||||
amdsmi_get_temp_metric
|
||||
amdsmi_get_gpu_volt_metric
|
||||
amdsmi_get_gpu_fan_speed
|
||||
amdsmi_get_gpu_fan_rpms
|
||||
amdsmi_reset_gpu_fan
|
||||
amdsmi_set_gpu_fan_speed
|
||||
amdsmi_get_gpu_fan_speed_max
|
||||
amdsmi_get_gpu_od_volt_info
|
||||
amdsmi_get_gpu_metrics_info
|
||||
amdsmi_get_gpu_od_volt_curve_regions
|
||||
amdsmi_dev_power_max_get
|
||||
amdsmi_dev_get_power_ave
|
||||
amdsmi_dev_power_cap_get
|
||||
amdsmi_dev_power_cap_range_get
|
||||
amdsmi_dev_set_power_cap
|
||||
amdsmi_dev_get_power_profile_presets
|
||||
amdsmi_dev_set_power_profile
|
||||
amdsmi_dev_get_memory_total
|
||||
amdsmi_dev_get_memory_usage
|
||||
amdsmi_dev_get_memory_busy_percent
|
||||
amdsmi_dev_get_busy_percent
|
||||
amdsmi_set_power_cap
|
||||
amdsmi_get_gpu_power_profile_presets
|
||||
amdsmi_set_gpu_power_profile
|
||||
amdsmi_get_gpu_memory_total
|
||||
amdsmi_get_gpu_memory_usage
|
||||
amdsmi_get_gpu_memory_busy_percent
|
||||
amdsmi_get_busy_percent
|
||||
amdsmi_dev_vbios_version_get
|
||||
amdsmi_dev_serial_number_get
|
||||
amdsmi_dev_get_pci_replay_counter
|
||||
amdsmi_get_gpu_pci_replay_counter
|
||||
amdsmi_dev_unique_id_get
|
||||
amdsmi_dev_create_counter
|
||||
amdsmi_counter_get_available_counters
|
||||
amdsmi_dev_counter_group_supported
|
||||
amdsmi_dev_get_memory_reserved_pages
|
||||
amdsmi_dev_xgmi_error_status
|
||||
amdsmi_dev_reset_xgmi_error
|
||||
amdsmi_gpu_create_counter
|
||||
amdsmi_get_gpu_available_counters
|
||||
amdsmi_gpu_counter_group_supported
|
||||
amdsmi_get_gpu_memory_reserved_pages
|
||||
amdsmi_gpu_xgmi_error_status
|
||||
amdsmi_reset_gpu_xgmi_error
|
||||
amdsmi_dev_xgmi_hive_id_get
|
||||
amdsmi_topo_get_link_weight
|
||||
amdsmi_set_event_notification_mask
|
||||
amdsmi_init_event_notification
|
||||
amdsmi_stop_event_notification
|
||||
amdsmi_set_gpu_event_notification_mask
|
||||
amdsmi_init_gpu_event_notification
|
||||
amdsmi_stop_gpu_event_notification
|
||||
*/
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
|
||||
@@ -96,14 +96,20 @@ void TestOverdriveRead::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_get_overdrive_level(device_handles_[i], &val_ui32);
|
||||
err = amdsmi_get_gpu_overdrive_level(processor_handles_[i], &val_ui32);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Not supported on this machine" << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**OverDrive Level:" << val_ui32 << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_overdrive_level(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_overdrive_level(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,27 +95,33 @@ void TestOverdriveReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
PrintDeviceHeader(processor_handles_[dv_ind]);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Set Overdrive level to 0%..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 0);
|
||||
ret = amdsmi_set_gpu_overdrive_level(processor_handles_[dv_ind], 0);
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Not supported on this machine" << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Set Overdrive level to 10%..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 10);
|
||||
ret = amdsmi_set_gpu_overdrive_level(processor_handles_[dv_ind], 10);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_get_overdrive_level(device_handles_[dv_ind], &val);
|
||||
ret = amdsmi_get_gpu_overdrive_level(processor_handles_[dv_ind], &val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New OverDrive Level:" << val << std::endl;
|
||||
std::cout << "Reset Overdrive level to 0%..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 0);
|
||||
ret = amdsmi_set_gpu_overdrive_level(processor_handles_[dv_ind], 0);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_get_overdrive_level(device_handles_[dv_ind], &val);
|
||||
ret = amdsmi_get_gpu_overdrive_level(processor_handles_[dv_ind], &val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New OverDrive Level:" << val << std::endl;
|
||||
|
||||
@@ -98,17 +98,17 @@ void TestPciReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
PrintDeviceHeader(processor_handles_[dv_ind]);
|
||||
|
||||
ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], &u64int);
|
||||
ret = amdsmi_get_gpu_pci_replay_counter(processor_handles_[dv_ind], &u64int);
|
||||
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t** amdsmi_dev_get_pci_replay_counter() is not supported"
|
||||
"\t** amdsmi_get_gpu_pci_replay_counter() is not supported"
|
||||
" on this machine" << std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], nullptr);
|
||||
ret = amdsmi_get_gpu_pci_replay_counter(processor_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
@@ -116,11 +116,11 @@ void TestPciReadWrite::Run(void) {
|
||||
std::cout << "\tPCIe Replay Counter: " << u64int << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], nullptr);
|
||||
ret = amdsmi_get_gpu_pci_replay_counter(processor_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_get_pci_throughput(device_handles_[dv_ind], &sent, &received, &max_pkt_sz);
|
||||
ret = amdsmi_get_gpu_pci_throughput(processor_handles_[dv_ind], &sent, &received, &max_pkt_sz);
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "TEST FAILURE: Current PCIe throughput is not detected. "
|
||||
"This is likely because it is not indicated in the pcie_bw sysfs "
|
||||
@@ -141,14 +141,14 @@ void TestPciReadWrite::Run(void) {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], &bw);
|
||||
ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], &bw);
|
||||
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "TEST FAILURE: Current PCIe bandwidth is not detected. "
|
||||
"This is likely because it is not indicated in the pp_dpm_pcie sysfs "
|
||||
"file. Aborting test." << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], nullptr);
|
||||
ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
return;
|
||||
@@ -163,7 +163,7 @@ void TestPciReadWrite::Run(void) {
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], nullptr);
|
||||
ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
|
||||
// First set the bitmask to all supported bandwidths
|
||||
@@ -182,10 +182,10 @@ void TestPciReadWrite::Run(void) {
|
||||
std::cout << "\tSetting bandwidth mask to " << "0b" << freq_bm_str <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_pci_bandwidth(device_handles_[dv_ind], freq_bitmask);
|
||||
ret = amdsmi_set_gpu_pci_bandwidth(processor_handles_[dv_ind], freq_bitmask);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], &bw);
|
||||
ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], &bw);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -193,10 +193,10 @@ void TestPciReadWrite::Run(void) {
|
||||
std::endl;
|
||||
std::cout << "\tResetting mask to all bandwidths." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_pci_bandwidth(device_handles_[dv_ind], 0xFFFFFFFF);
|
||||
ret = amdsmi_set_gpu_pci_bandwidth(processor_handles_[dv_ind], 0xFFFFFFFF);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,25 +110,25 @@ void TestPerfCntrReadWrite::Close() {
|
||||
|
||||
// Refactor this to handle different event groups once we have > 1 event group
|
||||
|
||||
void TestPerfCntrReadWrite::CountEvents(amdsmi_device_handle dv_ind,
|
||||
void TestPerfCntrReadWrite::CountEvents(amdsmi_processor_handle dv_ind,
|
||||
amdsmi_event_type_t evnt, amdsmi_counter_value_t *val, int32_t sleep_sec) {
|
||||
amdsmi_event_handle_t evt_handle;
|
||||
amdsmi_status_t ret;
|
||||
|
||||
ret = amdsmi_dev_create_counter(dv_ind,
|
||||
ret = amdsmi_gpu_create_counter(dv_ind,
|
||||
static_cast<amdsmi_event_type_t>(evnt), &evt_handle);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
// Note that amdsmi_dev_create_counter() should never return
|
||||
// Note that amdsmi_gpu_create_counter() should never return
|
||||
// AMDSMI_STATUS_NOT_SUPPORTED. It will return AMDSMI_STATUS_OUT_OF_RESOURCES
|
||||
// if it is unable to create a counter.
|
||||
ret = amdsmi_dev_create_counter(dv_ind,
|
||||
ret = amdsmi_gpu_create_counter(dv_ind,
|
||||
static_cast<amdsmi_event_type_t>(evnt), nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
|
||||
ret = amdsmi_control_counter(evt_handle, AMDSMI_CNTR_CMD_START, nullptr);
|
||||
ret = amdsmi_gpu_control_counter(evt_handle, AMDSMI_CNTR_CMD_START, nullptr);
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "amdsmi_control_counter() returned "
|
||||
std::cout << "amdsmi_gpu_control_counter() returned "
|
||||
"AMDSMI_STATUS_NOT_SUPPORTED" << std::endl;
|
||||
throw AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
} else {
|
||||
@@ -136,7 +136,7 @@ void TestPerfCntrReadWrite::CountEvents(amdsmi_device_handle dv_ind,
|
||||
}
|
||||
sleep(sleep_sec);
|
||||
|
||||
ret = amdsmi_read_counter(evt_handle, val);
|
||||
ret = amdsmi_gpu_read_counter(evt_handle, val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -146,7 +146,7 @@ void TestPerfCntrReadWrite::CountEvents(amdsmi_device_handle dv_ind,
|
||||
std::cout << "\t\t\tEvents/Second Running: " <<
|
||||
val->value/static_cast<float>(val->time_running) << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_destroy_counter(evt_handle);
|
||||
ret = amdsmi_gpu_destroy_counter(evt_handle);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ static const uint64_t kVg20Level1Bandwidth = 23; // 23 GB/sec
|
||||
|
||||
|
||||
void
|
||||
TestPerfCntrReadWrite::testEventsIndividually(amdsmi_device_handle dv_ind) {
|
||||
TestPerfCntrReadWrite::testEventsIndividually(amdsmi_processor_handle dv_ind) {
|
||||
amdsmi_status_t ret;
|
||||
amdsmi_counter_value_t val;
|
||||
uint64_t throughput;
|
||||
@@ -202,7 +202,7 @@ TestPerfCntrReadWrite::testEventsIndividually(amdsmi_device_handle dv_ind) {
|
||||
std::cout << "****************************" << std::endl;
|
||||
}
|
||||
for (PerfCntrEvtGrp grp : s_event_groups) {
|
||||
ret = amdsmi_dev_counter_group_supported(dv_ind, grp.group());
|
||||
ret = amdsmi_gpu_counter_group_supported(dv_ind, grp.group());
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
continue;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ TestPerfCntrReadWrite::testEventsIndividually(amdsmi_device_handle dv_ind) {
|
||||
}
|
||||
|
||||
void
|
||||
TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) {
|
||||
TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_processor_handle dv_ind) {
|
||||
amdsmi_status_t ret;
|
||||
amdsmi_counter_value_t val;
|
||||
uint32_t avail_counters;
|
||||
@@ -248,7 +248,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) {
|
||||
* handling 1 event at a time.
|
||||
*/
|
||||
for (PerfCntrEvtGrp grp : s_event_groups) {
|
||||
ret = amdsmi_dev_counter_group_supported(dv_ind, grp.group());
|
||||
ret = amdsmi_gpu_counter_group_supported(dv_ind, grp.group());
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tEvent Group " << grp.name() <<
|
||||
@@ -261,7 +261,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) {
|
||||
std::cout << "Testing Event Group " << grp.name() << std::endl;
|
||||
}
|
||||
|
||||
ret = amdsmi_counter_get_available_counters(dv_ind, grp.group(),
|
||||
ret = amdsmi_get_gpu_available_counters(dv_ind, grp.group(),
|
||||
&avail_counters);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Available Counters: " << avail_counters << std::endl;
|
||||
@@ -294,7 +294,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) {
|
||||
std::cout << "\tEvent Type " << tmp << std::endl;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_create_counter(dv_ind,
|
||||
ret = amdsmi_gpu_create_counter(dv_ind,
|
||||
static_cast<amdsmi_event_type_t>(tmp), &evt_handle.get()[j]);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
@@ -307,11 +307,11 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) {
|
||||
for (j = 0; j < num_created; ++j) {
|
||||
tmp = static_cast<amdsmi_event_type_t>(evnt + j);
|
||||
|
||||
ret = amdsmi_control_counter(evt_handle.get()[j], AMDSMI_CNTR_CMD_START,
|
||||
ret = amdsmi_gpu_control_counter(evt_handle.get()[j], AMDSMI_CNTR_CMD_START,
|
||||
nullptr);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_counter_get_available_counters(dv_ind, grp.group(),
|
||||
ret = amdsmi_get_gpu_available_counters(dv_ind, grp.group(),
|
||||
&tmp_cntrs);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ASSERT_EQ(tmp_cntrs, (avail_counters - j - 1));
|
||||
@@ -325,7 +325,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) {
|
||||
for (j = 0; j < num_created; ++j) {
|
||||
tmp = static_cast<amdsmi_event_type_t>(evnt + j);
|
||||
|
||||
ret = amdsmi_read_counter(evt_handle.get()[j], &val);
|
||||
ret = amdsmi_gpu_read_counter(evt_handle.get()[j], &val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -337,7 +337,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) {
|
||||
}
|
||||
}
|
||||
for (j = 0; j < num_created; ++j) {
|
||||
ret = amdsmi_dev_destroy_counter(evt_handle.get()[j]);
|
||||
ret = amdsmi_gpu_destroy_counter(evt_handle.get()[j]);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void TestPerfCntrReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
amdsmi_device_handle dev_handle = device_handles_[dv_ind];
|
||||
amdsmi_processor_handle dev_handle = processor_handles_[dv_ind];
|
||||
PrintDeviceHeader(dev_handle);
|
||||
try {
|
||||
testEventsIndividually(dev_handle);
|
||||
|
||||
@@ -72,11 +72,11 @@ class TestPerfCntrReadWrite : public TestBase {
|
||||
virtual void DisplayTestInfo(void);
|
||||
|
||||
private:
|
||||
void CountEvents(amdsmi_device_handle dv_ind,
|
||||
void CountEvents(amdsmi_processor_handle dv_ind,
|
||||
amdsmi_event_type_t evnt, amdsmi_counter_value_t *val,
|
||||
int32_t sleep_sec = 1);
|
||||
void testEventsIndividually(amdsmi_device_handle dv_ind);
|
||||
void testEventsSimultaneously(amdsmi_device_handle dv_ind);
|
||||
void testEventsIndividually(amdsmi_processor_handle dv_ind);
|
||||
void testEventsSimultaneously(amdsmi_processor_handle dv_ind);
|
||||
};
|
||||
|
||||
class PerfCntrEvtGrp {
|
||||
|
||||
@@ -102,8 +102,8 @@ void TestPerfDeterminism::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
err = amdsmi_dev_get_od_volt_info(device_handles_[i], &odv);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], &odv);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Not supported on this machine" << std::endl;
|
||||
@@ -114,14 +114,14 @@ void TestPerfDeterminism::Run(void) {
|
||||
clkvalue = (odv.curr_sclk_range.lower_bound/1000000) + 50;
|
||||
}
|
||||
|
||||
err = amdsmi_set_perf_determinism_mode(device_handles_[i], clkvalue);
|
||||
err = amdsmi_set_gpu_perf_determinism_mode(processor_handles_[i], clkvalue);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Not supported on this machine" << std::endl;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
ret = amdsmi_dev_get_perf_level(device_handles_[i], &pfl);
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[i], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
@@ -130,9 +130,9 @@ void TestPerfDeterminism::Run(void) {
|
||||
}
|
||||
|
||||
std::cout << "\t**Resetting performance determinism" << std::endl;
|
||||
err = amdsmi_dev_set_perf_level(device_handles_[i], AMDSMI_DEV_PERF_LEVEL_AUTO);;
|
||||
err = amdsmi_set_gpu_perf_level(processor_handles_[i], AMDSMI_DEV_PERF_LEVEL_AUTO);;
|
||||
CHK_ERR_ASRT(err)
|
||||
ret = amdsmi_dev_get_perf_level(device_handles_[i], &pfl);
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[i], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
|
||||
@@ -96,16 +96,16 @@ void TestPerfLevelRead::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_get_perf_level(device_handles_[i], &pfl);
|
||||
err = amdsmi_get_gpu_perf_level(processor_handles_[i], &pfl);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Performance Level:" << std::dec << (uint32_t)pfl <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_perf_level(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_perf_level(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,9 +99,9 @@ void TestPerfLevelReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
PrintDeviceHeader(processor_handles_[dv_ind]);
|
||||
|
||||
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &orig_pfl);
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &orig_pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -120,14 +120,14 @@ void TestPerfLevelReadWrite::Run(void) {
|
||||
GetPerfLevelStr(static_cast<amdsmi_dev_perf_level_t>(pfl_i)) <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind],
|
||||
ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind],
|
||||
static_cast<amdsmi_dev_perf_level_t>(pfl_i));
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**" << GetPerfLevelStr(static_cast<amdsmi_dev_perf_level_t>(pfl_i))
|
||||
<< " returned AMDSMI_STATUS_NOT_SUPPORTED" << std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl);
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
@@ -139,9 +139,15 @@ void TestPerfLevelReadWrite::Run(void) {
|
||||
std::cout << "Reset Perf level to " << GetPerfLevelStr(orig_pfl) <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], orig_pfl);
|
||||
ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], orig_pfl);
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Not supported on this machine" << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl);
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
|
||||
@@ -100,13 +100,13 @@ void TestPowerCapReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
PrintDeviceHeader(processor_handles_[dv_ind]);
|
||||
|
||||
amdsmi_power_cap_info_t info;
|
||||
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
|
||||
ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info);
|
||||
CHK_ERR_ASRT(ret)
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, nullptr);
|
||||
ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
min = info.min_power_cap;
|
||||
max = info.max_power_cap;
|
||||
@@ -121,13 +121,19 @@ void TestPowerCapReadWrite::Run(void) {
|
||||
std::cout << "Setting new cap to " << new_cap << "..." << std::endl;
|
||||
}
|
||||
start = clock();
|
||||
ret = amdsmi_dev_set_power_cap(device_handles_[dv_ind], 0, new_cap);
|
||||
ret = amdsmi_set_power_cap(processor_handles_[dv_ind], 0, new_cap);
|
||||
end = clock();
|
||||
cpu_time_used = ((double) (end - start)) * 1000000UL / CLOCKS_PER_SEC;
|
||||
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Not supported on this machine" << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
|
||||
ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info);
|
||||
CHK_ERR_ASRT(ret)
|
||||
new_cap = info.default_power_cap;
|
||||
|
||||
@@ -139,10 +145,10 @@ void TestPowerCapReadWrite::Run(void) {
|
||||
std::cout << "Resetting cap to " << orig << "..." << std::endl;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_set_power_cap(device_handles_[dv_ind], 0, orig);
|
||||
ret = amdsmi_set_power_cap(processor_handles_[dv_ind], 0, orig);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
|
||||
ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info);
|
||||
CHK_ERR_ASRT(ret)
|
||||
new_cap = info.default_power_cap;
|
||||
|
||||
|
||||
@@ -97,10 +97,10 @@ void TestPowerRead::Run(void) {
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
amdsmi_power_cap_info_t info;
|
||||
err = amdsmi_get_power_cap_info(device_handles_[i], 0, &info);
|
||||
err = amdsmi_get_power_cap_info(processor_handles_[i], 0, &info);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Power Cap: " << info.power_cap << "uW" <<std::endl;
|
||||
@@ -111,18 +111,6 @@ void TestPowerRead::Run(void) {
|
||||
std::cout << "\t**Power Cap Range: " << info.min_power_cap << " to " <<
|
||||
info.max_power_cap << " uW" << std::endl;
|
||||
}
|
||||
|
||||
err = amdsmi_dev_get_power_ave(device_handles_[i], 0, &val_ui64);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Averge Power Usage: ";
|
||||
CHK_AMDSMI_PERM_ERR(err)
|
||||
if (err == AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64)/1000 << " mW" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_power_ave(device_handles_[i], 0, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,9 +120,9 @@ void TestPowerReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
PrintDeviceHeader(processor_handles_[dv_ind]);
|
||||
|
||||
ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status);
|
||||
ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, &status);
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "The power profile presets settings is not supported. "
|
||||
<< std::endl;
|
||||
@@ -131,7 +131,7 @@ void TestPowerReadWrite::Run(void) {
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, nullptr);
|
||||
ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -172,27 +172,27 @@ void TestPowerReadWrite::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_set_power_profile(device_handles_[dv_ind], 0, new_prof);
|
||||
ret = amdsmi_set_gpu_power_profile(processor_handles_[dv_ind], 0, new_prof);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
amdsmi_dev_perf_level_t pfl;
|
||||
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl);
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_MANUAL);
|
||||
|
||||
ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status);
|
||||
ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, &status);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ASSERT_EQ(status.current, new_prof);
|
||||
|
||||
ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl);
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
|
||||
ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status);
|
||||
ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, &status);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ASSERT_EQ(status.current, orig_profile);
|
||||
|
||||
@@ -104,7 +104,7 @@ void TestProcInfoRead::Run(void) {
|
||||
|
||||
uint32_t num_devices = num_monitor_devs();
|
||||
|
||||
err = amdsmi_get_compute_process_info(nullptr, &num_proc_found);
|
||||
err = amdsmi_get_gpu_compute_process_info(nullptr, &num_proc_found);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -129,7 +129,7 @@ void TestProcInfoRead::Run(void) {
|
||||
procs = new amdsmi_process_info_t[num_proc_found];
|
||||
|
||||
val_ui32 = num_proc_found;
|
||||
err = amdsmi_get_compute_process_info(procs, &val_ui32);
|
||||
err = amdsmi_get_gpu_compute_process_info(procs, &val_ui32);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -162,7 +162,7 @@ void TestProcInfoRead::Run(void) {
|
||||
uint32_t amt_allocd = num_devices;
|
||||
|
||||
for (uint32_t j = 0; j < num_proc_found; j++) {
|
||||
err = amdsmi_get_compute_process_gpus(procs[j].process_id, dev_inds,
|
||||
err = amdsmi_get_gpu_compute_process_gpus(procs[j].process_id, dev_inds,
|
||||
&amt_allocd);
|
||||
if (err == AMDSMI_STATUS_NOT_FOUND) {
|
||||
std::cout << "\t** Process " << procs[j].process_id <<
|
||||
@@ -191,13 +191,13 @@ void TestProcInfoRead::Run(void) {
|
||||
amdsmi_process_info_t proc_info;
|
||||
for (uint32_t j = 0; j < num_proc_found; j++) {
|
||||
memset(&proc_info, 0x0, sizeof(amdsmi_process_info_t));
|
||||
err = amdsmi_get_compute_process_info_by_pid(procs[j].process_id,
|
||||
err = amdsmi_get_gpu_compute_process_info_by_pid(procs[j].process_id,
|
||||
&proc_info);
|
||||
if (err == AMDSMI_STATUS_NOT_FOUND) {
|
||||
std::cout <<
|
||||
"\t** WARNING: amdsmi_get_compute_process_info() found process " <<
|
||||
"\t** WARNING: amdsmi_get_gpu_compute_process_info() found process " <<
|
||||
procs[j].process_id << ", but subsequently, "
|
||||
"amdsmi_get_compute_process_info_by_pid() did not"
|
||||
"amdsmi_get_gpu_compute_process_info_by_pid() did not"
|
||||
" find this same process." << std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -217,10 +217,10 @@ void TestProcInfoRead::Run(void) {
|
||||
if (num_proc_found > 1) {
|
||||
amdsmi_process_info_t tmp_proc;
|
||||
val_ui32 = 1;
|
||||
err = amdsmi_get_compute_process_info(&tmp_proc, &val_ui32);
|
||||
err = amdsmi_get_gpu_compute_process_info(&tmp_proc, &val_ui32);
|
||||
|
||||
if (err != AMDSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
std::cout << "Expected amdsmi_get_compute_process_info() to tell us"
|
||||
std::cout << "Expected amdsmi_get_gpu_compute_process_info() to tell us"
|
||||
" there are more processes available, but instead go return code " <<
|
||||
err << std::endl;
|
||||
}
|
||||
|
||||
@@ -100,10 +100,10 @@ void TestSysInfoRead::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
amdsmi_vbios_info_t info;
|
||||
err = amdsmi_get_vbios_info(device_handles_[i], &info);
|
||||
err = amdsmi_get_gpu_vbios_info(processor_handles_[i], &info);
|
||||
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_FILE_ERROR) {
|
||||
@@ -112,11 +112,11 @@ void TestSysInfoRead::Run(void) {
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_vbios_info(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_vbios_info(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_vbios_info(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_vbios_info(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -124,40 +124,40 @@ void TestSysInfoRead::Run(void) {
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**VBIOS Version: "
|
||||
<< info.vbios_version_string << std::endl;
|
||||
<< info.version << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_dev_get_pci_id(device_handles_[i], &val_ui64);
|
||||
err = amdsmi_get_gpu_pci_id(processor_handles_[i], &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**PCI ID (BDFID): 0x" << std::hex << val_ui64;
|
||||
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_pci_id(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_pci_id(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
err = amdsmi_topo_get_numa_affinity(device_handles_[i], &val_ui32);
|
||||
err = amdsmi_get_gpu_topo_numa_affinity(processor_handles_[i], &val_ui32);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**NUMA NODE: 0x" << std::hex << val_ui32;
|
||||
std::cout << " (" << std::dec << val_ui32 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_topo_get_numa_affinity(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_topo_numa_affinity(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
|
||||
// vendor_id, unique_id
|
||||
amdsmi_asic_info_t asci_info;
|
||||
err = amdsmi_get_asic_info(device_handles_[0], &asci_info);
|
||||
err = amdsmi_get_gpu_asic_info(processor_handles_[0], &asci_info);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**amdsmi_dev_unique_id() is not supported"
|
||||
" on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_asic_info(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_asic_info(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
if (err == AMDSMI_STATUS_SUCCESS) {
|
||||
@@ -169,7 +169,7 @@ void TestSysInfoRead::Run(void) {
|
||||
*/
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_asic_info(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_asic_info(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
} else {
|
||||
std::cout << "amdsmi_dev_unique_id_get() failed with error " <<
|
||||
@@ -190,11 +190,11 @@ void TestSysInfoRead::Run(void) {
|
||||
std::cout << std::setbase(10);
|
||||
|
||||
amdsmi_fw_info_t fw_info;
|
||||
err = amdsmi_get_fw_info(device_handles_[i], &fw_info);
|
||||
err = amdsmi_get_fw_info(processor_handles_[i], &fw_info);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**No FW " <<
|
||||
" available on this system" << std::endl;
|
||||
err = amdsmi_get_fw_info(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_fw_info(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
@@ -110,11 +110,11 @@ void TestTempRead::Run(void) {
|
||||
uint32_t type;
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
auto print_temp_metric = [&](amdsmi_temperature_metric_t met,
|
||||
std::string label) {
|
||||
err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, &val_i64);
|
||||
err = amdsmi_get_temp_metric(processor_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, &val_i64);
|
||||
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -124,7 +124,7 @@ void TestTempRead::Run(void) {
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, nullptr);
|
||||
err = amdsmi_get_temp_metric(processor_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
return;
|
||||
} else {
|
||||
@@ -132,7 +132,7 @@ void TestTempRead::Run(void) {
|
||||
}
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, nullptr);
|
||||
err = amdsmi_get_temp_metric(processor_handles_[i], static_cast<amdsmi_temperature_type_t>(type), met, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
|
||||
@@ -155,22 +155,22 @@ void TestVoltCurvRead::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_get_od_volt_info(device_handles_[i], &odv);
|
||||
err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], &odv);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t** amdsmi_dev_get_od_volt_info: Not supported on this machine"
|
||||
"\t** amdsmi_get_gpu_od_volt_info: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_od_volt_info(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_od_volt_info(device_handles_[i], nullptr);
|
||||
err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void TestVoltCurvRead::Run(void) {
|
||||
ASSERT_TRUE(regions != nullptr);
|
||||
|
||||
num_regions = odv.num_regions;
|
||||
err = amdsmi_dev_get_od_volt_curve_regions(device_handles_[i], &num_regions, regions);
|
||||
err = amdsmi_get_gpu_od_volt_curve_regions(processor_handles_[i], &num_regions, regions);
|
||||
CHK_ERR_ASRT(err)
|
||||
ASSERT_TRUE(num_regions == odv.num_regions);
|
||||
|
||||
|
||||
@@ -100,11 +100,11 @@ void TestVoltRead::Run(void) {
|
||||
amdsmi_voltage_type_t type = AMDSMI_VOLT_TYPE_VDDGFX;
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
auto print_volt_metric = [&](amdsmi_voltage_metric_t met,
|
||||
std::string label) {
|
||||
err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, &val_i64);
|
||||
err = amdsmi_get_gpu_volt_metric(processor_handles_[i], type, met, &val_i64);
|
||||
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -113,7 +113,7 @@ void TestVoltRead::Run(void) {
|
||||
"Not supported on this machine" << std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, nullptr);
|
||||
err = amdsmi_get_gpu_volt_metric(processor_handles_[i], type, met, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
return;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ void TestVoltRead::Run(void) {
|
||||
}
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, nullptr);
|
||||
err = amdsmi_get_gpu_volt_metric(processor_handles_[i], type, met, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
|
||||
@@ -98,7 +98,7 @@ void TestXGMIReadWrite::Run(void) {
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
auto device = device_handles_[dv_ind];
|
||||
auto device = processor_handles_[dv_ind];
|
||||
PrintDeviceHeader(device);
|
||||
|
||||
amdsmi_xgmi_info_t info;
|
||||
@@ -116,7 +116,7 @@ void TestXGMIReadWrite::Run(void) {
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_dev_xgmi_error_status(device, &err_stat);
|
||||
err = amdsmi_gpu_xgmi_error_status(device, &err_stat);
|
||||
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -124,7 +124,7 @@ void TestXGMIReadWrite::Run(void) {
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_xgmi_error_status(device, nullptr);
|
||||
err = amdsmi_gpu_xgmi_error_status(device, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
@@ -135,12 +135,12 @@ void TestXGMIReadWrite::Run(void) {
|
||||
static_cast<uint32_t>(err_stat) << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_xgmi_error_status(device, nullptr);
|
||||
err = amdsmi_gpu_xgmi_error_status(device, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
// TODO(cfree) We need to find a way to generate xgmi errors so this
|
||||
// test won't be meaningless
|
||||
err = amdsmi_dev_reset_xgmi_error(device);
|
||||
err = amdsmi_reset_gpu_xgmi_error(device);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Successfully reset XGMI Error Status: " << std::endl;
|
||||
|
||||
@@ -124,16 +124,16 @@ void TestBase::SetUp(uint64_t init_flags) {
|
||||
for (uint32_t i=0; i < socket_count_; i++) {
|
||||
// Get all devices of the socket
|
||||
uint32_t device_count = 0;
|
||||
err = amdsmi_get_device_handles(sockets_[i],
|
||||
err = amdsmi_get_processor_handles(sockets_[i],
|
||||
&device_count, nullptr);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_SUCCESS);
|
||||
|
||||
std::vector<amdsmi_device_handle> device_handles(device_count);
|
||||
err = amdsmi_get_device_handles(sockets_[i],
|
||||
&device_count, &device_handles[0]);
|
||||
std::vector<amdsmi_processor_handle> processor_handles(device_count);
|
||||
err = amdsmi_get_processor_handles(sockets_[i],
|
||||
&device_count, &processor_handles[0]);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ void TestBase::SetUp(uint64_t init_flags) {
|
||||
setup_failed_ = true;
|
||||
ASSERT_EQ(AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS, AMDSMI_STATUS_SUCCESS);
|
||||
}
|
||||
device_handles_[num_monitor_devs_] = device_handles[j];
|
||||
processor_handles_[num_monitor_devs_] = processor_handles[j];
|
||||
num_monitor_devs_++;
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ void TestBase::SetUp(uint64_t init_flags) {
|
||||
return;
|
||||
}
|
||||
|
||||
void TestBase::PrintDeviceHeader(amdsmi_device_handle dv_ind) {
|
||||
void TestBase::PrintDeviceHeader(amdsmi_processor_handle dv_ind) {
|
||||
amdsmi_status_t err;
|
||||
uint16_t val_ui16;
|
||||
amdsmi_asic_info_t info;
|
||||
@@ -167,19 +167,19 @@ void TestBase::PrintDeviceHeader(amdsmi_device_handle dv_ind) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device handle: " << dv_ind << std::endl;
|
||||
}
|
||||
err = amdsmi_dev_get_id(dv_ind, &val_ui16);
|
||||
err = amdsmi_get_gpu_id(dv_ind, &val_ui16);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device ID: 0x" << std::hex << val_ui16 << std::endl;
|
||||
}
|
||||
|
||||
amdsmi_board_info_t board_info;
|
||||
err = amdsmi_get_board_info(dv_ind, &board_info);
|
||||
err = amdsmi_get_gpu_board_info(dv_ind, &board_info);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device name: " << board_info.product_name << std::endl;
|
||||
|
||||
err = amdsmi_get_asic_info(dv_ind, &info);
|
||||
err = amdsmi_get_gpu_asic_info(dv_ind, &info);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Vendor ID: 0x" << std::hex <<
|
||||
@@ -187,7 +187,7 @@ void TestBase::PrintDeviceHeader(amdsmi_device_handle dv_ind) {
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_dev_get_subsystem_id(dv_ind, &val_ui16);
|
||||
err = amdsmi_get_gpu_subsystem_id(dv_ind, &val_ui16);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem ID: 0x" << std::hex << val_ui16 << std::endl;
|
||||
|
||||
@@ -121,11 +121,11 @@ class TestBase {
|
||||
|
||||
protected:
|
||||
void MakeHeaderStr(const char *inStr, std::string *outStr) const;
|
||||
void PrintDeviceHeader(amdsmi_device_handle dv_ind);
|
||||
void PrintDeviceHeader(amdsmi_processor_handle dv_ind);
|
||||
bool setup_failed_; ///< Record that setup failed to return ierr in Run
|
||||
uint32_t num_monitor_devs_; ///< Number of monitor devices found
|
||||
///< device handles
|
||||
amdsmi_device_handle device_handles_[MAX_MONITOR_DEVICES];
|
||||
amdsmi_processor_handle processor_handles_[MAX_MONITOR_DEVICES];
|
||||
uint32_t socket_count_; ///< socket count
|
||||
std::vector<amdsmi_socket_handle> sockets_; ///< sockets
|
||||
|
||||
|
||||
@@ -106,17 +106,17 @@ def main():
|
||||
library_path = os.path.join(os.path.dirname(__file__), library)
|
||||
line_to_replace = "_libraries['{}'] = ctypes.CDLL('{}')".format(library_name, library_path)
|
||||
new_line = f"""from pathlib import Path
|
||||
libamd_smi_optrocm = Path(__file__).parents[3] / "/lib/{library_name}"
|
||||
libamd_smi_cpack = Path("@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/{library_name}")
|
||||
libamd_smi_optrocm = Path("/opt/rocm/lib/{library_name}")
|
||||
libamd_smi_parent_dir = Path(__file__).resolve().parent / "{library_name}"
|
||||
libamd_smi_cwd = Path.cwd() / "{library_name}"
|
||||
|
||||
if libamd_smi_optrocm.is_file():
|
||||
# try /opt/rocm/lib as a fallback
|
||||
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_optrocm)
|
||||
elif libamd_smi_cpack.is_file():
|
||||
if libamd_smi_cpack.is_file():
|
||||
# try to find library in install directory provided by CMake
|
||||
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_cpack)
|
||||
elif libamd_smi_optrocm.is_file():
|
||||
# try /opt/rocm/lib as a fallback
|
||||
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_optrocm)
|
||||
elif libamd_smi_parent_dir.is_file():
|
||||
# try to fall back to parent directory
|
||||
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_parent_dir)
|
||||
|
||||
Reference in New Issue
Block a user