diff --git a/projects/amdsmi/CMakeLists.txt b/projects/amdsmi/CMakeLists.txt
index 50683e7d81..47c67e1b45 100755
--- a/projects/amdsmi/CMakeLists.txt
+++ b/projects/amdsmi/CMakeLists.txt
@@ -28,20 +28,33 @@ find_program(GIT NAMES git)
## Setup the package version based on git tags.
set(PKG_VERSION_GIT_TAG_PREFIX "amdsmi_pkg_ver")
-get_package_version_number("23.4.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
+get_package_version_number("23.4.2" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
message("Package version: ${PKG_VERSION_STR}")
-set(${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR "${VERSION_MAJOR}")
-set(${AMD_SMI_LIBS_TARGET}_VERSION_MINOR "${VERSION_MINOR}")
-set(${AMD_SMI_LIBS_TARGET}_VERSION_PATCH "0")
+set(${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
+set(${AMD_SMI_LIBS_TARGET}_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
+set(${AMD_SMI_LIBS_TARGET}_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
set(${AMD_SMI_LIBS_TARGET}_VERSION_BUILD "0")
+set(${AMD_SMI_LIBS_TARGET}_VERSION_HASH "${PKG_VERSION_HASH}")
+
+set(${AMD_SMI_LIBS_TARGET}_VERSION_STRING "${${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR}.${${AMD_SMI_LIBS_TARGET}_VERSION_MINOR}.${${AMD_SMI_LIBS_TARGET}_VERSION_PATCH}+${${AMD_SMI_LIBS_TARGET}_VERSION_HASH}")
+
+# Make proper version for appending
+# Default Value is 99999
+set(ROCM_VERSION_FOR_PACKAGE "99999")
+if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
+ set(ROCM_VERSION_FOR_PACKAGE $ENV{ROCM_LIBPATCH_VERSION})
+endif()
+#Prepare final version for the CPACK use
+set(CPACK_PACKAGE_VERSION
+ "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${ROCM_VERSION_FOR_PACKAGE}")
# The following default version values should be updated as appropriate for
# ABI breaks (update MAJOR and MINOR), and ABI/API additions (update MINOR).
# Until ABI stabilizes VERSION_MAJOR will be 0. This should be over-ridden
# by git tags (through "git describe") when they are present.
-set(PKG_VERSION_MAJOR "${VERSION_MAJOR}")
-set(PKG_VERSION_MINOR "${VERSION_MINOR}")
-set(PKG_VERSION_PATCH 0)
+set(PKG_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
+set(PKG_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
+set(PKG_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
set(PKG_VERSION_NUM_COMMIT 0)
set(AMD_SMI_PACKAGE
@@ -81,7 +94,11 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
generic_package()
## Compiler flags
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-rtti -m64 -msse -msse2")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-rtti")
+if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+ set(CMAKE_CXX_FLAGS
+ "${CMAKE_CXX_FLAGS} -m64 -msse -msse2")
+endif()
# Security options
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wcast-align")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=2 -fno-common -Wstrict-overflow")
@@ -226,21 +243,14 @@ install(
DESTINATION share/doc/${AMD_SMI}
COMPONENT dev)
-#Make proper version for appending
-#Default Value is 99999, setting it first
-set(ROCM_VERSION_FOR_PACKAGE "99999")
-if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
- set(ROCM_VERSION_FOR_PACKAGE $ENV{ROCM_LIBPATCH_VERSION})
-endif()
-
#Debian package specific variables
set(CPACK_DEBIAN_PACKAGE_PROVIDES "amd-smi")
-set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "sudo, libdrm-dev, python3-yaml")
+set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "sudo, libdrm-dev, python3-yaml, python3-argcomplete")
set(CPACK_DEBIAN_ASAN_PACKAGE_RECOMMENDS ${CPACK_DEBIAN_PACKAGE_RECOMMENDS})
set(CPACK_DEBIAN_DEV_PACKAGE_RECOMMENDS ${CPACK_DEBIAN_PACKAGE_RECOMMENDS})
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 (>= 3.7.9)")
+set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3 (>= 3.6.8), python3-pip")
set(CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS})
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS})
@@ -259,9 +269,13 @@ 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_SUGGESTS "python3 >= 3.7.9")
+set(CPACK_RPM_PACKAGE_SUGGESTS "python3-argcomplete")
set(CPACK_RPM_DEV_PACKAGE_SUGGESTS ${CPACK_RPM_PACKAGE_SUGGESTS})
set(CPACK_RPM_ASAN_PACKAGE_SUGGESTS ${CPACK_RPM_PACKAGE_SUGGESTS})
+# python version gated by rhel8 :(
+set(CPACK_RPM_PACKAGE_REQUIRES "python3 >= 3.6.8, python3-pip")
+set(CPACK_RPM_DEV_PACKAGE_REQUIRES ${CPACK_RPM_PACKAGE_REQUIRES})
+set(CPACK_RPM_ASAN_PACKAGE_REQUIRES ${CPACK_RPM_PACKAGE_REQUIRES})
# don't terminate if bytecompile of python files fails
set(CPACK_RPM_SPEC_MORE_DEFINE "%define _python_bytecompile_errors_terminate_build 0")
@@ -294,17 +308,12 @@ endif()
# https://bugzilla.redhat.com/show_bug.cgi?id=1811358
# set(CPACK_RPM_PACKAGE_SUGGESTS "sudo, libdrm-dev")
-#Prepare final version for the CPACK use
-set(CPACK_PACKAGE_VERSION
- "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${ROCM_VERSION_FOR_PACKAGE}"
-)
-
## Process the Rpm install/remove scripts to update the CPACK variables
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/RPM/post.in" RPM/post @ONLY)
-configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/RPM/preun.in" RPM/preun @ONLY )
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/RPM/preun.in" RPM/preun @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/RPM/postun.in" RPM/postun @ONLY)
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/post")
-set ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/preun" )
+set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/preun")
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/postun")
#Set the names now using CPACK utility
diff --git a/projects/amdsmi/DEBIAN/postinst.in b/projects/amdsmi/DEBIAN/postinst.in
index 097bb34bed..c168fa4d75 100755
--- a/projects/amdsmi/DEBIAN/postinst.in
+++ b/projects/amdsmi/DEBIAN/postinst.in
@@ -104,8 +104,39 @@ do_ldconfig() {
fi
}
+do_install_amdsmi_python_lib() {
+ # get python version
+ local python3_minor_version
+ python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
+ if [ $? -ne 0 ]; then
+ echo "[WARNING] Could not determine python version. "\
+ "AMD-SMI python library will not be installed."
+ return
+ fi
+
+ # check if python version is supported
+ if [ "$python3_minor_version" -lt 6 ]; then
+ echo "[WARNING] AMD-SMI python library is not "\
+ "supported on python version 3.$python3_minor_version. "\
+ "AMD-SMI python library will not be installed."
+ return
+ fi
+
+ # Remove old python library
+ python3 -m pip uninstall amdsmi --yes --quiet
+
+ # install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
+ local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
+ python3 -m pip install "$python_lib_path"
+ python3 -m pip show argcomplete
+ if [ $? -ne 1 ]; then
+ activate-global-python-argcomplete
+ fi
+}
+
case "$1" in
( configure )
+ do_install_amdsmi_python_lib || return 0
do_ldconfig
do_configureLogrotate || return 0
;;
diff --git a/projects/amdsmi/DEBIAN/prerm.in b/projects/amdsmi/DEBIAN/prerm.in
index 3a4ab7ff26..186593ce2e 100755
--- a/projects/amdsmi/DEBIAN/prerm.in
+++ b/projects/amdsmi/DEBIAN/prerm.in
@@ -33,11 +33,37 @@ return_logrotateToOrigConfig() {
fi
}
+rm_python_lib() {
+ # get python version
+ local python3_minor_version
+ python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
+ if [ $? -ne 0 ]; then
+ echo "[WARNING] Could not determine python version. "\
+ "AMD-SMI python library will not be uninstalled."
+ return
+ fi
+
+ # check if python version is supported
+ if [ "$python3_minor_version" -lt 6 ]; then
+ echo "[WARNING] AMD-SMI python library is not supported on python version 3.$python3_minor_version. "\
+ "AMD-SMI python library will not be uninstalled."
+ return
+ fi
+
+ python3 -m pip uninstall amdsmi --yes
+ python3 -m pip show amdsmi
+ if [ $? -ne 1 ]; then
+ echo "[WARNING] AMD-SMI python library (amdsmi) is still installed. "\
+ "Check post install to ensure version is correct"
+ return
+ fi
+}
case "$1" in
( remove | upgrade)
# remove old gpuv-smi symlink
rm -f @CPACK_PACKAGING_INSTALL_PREFIX@/bin/gpuv-smi &> /dev/null
+ rm_python_lib || return 0
rm_ldconfig
rm_pyc
rm_logFolder
diff --git a/projects/amdsmi/README.md b/projects/amdsmi/README.md
index 61d36acdd0..c4568921b9 100755
--- a/projects/amdsmi/README.md
+++ b/projects/amdsmi/README.md
@@ -6,16 +6,83 @@ For additional information refer to [ROCm Documentation](https://rocm.docs.amd.c
Note: This project is a successor to [rocm_smi_lib](https://github.com/RadeonOpenCompute/rocm_smi_lib)
+and [esmi_ib_library](https://github.com/amd/esmi_ib_library)
+
## Supported platforms
At initial release, the AMD SMI library will support Linux bare metal and Linux virtual machine guest for AMD GPUs. In the future release, the library will be extended to support AMD EPYC™ CPUs.
AMD SMI library can run on AMD ROCm supported platforms, please refer to [List of Supported Operating Systems and GPUs](https://rocm.docs.amd.com/en/latest/release/gpu_os_support.html)
-To run the AMD SMI library, the amdgpu driver needs to be installed. Optionally, the libdrm can be
+To run the AMD SMI library, the amdgpu driver and the hsmp driver needs to be installed. Optionally, the libdrm can be
installed to query firmware information and hardware IPs.
-## Usage Basics
+## Install CLI Tool and Libraries
+
+### Requirements
+
+* python 3.6.8+ 64-bit
+* amdgpu driver must be loaded for amdsmi_init() to pass
+
+### Installation
+
+* Install amdgpu driver
+* Install amd-smi-lib package through package manager
+* amd-smi --help
+
+### Install Example for Ubuntu 22.04
+
+``` bash
+apt install amd-smi-lib
+# if installed with rocm ignore the export
+export PATH="$PATH:/opt/rocm/bin"
+amd-smi --help
+```
+
+### Optional autocompletion
+
+`amd-smi` cli application supports autocompletion. The package should attempt to install it, if argcomplete is not installed you can enable it by using the following commands:
+
+```bash
+python3 -m pip install argcomplete
+activate-global-python-argcomplete
+# restart shell to enable
+```
+
+### Manual/Multiple Rocm Instance Python Library Install
+
+In the event there are multiple rocm installations and pyenv is not being used, to use the correct amdsmi version you must uninstall previous versions of amd-smi and install the version you want directly from your rocm instance.
+
+#### Python Library Install Example for Ubuntu 22.04
+
+Remove previous amdsmi installation:
+
+```bash
+python3 -m pip list | grep amd
+python3 -m pip uninstall amdsmi
+```
+
+Then install Python library from your target rocm instance:
+
+``` bash
+apt install amd-smi-lib
+cd /opt/rocm/share/amd_smi
+python3 -m pip install --upgrade pip
+python3 -m pip install --user .
+```
+
+Now you have the amdsmi python library in your python path:
+
+``` bash
+~$ python3
+Python 3.8.10 (default, May 26 2023, 14:05:08)
+[GCC 9.4.0] on linux
+Type "help", "copyright", "credits" or "license" for more information.
+>>> import amdsmi
+>>>
+```
+
+## Usage Basics for the C Library
### Device/Socket handles
@@ -25,6 +92,10 @@ GPU device and CPU device on the same socket. Moreover, for MI200, it may have m
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_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.
+To discover the cpu sockets in the system, `amdsmi_get_cpusocket_handles()` is called to get list of cpu sockets
+handles, which in turn can be used to query the cpu cores in that cpu socket using `amdsmi_get_cpucore_handles()`. The cpu core handler is used to distinguish the detected cpu cores from one another.
+
+
## Hello AMD SMI
The only required AMD-SMI call for any program that wants to use AMD-SMI is the `amdsmi_init()` call. This call initializes some internal data structures that will be used by subsequent AMD-SMI calls. In the call, a flag can be passed if the application is only interested in a specific device type.
@@ -127,92 +198,7 @@ The output will be in `docs/_build/html`.
For additional details, see the [ROCm Contributing Guide](https://rocm.docs.amd.com/en/latest/contributing.html#building-documentation)
-## Install CLI Tool and Python Library
-
-### Requirements
-
-* python 3.7+ 64-bit
-* amdgpu driver must be loaded for amdsmi_init() to pass
-
-### Optional autocompletion
-
-`amd-smi` cli application supports autocompletion. It is enabled by using the
-following commands:
-
-```bash
-python3 -m pip install argcomplete
-activate-global-python-argcomplete
-# restart shell to enable
-```
-
-### CLI Installation
-
-Before amd-smi install, ensure previous versions of amdsmi library are uninstalled using pip:
-
-```bash
-python3 -m pip list | grep amd
-python3 -m pip uninstall amdsmi
-```
-
-* Install amdgpu driver
-* Install amd-smi-lib package through package manager
-* amd-smi --help
-
-### Install Example for Ubuntu 22.04
-
-``` bash
-python3 -m pip list | grep amd
-python3 -m pip uninstall amdsmi
-apt install amd-smi-lib
-amd-smi --help
-```
-
-### Python Development Library Installation
-
-This option is for users who want to develop their own scripts using amd-smi's python library
-
-Verify that your python version is 3.7+ to install the python library
-
-* Install amdgpu driver
-* Install amd-smi-lib package through package manager
-* cd /opt/rocm/share/amd_smi
-* python3 -m pip install --upgrade pip
-* python3 -m pip install --user .
-* import amdsmi in python to start development
-
-Warning: this will take precedence over the cli tool's library install, to avoid issues run these steps after every amd-smi-lib update.
-
-#### Older RPM Packaged OS's
-
-The default python versions in older RPM based OS's are not gauranteed to have the minium version.
-
-For example RHEL 8 and SLES 15 are 3.6.8 and 3.6.15 . You will need to ensure the latest yaml package is installed ( pyyaml >= 5.1) pyyaml is installed to your pip instance:
-
-``` bash
-python3 -m pip install pyyaml
-amd-smi list
-```
-
-While the CLI will work with these older python versions, to install the python development library you need to upgrade to python 3.7+
-
-#### Python Library Install Example for Ubuntu 22.04
-
-``` bash
-apt install amd-smi-lib
-amd-smi --help
-cd /opt/rocm/share/amd_smi
-python3 -m pip install --upgrade pip
-python3 -m pip install --user .
-```
-
-``` bash
-python3
-Python 3.8.10 (default, May 26 2023, 14:05:08)
-[GCC 9.4.0] on linux
-Type "help", "copyright", "credits" or "license" for more information.
->>> import amdsmi
->>>
-```
+## Building AMD SMI
### Rebuilding Python wrapper
@@ -230,8 +216,6 @@ Note: To be able to re-generate python wrapper you need **docker** installed.
Note: python_wrapper is NOT automatically re-generated. You must run `./update_wrapper.sh`.
-## Building AMD SMI
-
### Additional Required software for building
In order to build the AMD SMI library, the following components are required. Note that the software versions listed are what was used in development. Earlier versions are not guaranteed to work:
@@ -242,7 +226,7 @@ In order to build the AMD SMI library, the following components are required. No
In order to build the AMD SMI python package, the following components are required:
* clang (14.0 or above)
-* python (3.7 or above)
+* python (3.6.8 or above)
* virtualenv - `python3 -m pip install virtualenv`
In order to build the latest documentation, the following are required:
diff --git a/projects/amdsmi/RPM/post.in b/projects/amdsmi/RPM/post.in
index 454ad2909f..cf760e9d07 100755
--- a/projects/amdsmi/RPM/post.in
+++ b/projects/amdsmi/RPM/post.in
@@ -104,8 +104,39 @@ do_ldconfig() {
fi
}
+do_install_amdsmi_python_lib() {
+ # get python version
+ local python3_minor_version
+ python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
+ if [ $? -ne 0 ]; then
+ echo "[WARNING] Could not determine python version. "\
+ "AMD-SMI python library will not be installed."
+ return
+ fi
+
+ # check if python version is supported
+ if [ "$python3_minor_version" -lt 6 ]; then
+ echo "[WARNING] AMD-SMI python library is not "\
+ "supported on python version 3.$python3_minor_version. "\
+ "AMD-SMI python library will not be installed."
+ return
+ fi
+
+ # Remove old python library
+ python3 -m pip uninstall amdsmi --yes --quiet
+
+ # install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
+ local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
+ python3 -m pip install "$python_lib_path"
+ python3 -m pip show argcomplete
+ if [ $? -ne 1 ]; then
+ activate-global-python-argcomplete
+ fi
+}
+
# post install or upgrade, $i is 1 or 2 -> do these actions
if [ "$1" -ge 1 ]; then
+ do_install_amdsmi_python_lib || return 0
do_ldconfig
do_configureLogrotate || return 0
fi
diff --git a/projects/amdsmi/RPM/preun.in b/projects/amdsmi/RPM/preun.in
index f607a4ac7c..00bd4d374c 100755
--- a/projects/amdsmi/RPM/preun.in
+++ b/projects/amdsmi/RPM/preun.in
@@ -25,10 +25,37 @@ return_logrotateToOrigConfig() {
fi
}
+rm_python_lib() {
+ # get python version
+ local python3_minor_version
+ python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
+ if [ $? -ne 0 ]; then
+ echo "[WARNING] Could not determine python version. "\
+ "AMD-SMI python library will not be uninstalled."
+ return
+ fi
+
+ # check if python version is supported
+ if [ "$python3_minor_version" -lt 6 ]; then
+ echo "[WARNING] AMD-SMI python library is not supported on python version 3.$python3_minor_version. "\
+ "AMD-SMI python library will not be uninstalled."
+ return
+ fi
+
+ python3 -m pip uninstall amdsmi --yes
+ python3 -m pip show amdsmi
+ if [ $? -ne 1 ]; then
+ echo "[WARNING] AMD-SMI python library (amdsmi) is still installed. "\
+ "Check post install to ensure version is correct"
+ return
+ fi
+}
+
if [ "$1" -le 1 ]; then
# perform the below actions for rpm remove($1=0) or upgrade($1=1) operations
# remove old gpuv-smi symlink
rm -f @CPACK_PACKAGING_INSTALL_PREFIX@/bin/gpuv-smi &> /dev/null
+ rm_python_lib || return 0
rm_pyc
rm_logFolder
return_logrotateToOrigConfig
diff --git a/projects/amdsmi/amdsmi_cli/CMakeLists.txt b/projects/amdsmi/amdsmi_cli/CMakeLists.txt
index 3cd72a9fb1..96a9c4d4ba 100644
--- a/projects/amdsmi/amdsmi_cli/CMakeLists.txt
+++ b/projects/amdsmi/amdsmi_cli/CMakeLists.txt
@@ -9,10 +9,12 @@ set(PY_CLI_INSTALL_DIR
"${CMAKE_INSTALL_LIBEXECDIR}" CACHE STRING
"CLI tool installation directory")
+# populate version string
+configure_file(_version.py.in ${PY_PACKAGE_DIR}/_version.py @ONLY)
+
# hard-linking instead of copying avoids unnecessarry regeneration of packaged files
add_custom_command(
OUTPUT ${PY_PACKAGE_DIR}/__init__.py
- ${PY_PACKAGE_DIR}/_version.py
${PY_PACKAGE_DIR}/amdsmi_cli.py
${PY_PACKAGE_DIR}/amdsmi_commands.py
${PY_PACKAGE_DIR}/amdsmi_helpers.py
@@ -26,7 +28,6 @@ add_custom_command(
DEPENDS amdsmi_cli
COMMAND mkdir -p ${PY_PACKAGE_DIR}/
COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${PY_PACKAGE_DIR}/
- COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/_version.py ${PY_PACKAGE_DIR}/
COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_cli.py ${PY_PACKAGE_DIR}/
COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_commands.py ${PY_PACKAGE_DIR}/
COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_helpers.py ${PY_PACKAGE_DIR}/
diff --git a/projects/amdsmi/amdsmi_cli/README.md b/projects/amdsmi/amdsmi_cli/README.md
index 2d48154e50..0be74e1c29 100644
--- a/projects/amdsmi/amdsmi_cli/README.md
+++ b/projects/amdsmi/amdsmi_cli/README.md
@@ -10,17 +10,10 @@ Recommended: At least one AMD GPU with AMD driver installed
### Requirements
-* python 3.7+ 64-bit
+* python 3.6.8+ 64-bit
* amdgpu driver must be loaded for amdsmi_init() to pass
-### CLI Installation
-
-Before amd-smi install, ensure previous versions of amdsmi library are uninstalled using pip:
-
-```bash
-python3 -m pip list | grep amd
-python3 -m pip uninstall amdsmi
-```
+### Installation
* Install amdgpu driver
* Install amd-smi-lib package through package manager
@@ -29,42 +22,35 @@ python3 -m pip uninstall amdsmi
### Install Example for Ubuntu 22.04
``` bash
-python3 -m pip list | grep amd
-python3 -m pip uninstall amdsmi
apt install amd-smi-lib
amd-smi --help
```
-### Python Development Library Installation
+### Optional autocompletion
-This option is for users who want to develop their own scripts using amd-smi's python library
+`amd-smi` cli application supports autocompletion. The package should attempt to install it, if argcomplete is not installed you can enable it by using the following commands:
-Verify that your python version is 3.7+ to install the python library
-
-* Install amdgpu driver
-* Install amd-smi-lib package through package manager
-* cd /opt/rocm/share/amd_smi
-* python3 -m pip install --upgrade pip
-* python3 -m pip install --user .
-* import amdsmi in python to start development
-
-Warning: this will take precedence over the cli tool's library install, to avoid issues run these steps after every amd-smi-lib update.
-
-#### Older RPM Packaged OS's
-
-The default python versions in older RPM based OS's are not gauranteed to have the minium version.
-
-For example RHEL 8 and SLES 15 are 3.6.8 and 3.6.15 . You will need to ensure the latest yaml package is installed ( pyyaml >= 5.1) pyyaml is installed to your pip instance:
-
-``` bash
-python3 -m pip install pyyaml
-amd-smi list
+```bash
+python3 -m pip install argcomplete
+activate-global-python-argcomplete
+# restart shell to enable
```
-While the CLI will work with these older python versions, to install the python development library you need to upgrade to python 3.7+
+### Manual/Multiple Rocm Instance Python Library Install
+
+In the event there are multiple rocm installations and pyenv is not being used, to use the correct amdsmi version you must uninstall previous versions of amd-smi and install the version you want directly from your rocm instance.
#### Python Library Install Example for Ubuntu 22.04
+Remove previous amdsmi installation:
+
+```bash
+python3 -m pip list | grep amd
+python3 -m pip uninstall amdsmi
+```
+
+Then install Python library from your target rocm instance:
+
``` bash
apt install amd-smi-lib
amd-smi --help
@@ -73,6 +59,8 @@ python3 -m pip install --upgrade pip
python3 -m pip install --user .
```
+Now you have the amdsmi python library in your python path:
+
``` bash
~$ python3
Python 3.8.10 (default, May 26 2023, 14:05:08)
@@ -132,8 +120,8 @@ GPU with some basic information for each VF.
optional arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
Command Modifiers:
--json Displays output in JSON format (human readable by default).
@@ -155,8 +143,8 @@ If no static argument is provided, all static information will be displayed.
Static Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
-a, --asic All asic information
-b, --bus All bus information
-V, --vbios All video bios information (if available)
@@ -187,8 +175,8 @@ If no GPU is specified, return firmware information for all GPUs on the system.
Firmware Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
-f, --ucode-list, --fw-list All FW list information
Command Modifiers:
@@ -209,8 +197,8 @@ If no GPU is specified, return bad page information for all GPUs on the system.
Bad Pages Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
-p, --pending Displays all pending retired pages
-r, --retired Displays retired pages
-u, --un-res Displays unreservable pages
@@ -235,8 +223,8 @@ If no metric argument is provided all metric information will be displayed.
Metric arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
-w, --watch INTERVAL Reprint the command in a loop of INTERVAL seconds
-W, --watch_time TIME The total TIME to watch the given command
-i, --iterations ITERATIONS Total number of ITERATIONS to loop on the given command
@@ -275,8 +263,8 @@ If no process argument is provided all process information will be displayed.
Process arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID: 0 | BDF: 0000:23:00.0 | UUID: c4ff73bf-0000-1000-802e-0812b504ed69
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
-w, --watch INTERVAL Reprint the command in a loop of INTERVAL seconds
-W, --watch_time TIME The total TIME to watch the given command
-i, --iterations ITERATIONS Total number of ITERATIONS to loop on the given command
@@ -304,8 +292,8 @@ If no GPU is specified, returns event information for all GPUs on the system.
Event Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
Command Modifiers:
--json Displays output in JSON format (human readable by default).
@@ -326,8 +314,8 @@ If no topology argument is provided all topology information will be displayed.
Topology arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID:0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
-a, --access Displays link accessibility between GPUs
-w, --weight Displays relative weight between GPUs
-o, --hops Displays the number of hops between GPUs
@@ -355,8 +343,8 @@ A set argument must be provided; Multiple set arguments are accepted
Set Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID: 0 | BDF: 0000:23:00.0 | UUID: c4ff73bf-0000-1000-802e-0812b504ed69
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
-f, --fan % Set GPU fan speed (0-255 or 0-100%)
-l, --perf-level LEVEL Set performance level
-P, --profile SETPROFILE Set power profile level (#) or a quoted string of custom profile attributes
@@ -386,8 +374,8 @@ A reset argument must be provided; Multiple reset arguments are accepted
Reset Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
- ID: 0 | BDF: 0000:23:00.0 | UUID: c4ff73bf-0000-1000-802e-0812b504ed69
- all | Selects all devices
+ ID: 0 | BDF:0000:23:00.0 | UUID:ffff73bf-0000-1000-80ff-ffffffffffff
+ all | Selects all devices
-G, --gpureset Reset the specified GPU
-c, --clocks Reset clocks and overdrive to default
-f, --fans Reset fans to automatic (driver) control
diff --git a/projects/amdsmi/amdsmi_cli/__init__.py b/projects/amdsmi/amdsmi_cli/__init__.py
index 608c46bbe2..6a5649080e 100644
--- a/projects/amdsmi/amdsmi_cli/__init__.py
+++ b/projects/amdsmi/amdsmi_cli/__init__.py
@@ -1 +1 @@
-__version__ = "23.4.0.0"
+from _version import __version__
diff --git a/projects/amdsmi/amdsmi_cli/_version.py b/projects/amdsmi/amdsmi_cli/_version.py
deleted file mode 100644
index 608c46bbe2..0000000000
--- a/projects/amdsmi/amdsmi_cli/_version.py
+++ /dev/null
@@ -1 +0,0 @@
-__version__ = "23.4.0.0"
diff --git a/projects/amdsmi/amdsmi_cli/_version.py.in b/projects/amdsmi/amdsmi_cli/_version.py.in
new file mode 100644
index 0000000000..479e19fe2e
--- /dev/null
+++ b/projects/amdsmi/amdsmi_cli/_version.py.in
@@ -0,0 +1 @@
+__version__ = "@amd_smi_libraries_VERSION_STRING@"
diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py
index ca01290628..6c8e95398e 100644
--- a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py
+++ b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py
@@ -20,7 +20,6 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-import argparse
import logging
import sys
import threading
@@ -51,8 +50,12 @@ class AMDSMICommands():
sys.exit(-1)
else:
raise e
+
+ if len(self.device_handles) == 0:
+ logging.error('Unable to detect any devices, check if driver is initialized (amdgpu not found in modules)')
+ sys.exit(-1)
+
self.stop = ''
- self.all_arguments = False
def version(self, args):
@@ -133,7 +136,8 @@ class AMDSMICommands():
def static(self, args, multiple_devices=False, gpu=None, asic=None,
bus=None, vbios=None, limit=None, driver=None, ras=None,
- board=None, numa=None, vram=None, cache=None, partition=None):
+ board=None, numa=None, vram=None, cache=None, partition=None,
+ dfc_ucode=None, fb_info=None, num_vf=None):
"""Get Static information for target gpu
Args:
@@ -151,6 +155,9 @@ class AMDSMICommands():
vram (bool, optional): Value override for args.vram. Defaults to None.
cache (bool, optional): Value override for args.cache. Defaults to None.
partition (bool, optional): Value override for args.partition. Defaults to None.
+ dfc_ucode (bool, optional): Value override for args.dfc_ucode. Defaults to None.
+ fb_info (bool, optional): Value override for args.fb_info. Defaults to None.
+ num_vf (bool, optional): Value override for args.num_vf. Defaults to None.
Raises:
IndexError: Index error if gpu list is empty
@@ -167,8 +174,6 @@ class AMDSMICommands():
args.bus = bus
if vbios:
args.vbios = vbios
- if numa:
- args.numa = numa
if board:
args.board = board
if driver:
@@ -177,6 +182,11 @@ class AMDSMICommands():
args.vram = vram
if cache:
args.cache = cache
+
+ # Store args that are applicable to the current platform
+ current_platform_args = ["asic", "bus", "vbios", "driver", "vram", "cache", "board"]
+ current_platform_values = [args.asic, args.bus, args.vbios, args.driver, args.vram, args.cache, args.board]
+
if self.helpers.is_linux() and self.helpers.is_baremetal():
if ras:
args.ras = ras
@@ -184,6 +194,24 @@ class AMDSMICommands():
args.partition = partition
if limit:
args.limit = limit
+ current_platform_args += ["ras", "limit", "partition"]
+ current_platform_values += [args.ras, args.limit, args.partition]
+
+ if self.helpers.is_linux() and not self.helpers.is_virtual_os():
+ if numa:
+ args.numa = numa
+ current_platform_args += ["numa"]
+ current_platform_values += [args.numa]
+
+ if self.helpers.is_hypervisor():
+ if dfc_ucode:
+ args.dfc_ucode = dfc_ucode
+ if fb_info:
+ args.fb_info = fb_info
+ if num_vf:
+ args.num_vf = num_vf
+ current_platform_args += ["dfc_ucode", "fb_info", "num_vf"]
+ current_platform_values += [args.dfc_ucode, args.fb_info, args.num_vf]
# Handle No GPU passed
if args.gpu == None:
@@ -195,19 +223,19 @@ class AMDSMICommands():
return # This function is recursive
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 not any([args.asic, args.bus, args.vbios, args.limit, args.board, args.ras, args.driver, args.numa, args.vram, args.cache, args.partition]):
- args.asic = args.bus = args.vbios = args.limit = args.board = args.ras = args.driver = args.numa = args.vram = args.cache = args.partition = self.all_arguments = True
- if self.helpers.is_linux() and self.helpers.is_virtual_os():
- if not any([args.asic, args.bus, args.vbios, args.board, args.driver, args.vram, args.cache]):
- args.asic = args.bus = args.vbios = args.board = args.driver = args.vram = args.cache = self.all_arguments = True
-
- static_dict = {}
-
# Get gpu_id for logging
gpu_id = self.helpers.get_gpu_id_from_device_handle(args.gpu)
+ logging.debug(f"Static Arg information for GPU {gpu_id} on {self.helpers.os_info()}")
+ logging.debug(f"Applicable Args: {current_platform_args}")
+ logging.debug(f"Arg Values: {current_platform_values}")
+ # Set the platform applicable args to True if no args are set
+ if not any(current_platform_values):
+ for arg in current_platform_args:
+ setattr(args, arg, True)
+
+ static_dict = {}
+
if args.asic:
try:
asic_info = amdsmi_interface.amdsmi_get_gpu_asic_info(args.gpu)
@@ -284,8 +312,7 @@ class AMDSMICommands():
static_dict['board'] = board_info
except amdsmi_exception.AmdSmiLibraryException as e:
logging.debug("Failed to get board info for gpu %s | %s", gpu_id, e.get_error_info())
-
- if self.helpers.is_linux() and self.helpers.is_baremetal():
+ if 'limit' in current_platform_args:
if args.limit:
# Power limits
try:
@@ -398,7 +425,6 @@ class AMDSMICommands():
limit_info['shutdown_hotspot_temperature'] = shutdown_temp_hotspot_limit
limit_info['shutdown_vram_temperature'] = shutdown_temp_vram_limit
static_dict['limit'] = limit_info
-
if args.driver:
driver_info = {"driver_name" : "N/A",
"driver_version" : "N/A",
@@ -445,16 +471,24 @@ class AMDSMICommands():
if args.cache:
try:
cache_info = amdsmi_interface.amdsmi_get_gpu_cache_info(args.gpu)
+ for cache_key, cache_dict in cache_info.items():
+ for key, value in cache_dict.items():
+ if key == 'cache_size' or key == 'cache_level':
+ continue
+ if value:
+ cache_info[cache_key][key] = "ENABLED"
+ else:
+ cache_info[cache_key][key] = "DISABLED"
if self.logger.is_human_readable_format():
for _ , cache_values in cache_info.items():
cache_values['cache_size'] = f"{cache_values['cache_size']} KB"
+
except amdsmi_exception.AmdSmiLibraryException as e:
cache_info = "N/A"
logging.debug("Failed to get cache info for gpu %s | %s", gpu_id, e.get_error_info())
static_dict['cache'] = cache_info
-
- if self.helpers.is_hypervisor() or self.helpers.is_baremetal():
+ if 'ras' in current_platform_args:
if args.ras:
ras_dict = {"eeprom_version": "N/A",
"parity_schema" : "N/A",
@@ -467,7 +501,7 @@ class AMDSMICommands():
ras_info = amdsmi_interface.amdsmi_get_gpu_ras_feature_info(args.gpu)
for key, value in ras_info.items():
if isinstance(value, int):
- if value >= 65535:
+ if value == 65535 or value == 0:
logging.debug(f"Failed to get ras {key} for gpu {gpu_id}")
ras_info[key] = "N/A"
continue
@@ -483,6 +517,7 @@ class AMDSMICommands():
logging.debug("Failed to get ras block features for gpu %s | %s", gpu_id, e.get_error_info())
static_dict["ras"] = ras_dict
+ if 'partition' in current_platform_args:
if args.partition:
try:
compute_partition = amdsmi_interface.amdsmi_dev_compute_partition_get(args.gpu)
@@ -498,8 +533,7 @@ class AMDSMICommands():
static_dict['partition'] = {"compute_partition": compute_partition,
"memory_partition": memory_partition}
-
- if self.helpers.is_linux() and self.helpers.is_baremetal():
+ if 'numa' in current_platform_args:
if args.numa:
try:
numa_node_number = amdsmi_interface.amdsmi_topo_get_numa_node_number(args.gpu)
@@ -592,12 +626,11 @@ class AMDSMICommands():
for fw_index, fw_entry in enumerate(fw_info['fw_list']):
# Change fw_name to fw_id
fw_entry['fw_id'] = fw_entry.pop('fw_name').name.strip('FW_ID_')
- fw_entry['fw_version'] = fw_entry.pop('fw_version')
- firmware_identifier = 'FW'
+ fw_entry['fw_version'] = fw_entry.pop('fw_version') # popping to ensure order
# Add custom human readable formatting
if self.logger.is_human_readable_format():
- fw_info['fw_list'][fw_index] = {f'{firmware_identifier} {fw_index}': fw_entry}
+ fw_info['fw_list'][fw_index] = {f'FW {fw_index}': fw_entry}
else:
fw_info['fw_list'][fw_index] = fw_entry
@@ -750,7 +783,8 @@ class AMDSMICommands():
usage=None, watch=None, watch_time=None, iterations=None, power=None,
clock=None, temperature=None, ecc=None, ecc_block=None, pcie=None,
fan=None, voltage_curve=None, overdrive=None, perf_level=None,
- xgmi_err=None, energy=None, mem_usage=None):
+ xgmi_err=None, energy=None, mem_usage=None, schedule=None,
+ guard=None, guest_data=None, fb_usage=None, xgmi=None,):
"""Get Metric information for target gpu
Args:
@@ -775,6 +809,11 @@ class AMDSMICommands():
xgmi_err (bool, optional): Value override for args.xgmi_err. Defaults to None.
energy (bool, optional): Value override for args.energy. Defaults to None.
mem_usage (bool, optional): Value override for args.mem_usage. Defaults to None.
+ schedule (bool, optional): Value override for args.schedule. Defaults to None.
+ guard (bool, optional): Value override for args.guard. Defaults to None.
+ guest_data (bool, optional): Value override for args.guest_data. Defaults to None.
+ fb_usage (bool, optional): Value override for args.fb_usage. Defaults to None.
+ xgmi (bool, optional): Value override for args.xgmi. Defaults to None.
Raises:
IndexError: Index error if gpu list is empty
@@ -791,11 +830,18 @@ class AMDSMICommands():
args.watch_time = watch_time
if iterations:
args.iterations = iterations
- if self.helpers.is_linux():
+
+ # Store args that are applicable to the current platform
+ current_platform_args = []
+ current_platform_values = []
+
+ if not self.helpers.is_hypervisor() and not self.helpers.is_windows():
if mem_usage:
args.mem_usage = mem_usage
+ current_platform_args += ["mem_usage"]
+ current_platform_values += [args.mem_usage]
- if self.helpers.is_linux() and self.helpers.is_baremetal():
+ if self.helpers.is_hypervisor() or self.helpers.is_baremetal():
if usage:
args.usage = usage
if power:
@@ -806,10 +852,14 @@ class AMDSMICommands():
args.temperature = temperature
if ecc:
args.ecc = ecc
- if ecc_block:
- args.ecc_block = ecc_block
if pcie:
args.pcie = pcie
+ current_platform_args += ["usage", "power", "clock", "temperature", "ecc", "pcie"]
+ current_platform_values += [args.usage, args.power, args.clock, args.temperature, args.ecc, args.pcie]
+
+ if self.helpers.is_baremetal() and self.helpers.is_linux():
+ if ecc_block:
+ args.ecc_block = ecc_block
if fan:
args.fan = fan
if voltage_curve:
@@ -822,6 +872,22 @@ class AMDSMICommands():
args.xgmi_err = xgmi_err
if energy:
args.energy = energy
+ current_platform_args += ["ecc_block", "fan", "voltage_curve", "overdrive", "perf_level", "xgmi_err", "energy"]
+ current_platform_values += [args.ecc_block, args.fan, args.voltage_curve, args.overdrive, args.perf_level, args.xgmi_err, args.energy]
+
+ if self.helpers.is_hypervisor():
+ if schedule:
+ args.schedule = schedule
+ if guard:
+ args.guard = guard
+ if guest_data:
+ args.guest_data = guest_data
+ if fb_usage:
+ args.fb_usage = fb_usage
+ if xgmi:
+ args.xgmi = xgmi
+ current_platform_args += ["schedule", "guard", "guest_data", "fb_usage", "xgmi"]
+ current_platform_values += [args.schedule, args.guard, args.guest_data, args.fb_usage, args.xgmi]
# Handle No GPU passed
if args.gpu == None:
@@ -863,31 +929,27 @@ class AMDSMICommands():
else:
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 not any([args.mem_usage]):
- args.mem_usage = self.all_arguments = True
-
- if self.helpers.is_linux() and self.helpers.is_baremetal():
- if not any([args.usage, args.mem_usage, args.power, args.clock, args.temperature,
- args.ecc, args.ecc_block, args.pcie, args.fan, args.voltage_curve,
- args.overdrive, args.perf_level, args.xgmi_err, args.energy]):
- args.usage = args.mem_usage = args.power = args.clock = args.temperature = \
- args.ecc = args.ecc_block = args.pcie = args.fan = args.voltage_curve = \
- args.overdrive = args.perf_level = args.xgmi_err = args.energy = \
- self.all_arguments = True
-
- # Add timestamp and store values for specified arguments
- values_dict = {}
-
# Get gpu_id for logging
gpu_id = self.helpers.get_gpu_id_from_device_handle(args.gpu)
+
+ # Put the metrics table in the debug logs
try:
logging.debug("GPU Metrics table for %s | %s", gpu_id, amdsmi_interface.amdsmi_get_gpu_metrics_info(args.gpu))
except amdsmi_exception.AmdSmiLibraryException as e:
logging.debug("Unabled to load GPU Metrics table for %s | %s", gpu_id, e.err_info)
- if self.helpers.is_linux() and self.helpers.is_baremetal():
+ logging.debug(f"Metric Arg information for GPU {gpu_id} on {self.helpers.os_info()}")
+ logging.debug(f"Args: {current_platform_args}")
+ logging.debug(f"Values: {current_platform_values}")
+ # Set the platform applicable args to True if no args are set
+ if not any(current_platform_values):
+ for arg in current_platform_args:
+ setattr(args, arg, True)
+
+ # Add timestamp and store values for specified arguments
+ values_dict = {}
+
+ if "usage" in current_platform_args:
if args.usage:
try:
engine_usage = amdsmi_interface.amdsmi_get_gpu_activity(args.gpu)
@@ -896,7 +958,7 @@ class AMDSMICommands():
engine_usage['mm_ip_usage'] = engine_usage.pop('mm_activity')
for key, value in engine_usage.items():
- if value >= 65535:
+ if value == 65535:
engine_usage[key] = "N/A"
if self.logger.is_human_readable_format():
@@ -908,6 +970,7 @@ class AMDSMICommands():
except amdsmi_exception.AmdSmiLibraryException as e:
values_dict['usage'] = "N/A"
logging.debug("Failed to get gpu activity for gpu %s | %s", gpu_id, e.get_error_info())
+ if "power" in current_platform_args:
if args.power:
power_dict = {'current_power': "N/A",
'current_gfx_voltage': "N/A",
@@ -946,6 +1009,7 @@ class AMDSMICommands():
logging.debug("Failed to get power management status for gpu %s | %s", gpu_id, e.get_error_info())
values_dict['power'] = power_dict
+ if "clock" in current_platform_args:
if args.clock:
clocks = {}
clock_types = [amdsmi_interface.AmdSmiClkType.GFX,
@@ -1005,6 +1069,7 @@ class AMDSMICommands():
clocks['gfx'] = {"is_clk_locked": is_clk_locked}
values_dict['clock'] = clocks
+ if "temperature" in current_platform_args:
if args.temperature:
try:
temperature_edge_current = amdsmi_interface.amdsmi_get_temp_metric(
@@ -1049,6 +1114,7 @@ class AMDSMICommands():
temperatures[temperature_key] = f"{temperature_value} {unit}"
values_dict['temperature'] = temperatures
+ if "ecc" in current_platform_args:
if args.ecc:
ecc_count = {}
try:
@@ -1061,29 +1127,7 @@ class AMDSMICommands():
logging.debug("Failed to get ecc count for gpu %s | %s", gpu_id, e.get_error_info())
values_dict['ecc'] = ecc_count
- if args.ecc_block:
- ecc_dict = {}
- uncountable_blocks = ["ATHUB", "DF", "SMN", "SEM", "MP0", "MP1", "FUSE"]
- try:
- ras_states = amdsmi_interface.amdsmi_get_gpu_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']]
- # if the blocks are uncountable do not add them at all.
- if gpu_block.name not in uncountable_blocks:
- 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']}
- except amdsmi_exception.AmdSmiLibraryException as e:
- ecc_dict[state['block']] = {'correctable' : "N/A",
- 'uncorrectable': "N/A"}
- logging.debug("Failed to get ecc count for gpu %s at block %s | %s", gpu_id, gpu_block, e.get_error_info())
-
- values_dict['ecc_block'] = ecc_dict
- except amdsmi_exception.AmdSmiLibraryException as e:
- values_dict['ecc_block'] = "N/A"
- logging.debug("Failed to get ecc block features for gpu %s | %s", gpu_id, e.get_error_info())
+ if "pcie" in current_platform_args:
if args.pcie:
pcie_dict = {"current_lanes": "N/A",
"current_speed": "N/A",
@@ -1092,8 +1136,8 @@ class AMDSMICommands():
"replay_roll_over_count" : "N/A",
"nak_sent_count" : "N/A",
"nak_received_count" : "N/A",
- "current_bandwith_sent": "N/A",
- "current_bandwith_received": "N/A",
+ "current_bandwidth_sent": "N/A",
+ "current_bandwidth_received": "N/A",
"max_packet_size": "N/A"}
try:
@@ -1161,13 +1205,38 @@ class AMDSMICommands():
received = f"{received} MB/s"
pcie_bw['max_pkt_sz'] = f"{pcie_bw['max_pkt_sz']} B"
- pcie_dict['current_bandwith_sent'] = sent
- pcie_dict['current_bandwith_received'] = received
+ pcie_dict['current_bandwidth_sent'] = sent
+ pcie_dict['current_bandwidth_received'] = received
pcie_dict['max_packet_size'] = pcie_bw['max_pkt_sz']
except amdsmi_exception.AmdSmiLibraryException as e:
logging.debug("Failed to get pcie bandwidth for gpu %s | %s", gpu_id, e.get_error_info())
values_dict['pcie'] = pcie_dict
+ if "ecc_block" in current_platform_args:
+ if args.ecc_block:
+ ecc_dict = {}
+ uncountable_blocks = ["ATHUB", "DF", "SMN", "SEM", "MP0", "MP1", "FUSE"]
+ try:
+ ras_states = amdsmi_interface.amdsmi_get_gpu_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']]
+ # if the blocks are uncountable do not add them at all.
+ if gpu_block.name not in uncountable_blocks:
+ 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']}
+ except amdsmi_exception.AmdSmiLibraryException as e:
+ ecc_dict[state['block']] = {'correctable' : "N/A",
+ 'uncorrectable': "N/A"}
+ logging.debug("Failed to get ecc count for gpu %s at block %s | %s", gpu_id, gpu_block, e.get_error_info())
+
+ values_dict['ecc_block'] = ecc_dict
+ except amdsmi_exception.AmdSmiLibraryException as e:
+ values_dict['ecc_block'] = "N/A"
+ logging.debug("Failed to get ecc block features for gpu %s | %s", gpu_id, e.get_error_info())
+ if "fan" in current_platform_args:
if args.fan:
fan_dict = {"speed" : "N/A",
"max" : "N/A",
@@ -1200,6 +1269,7 @@ class AMDSMICommands():
logging.debug("Failed to get fan rpms for gpu %s | %s", args.gpu, e.get_error_info())
values_dict["fan"] = fan_dict
+ if "voltage_curve" in current_platform_args:
if args.voltage_curve:
try:
od_volt = amdsmi_interface.amdsmi_get_gpu_od_volt_info(args.gpu)
@@ -1219,6 +1289,7 @@ class AMDSMICommands():
except amdsmi_exception.AmdSmiLibraryException as e:
values_dict['voltage_curve'] = "N/A"
logging.debug("Failed to get voltage curve for gpu %s | %s", gpu_id, e.get_error_info())
+ if "overdrive" in current_platform_args:
if args.overdrive:
try:
overdrive_level = amdsmi_interface.amdsmi_get_gpu_overdrive_level(args.gpu)
@@ -1231,6 +1302,7 @@ class AMDSMICommands():
except amdsmi_exception.AmdSmiLibraryException as e:
values_dict['overdrive'] = "N/A"
logging.debug("Failed to get overdrive level for gpu %s | %s", gpu_id, e.get_error_info())
+ if "perf_level" in current_platform_args:
if args.perf_level:
try:
perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu)
@@ -1238,8 +1310,7 @@ class AMDSMICommands():
except amdsmi_exception.AmdSmiLibraryException as e:
values_dict['perf_level'] = "N/A"
logging.debug("Failed to get perf level for gpu %s | %s", gpu_id, e.get_error_info())
-
- if self.helpers.is_linux() and self.helpers.is_baremetal():
+ if "xgmi_err" in current_platform_args:
if args.xgmi_err:
try:
xgmi_err_status = amdsmi_interface.amdsmi_gpu_xgmi_error_status(args.gpu)
@@ -1247,6 +1318,7 @@ class AMDSMICommands():
except amdsmi_exception.AmdSmiLibraryException as e:
values_dict['xgmi_err'] = "N/A"
logging.debug("Failed to get xgmi error status for gpu %s | %s", gpu_id, e.get_error_info())
+ if "energy" in current_platform_args:
if args.energy:
try:
energy_dict = amdsmi_interface.amdsmi_get_energy_count(args.gpu)
@@ -1263,8 +1335,7 @@ class AMDSMICommands():
except amdsmi_interface.AmdSmiLibraryException as e:
values_dict['energy'] = "N/A"
logging.debug("Failed to get energy usage for gpu %s | %s", args.gpu, e.get_error_info())
-
- if self.helpers.is_linux() and (self.helpers.is_baremetal() or self.helpers.is_virtual_os()):
+ if "mem_usage" in current_platform_args:
if args.mem_usage:
unit = 'MB'
memory_usage = {'total_vram': "N/A",
@@ -1560,8 +1631,8 @@ class AMDSMICommands():
print('Press q and hit ENTER when you want to stop (listening will stop within 10 seconds)')
threads = []
- for gpu in range(len(args.gpu)):
- x = threading.Thread(target=self._event_thread, args=(self, gpu))
+ for device_handle in range(len(args.gpu)):
+ x = threading.Thread(target=self._event_thread, args=(self, device_handle))
threads.append(x)
x.start()
diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py b/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py
index 2efb9a573b..9e08bfbc70 100644
--- a/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py
+++ b/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py
@@ -154,6 +154,10 @@ class AMDSMIHelpers():
else:
raise e
+ if len(device_handles) == 0:
+ logging.error('Unable to find any devices, check if driver is initialized (amdgpu not found in modules)')
+ sys.exit(-1)
+
# Handle spacing for the gpu_choices_str
max_padding = int(math.log10(len(device_handles))) + 1
@@ -170,11 +174,11 @@ class AMDSMIHelpers():
id_padding = max_padding
else:
id_padding = max_padding - int(math.log10(gpu_id))
- gpu_choices_str += f"\tID: {gpu_id}{' ' * id_padding}| BDF: {bdf} | UUID: {uuid}\n"
+ gpu_choices_str += f"ID: {gpu_id}{' ' * id_padding}| BDF: {bdf} | UUID: {uuid}\n"
# Add the all option to the gpu_choices
gpu_choices["all"] = "all"
- gpu_choices_str += f"\t all{' ' * max_padding}| Selects all devices\n"
+ gpu_choices_str += f" all{' ' * max_padding}| Selects all devices\n"
return (gpu_choices, gpu_choices_str)
diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_init.py b/projects/amdsmi/amdsmi_cli/amdsmi_init.py
index a1cb955d02..8e56cbbd3a 100644
--- a/projects/amdsmi/amdsmi_cli/amdsmi_init.py
+++ b/projects/amdsmi/amdsmi_cli/amdsmi_init.py
@@ -30,8 +30,8 @@ import sys
from pathlib import Path
sys.path.append(f"{Path(__file__).resolve().parent}/../../share/amd_smi")
-sys.path.append("/opt/rocm/share/amd_smi")
+# If the python library is installed, it will overwrite the path above
from amdsmi import amdsmi_interface
from amdsmi import amdsmi_exception
diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_parser.py b/projects/amdsmi/amdsmi_cli/amdsmi_parser.py
index c730a5785c..d37eb80872 100644
--- a/projects/amdsmi/amdsmi_cli/amdsmi_parser.py
+++ b/projects/amdsmi/amdsmi_cli/amdsmi_parser.py
@@ -116,6 +116,7 @@ class AMDSMIParser(argparse.ArgumentParser):
outputformat = self.helpers.get_output_format()
raise amdsmi_cli_exceptions.AmdSmiInvalidParameterValueException(int_value, outputformat)
+
def _positive_int(self, int_value):
# Argument type validator
if int_value.isdigit(): # Is digit doesn't work on negative numbers
@@ -365,9 +366,10 @@ class AMDSMIParser(argparse.ArgumentParser):
if self.helpers.is_hypervisor() or self.helpers.is_baremetal():
static_parser.add_argument('-r', '--ras', action='store_true', required=False, help=ras_help)
static_parser.add_argument('-p', '--partition', action='store_true', required=False, help=partition_help)
- if self.helpers.is_linux():
- static_parser.add_argument('-l', '--limit', action='store_true', required=False, help=limit_help)
- static_parser.add_argument('-u', '--numa', action='store_true', required=False, help=numa_help)
+ static_parser.add_argument('-l', '--limit', action='store_true', required=False, help=limit_help)
+
+ if self.helpers.is_linux() and not self.helpers.is_virtual_os():
+ static_parser.add_argument('-u', '--numa', action='store_true', required=False, help=numa_help)
# Options to only display on a Hypervisor
if self.helpers.is_hypervisor():
@@ -445,7 +447,7 @@ class AMDSMIParser(argparse.ArgumentParser):
# Optional arguments help text
usage_help = "Displays engine usage information"
- # Help text for Arguments only Available on Virtual OS and Baremetal platforms
+ # Help text for Arguments only Available on Linux Virtual OS and Baremetal platforms
mem_usage_help = "Memory usage per block"
# Help text for Arguments only on Hypervisor and Baremetal platforms
@@ -467,7 +469,9 @@ class AMDSMIParser(argparse.ArgumentParser):
# Help text for Arguments only on Hypervisors
schedule_help = "All scheduling information"
guard_help = "All guard information"
- guest_help = "All guest data information"
+ guest_data_help = "All guest data information"
+ fb_usage_help = "Displays total and used Frame Buffer usage information"
+ xgmi_help = "Table of current XGMI metrics information"
# Create metric subparser
metric_parser = subparsers.add_parser('metric', help=metric_help, description=metric_subcommand_help)
@@ -482,8 +486,8 @@ class AMDSMIParser(argparse.ArgumentParser):
# Add Watch args
self._add_watch_arguments(metric_parser)
- # Optional Args for Virtual OS and Baremetal systems
- if self.helpers.is_virtual_os() or self.helpers.is_baremetal():
+ # Optional Args for Linux Virtual OS and Baremetal systems
+ if not self.helpers.is_hypervisor() and not self.helpers.is_windows():
metric_parser.add_argument('-m', '--mem-usage', action='store_true', required=False, help=mem_usage_help)
# Optional Args for Hypervisors and Baremetal systems
@@ -493,11 +497,11 @@ 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)
# Optional Args for Linux Baremetal Systems
if self.helpers.is_baremetal() and self.helpers.is_linux():
+ metric_parser.add_argument('-k', '--ecc-block', action='store_true', required=False, help=ecc_block_help)
metric_parser.add_argument('-f', '--fan', action='store_true', required=False, help=fan_help)
metric_parser.add_argument('-C', '--voltage-curve', action='store_true', required=False, help=vc_help)
metric_parser.add_argument('-o', '--overdrive', action='store_true', required=False, help=overdrive_help)
@@ -509,7 +513,9 @@ class AMDSMIParser(argparse.ArgumentParser):
if self.helpers.is_hypervisor():
metric_parser.add_argument('-s', '--schedule', action='store_true', required=False, help=schedule_help)
metric_parser.add_argument('-G', '--guard', action='store_true', required=False, help=guard_help)
- metric_parser.add_argument('-u', '--guest', action='store_true', required=False, help=guest_help)
+ metric_parser.add_argument('-u', '--guest-data', action='store_true', required=False, help=guest_data_help)
+ metric_parser.add_argument('-f', '--fb_usage', action='store_true', required=False, help=fb_usage_help)
+ metric_parser.add_argument('-m', '--xgmi', action='store_true', required=False, help=xgmi_help)
def _add_process_parser(self, subparsers, func):
@@ -574,10 +580,6 @@ class AMDSMIParser(argparse.ArgumentParser):
def _add_event_parser(self, subparsers, func):
- if self.helpers.is_virtual_os():
- # This subparser doesn't only apply to guest systems
- return
-
# Subparser help text
event_help = "Displays event information for the given GPU"
event_subcommand_help = "If no GPU is specified, returns event information for all GPUs on the system."
diff --git a/projects/amdsmi/cmake_modules/help_package.cmake b/projects/amdsmi/cmake_modules/help_package.cmake
index 94f71ce5d1..c1c47c3dd4 100644
--- a/projects/amdsmi/cmake_modules/help_package.cmake
+++ b/projects/amdsmi/cmake_modules/help_package.cmake
@@ -57,7 +57,7 @@ function(generic_package)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFORTIFY_SOURCE=2 -fstack-protector-all -Wcast-align" PARENT_SCOPE)
## More security breach mitigation flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,noexecstack -Wl,-znoexecheap -Wl,-z,relro" PARENT_SCOPE)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wtrampolines -Wl,-z,now -fPIE" PARENT_SCOPE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wtrampolines -Wl,-z,now" PARENT_SCOPE)
endif()
# Clang does not set the build-id
diff --git a/projects/amdsmi/cmake_modules/utils.cmake b/projects/amdsmi/cmake_modules/utils.cmake
index afaa442e59..7131761b67 100755
--- a/projects/amdsmi/cmake_modules/utils.cmake
+++ b/projects/amdsmi/cmake_modules/utils.cmake
@@ -159,6 +159,7 @@ function(get_package_version_number DEFAULT_VERSION_STRING VERSION_PREFIX GIT)
endif()
set(PKG_VERSION_STR "${PKG_VERSION_STR}-${VERSION_HASH}")
set(PKG_VERSION_STR ${PKG_VERSION_STR} PARENT_SCOPE)
+ set(PKG_VERSION_HASH ${VERSION_HASH} PARENT_SCOPE)
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR} PARENT_SCOPE)
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR} PARENT_SCOPE)
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH} PARENT_SCOPE)
diff --git a/projects/amdsmi/docs/.gitignore b/projects/amdsmi/docs/.gitignore
index b84233aed8..9095d45c48 100644
--- a/projects/amdsmi/docs/.gitignore
+++ b/projects/amdsmi/docs/.gitignore
@@ -9,3 +9,6 @@
/latex/
404.md
data/AMD-404.png
+
+# file below is overwritten by sphinx script!
+./esmi_lib_readme_link.md
diff --git a/projects/amdsmi/docs/conf.py b/projects/amdsmi/docs/conf.py
index bdfc6e486f..4e4806d16c 100644
--- a/projects/amdsmi/docs/conf.py
+++ b/projects/amdsmi/docs/conf.py
@@ -6,8 +6,20 @@
import subprocess
+import urllib
from rocm_docs import ROCmDocs
+esmi_readme_link = "https://raw.githubusercontent.com/amd/esmi_ib_library/master/docs/README.md"
+try:
+ # Try to override esmi_lib_readme_link.md with the github esmi readme contents
+ with urllib.request.urlopen(esmi_readme_link) as f:
+ esmi_readme = f.read().decode('utf-8')
+
+ with open("./esmi_lib_readme_link.md", "w", encoding='utf-8') as f:
+ f.write(esmi_readme)
+except urllib.error.URLError:
+ # don't care about the error because there is backup link in the file already
+ pass
get_version_year = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_YEAR\ //p" ../include/amd_smi/amdsmi.h'
get_version_major = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_MAJOR\ //p" ../include/amd_smi/amdsmi.h'
@@ -25,6 +37,9 @@ docs_core = ROCmDocs(f"{name} Documentation")
docs_core.run_doxygen(doxygen_root="doxygen", doxygen_path="doxygen/docBin/xml")
docs_core.enable_api_reference()
docs_core.setup()
+docs_core.html_theme_options = {
+ "repository_url": "https://github.com/RadeonOpenCompute/amdsmi"
+}
for sphinx_var in ROCmDocs.SPHINX_VARS:
globals()[sphinx_var] = getattr(docs_core, sphinx_var)
diff --git a/projects/amdsmi/docs/doxygen/Doxyfile b/projects/amdsmi/docs/doxygen/Doxyfile
index ca3cf2603d..5565da1dd1 100644
--- a/projects/amdsmi/docs/doxygen/Doxyfile
+++ b/projects/amdsmi/docs/doxygen/Doxyfile
@@ -1,4 +1,4 @@
-# Doxyfile 1.8.11
+# Doxyfile 1.9.6
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@@ -12,16 +12,26 @@
# For lists, items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (\" \").
+#
+# Note:
+#
+# Use doxygen to compare the used configuration file with the template
+# configuration file:
+# doxygen -x [configFile]
+# Use doxygen to compare the used configuration file with the template
+# configuration file without replacing the environment variables or CMake type
+# replacement variables:
+# doxygen -x_noenv [configFile]
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all text
-# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
-# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
-# for the list of possible encodings.
+# This tag specifies the encoding used for all characters in the configuration
+# file that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
# The default value is: UTF-8.
DOXYFILE_ENCODING = UTF-8
@@ -60,16 +70,28 @@ PROJECT_LOGO =
OUTPUT_DIRECTORY = docBin
-# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
+# sub-directories (in 2 levels) under the output directory of each output format
+# and will distribute the generated files over these directories. Enabling this
# option can be useful when feeding doxygen a huge amount of source files, where
# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
+# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to
+# control the number of sub-directories.
# The default value is: NO.
CREATE_SUBDIRS = NO
+# Controls the number of sub-directories that will be created when
+# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every
+# level increment doubles the number of directories, resulting in 4096
+# directories at level 8 which is the default and also the maximum value. The
+# sub-directories are organized in 2 levels, the first level always has a fixed
+# number of 16 directories.
+# Minimum value: 0, maximum value: 8, default value: 8.
+# This tag requires that the tag CREATE_SUBDIRS is set to YES.
+
+CREATE_SUBDIRS_LEVEL = 8
+
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
# characters to appear in the names of generated files. If set to NO, non-ASCII
# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
@@ -81,14 +103,14 @@ ALLOW_UNICODE_NAMES = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
-# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
-# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
-# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
-# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
-# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
-# Ukrainian and Vietnamese.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian,
+# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English
+# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek,
+# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with
+# English messages), Korean, Korean-en (Korean with English messages), Latvian,
+# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese,
+# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish,
+# Swedish, Turkish, Ukrainian and Vietnamese.
# The default value is: English.
OUTPUT_LANGUAGE = English
@@ -179,6 +201,16 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
+# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
+# such as
+# /***************
+# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
+# Javadoc-style will behave just like regular comments and it will not be
+# interpreted by doxygen.
+# The default value is: NO.
+
+JAVADOC_BANNER = NO
+
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
@@ -199,6 +231,14 @@ QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
+# By default Python docstrings are displayed as preformatted text and doxygen's
+# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
+# doxygen's special commands can be used and the contents of the docstring
+# documentation blocks is shown as doxygen documentation.
+# The default value is: YES.
+
+PYTHON_DOCSTRING = YES
+
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
# The default value is: YES.
@@ -222,21 +262,19 @@ TAB_SIZE = 4
# the documentation. An alias has the form:
# name=value
# For example adding
-# "sideeffect=@par Side Effects:\n"
+# "sideeffect=@par Side Effects:^^"
# will allow you to put the command \sideeffect (or @sideeffect) in the
# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines.
+# "Side Effects:". Note that you cannot put \n's in the value part of an alias
+# to insert newlines (in the resulting output). You can put ^^ in the value part
+# of an alias to insert a newline as if a physical newline was in the original
+# file. When you need a literal { or } or , in the value part of an alias you
+# have to escape them by means of a backslash (\), this can lead to conflicts
+# with the commands \{ and \} for these it is advised to use the version @{ and
+# @} or use a double escape (\\{ and \\})
ALIASES =
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-# Doxygen says following tag is obsolete; comment to quiet warning
-# TCL_SUBST =
-
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@@ -265,28 +303,40 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
+# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
+# sources only. Doxygen will then generate output that is more tailored for that
+# language. For instance, namespaces will be presented as modules, types will be
+# separated into more groups, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_SLICE = NO
+
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
-# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
-# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
-# Fortran. In the later case the parser tries to guess whether the code is fixed
-# or free formatted code, this is the default for Fortran type files), VHDL. For
-# instance to make doxygen treat .inc files as Fortran files (default is PHP),
-# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
+# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice,
+# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
+# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
+# tries to guess whether the code is fixed or free formatted code, this is the
+# default for Fortran type files). For instance to make doxygen treat .inc files
+# as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C.
#
# Note: For files without extension you can use no_extension as a placeholder.
#
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen.
+# the files are not read by doxygen. When specifying no_extension you should add
+# * to the FILE_PATTERNS.
+#
+# Note see also the list of default file extension mappings.
EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# documentation. See https://daringfireball.net/projects/markdown/ for details.
# The output of markdown processing is further processed by doxygen, so you can
# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
# case of backward compatibilities issues.
@@ -294,6 +344,15 @@ EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
+# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
+# to that level are automatically included in the table of contents, even if
+# they do not have an id attribute.
+# Note: This feature currently applies only to Markdown headings.
+# Minimum value: 0, maximum value: 99, default value: 5.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS = 5
+
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by putting a % sign in front of the word or
@@ -319,7 +378,7 @@ BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
# will parse them like normal C++ but will assume all classes use public instead
# of private inheritance when no explicit protection keyword is present.
# The default value is: NO.
@@ -344,6 +403,13 @@ IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that
# type (e.g. under the Public Functions section). Set it to NO to prevent
@@ -398,6 +464,19 @@ TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
+# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use
+# during processing. When set to 0 doxygen will based this on the number of
+# cores available in the system. You can set it explicitly to a value larger
+# than 0 to get more control over the balance between CPU load and processing
+# speed. At this moment only the input processing can be done using multiple
+# threads. Since this is still an experimental feature the default is set to 1,
+# which effectively disables parallel processing. Please report any issues you
+# encounter. Generating dot graphs in parallel is controlled by the
+# DOT_NUM_THREADS setting.
+# Minimum value: 0, maximum value: 32, default value: 1.
+
+NUM_PROC_THREADS = 1
+
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
@@ -418,6 +497,12 @@ EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
+# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
+# methods of a class will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIV_VIRTUAL = NO
+
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
@@ -455,6 +540,13 @@ EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
+# If this flag is set to YES, the name of an unnamed parameter in a declaration
+# will be determined by the corresponding definition. By default unnamed
+# parameters remain unnamed in the output.
+# The default value is: YES.
+
+RESOLVE_UNNAMED_PARAMS = YES
+
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
# undocumented members inside documented classes or files. If set to NO these
# members will be included in the various overviews, but no documentation
@@ -466,14 +558,15 @@ HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy. If set
# to NO, these classes will be included in the various overviews. This option
-# has no effect if EXTRACT_ALL is enabled.
+# will also hide undocumented C++ concepts if enabled. This option has no effect
+# if EXTRACT_ALL is enabled.
# The default value is: NO.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# (class|struct|union) declarations. If set to NO, these declarations will be
-# included in the documentation.
+# declarations. If set to NO, these declarations will be included in the
+# documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
@@ -492,12 +585,20 @@ HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
-# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
-# names in lower-case letters. If set to YES, upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-# The default value is: system dependent.
+# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
+# able to match the capabilities of the underlying filesystem. In case the
+# filesystem is case sensitive (i.e. it supports files in the same directory
+# whose names only differ in casing), the option must be set to YES to properly
+# deal with such files in case they appear in the input. For filesystems that
+# are not case sensitive the option should be set to NO to properly deal with
+# output files written for symbols that only differ in casing, such as for two
+# classes, one named CLASS and the other named Class, and to also support
+# references to files without having to specify the exact matching casing. On
+# Windows (including Cygwin) and MacOS, users should typically set this option
+# to NO, whereas on Linux or other Unix flavors it should typically be set to
+# YES.
+# Possible values are: SYSTEM, NO and YES.
+# The default value is: SYSTEM.
CASE_SENSE_NAMES = YES
@@ -515,6 +616,12 @@ HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
+# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class
+# will show which file needs to be included to use the class.
+# The default value is: YES.
+
+SHOW_HEADERFILE = YES
+
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
# the files that are included by a file in the documentation of that file.
# The default value is: YES.
@@ -672,7 +779,8 @@ FILE_VERSION_FILTER =
# output files in an output format independent way. To create the layout file
# that represents doxygen's defaults, run doxygen with the -l option. You can
# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
+# will be used as the name of the layout file. See also section "Changing the
+# layout of pages" for information.
#
# Note that if you run doxygen from a directory containing a file called
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
@@ -683,7 +791,7 @@ LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
@@ -718,34 +826,74 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
+# potential errors in the documentation, such as documenting some parameters in
+# a documented function twice, or documenting parameters that don't exist or
+# using markup commands wrongly.
# The default value is: YES.
WARN_IF_DOC_ERROR = YES
+# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete
+# function parameter documentation. If set to NO, doxygen will accept that some
+# parameters have no documentation without warning.
+# The default value is: YES.
+
+WARN_IF_INCOMPLETE_DOC = YES
+
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return
-# value. If set to NO, doxygen will only warn about wrong or incomplete
-# parameter documentation, but not about the absence of documentation.
+# value. If set to NO, doxygen will only warn about wrong parameter
+# documentation, but not about the absence of documentation. If EXTRACT_ALL is
+# set to YES then this flag will automatically be disabled. See also
+# WARN_IF_INCOMPLETE_DOC
# The default value is: NO.
WARN_NO_PARAMDOC = NO
+# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about
+# undocumented enumeration values. If set to NO, doxygen will accept
+# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: NO.
+
+WARN_IF_UNDOC_ENUM_VAL = NO
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
+# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
+# at the end of the doxygen process doxygen will return with a non-zero status.
+# Possible values are: NO, YES and FAIL_ON_WARNINGS.
+# The default value is: NO.
+
+WARN_AS_ERROR = NO
+
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
# will be replaced by the file and line number from which the warning originated
# and the warning text. Optionally the format may contain $version, which will
# be replaced by the version of the file (if it could be obtained via
# FILE_VERSION_FILTER)
+# See also: WARN_LINE_FORMAT
# The default value is: $file:$line: $text.
WARN_FORMAT = "$file:$line: $text"
+# In the $text part of the WARN_FORMAT command it is possible that a reference
+# to a more specific place is given. To make it easier to jump to this place
+# (outside of doxygen) the user can define a custom "cut" / "paste" string.
+# Example:
+# WARN_LINE_FORMAT = "'vi $file +$line'"
+# See also: WARN_FORMAT
+# The default value is: at line $line of file $file.
+
+WARN_LINE_FORMAT = "at line $line of file $file"
+
# The WARN_LOGFILE tag can be used to specify a file to which warning and error
# messages should be written. If left blank the output is written to standard
-# error (stderr).
+# error (stderr). In case the file specified cannot be opened for writing the
+# warning and error messages are written to standard error. When as file - is
+# specified the warning and error messages are written to standard output
+# (stdout).
WARN_LOGFILE =
@@ -765,12 +913,23 @@ INPUT = ../../README.md \
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: http://www.gnu.org/software/libiconv) for the list of
-# possible encodings.
+# documentation (see:
+# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
+# See also: INPUT_FILE_ENCODING
# The default value is: UTF-8.
INPUT_ENCODING = UTF-8
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify
+# character encoding on a per file pattern basis. Doxygen will compare the file
+# name with each pattern and apply the encoding instead of the default
+# INPUT_ENCODING) if there is a match. The character encodings are a list of the
+# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding
+# "INPUT_ENCODING" for further information on supported encodings.
+
+INPUT_FILE_ENCODING =
+
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories.
@@ -779,11 +938,15 @@ INPUT_ENCODING = UTF-8
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# read by doxygen.
#
+# Note the list of default checked file patterns might differ from the list of
+# default file extension mappings.
+#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
-# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
-# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
-# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
+# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml,
+# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C
+# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
+# *.vhdl, *.ucf, *.qsf and *.ice.
FILE_PATTERNS =
@@ -822,7 +985,7 @@ EXCLUDE_PATTERNS =
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
+# ANamespace::AClass, ANamespace::*Test
#
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
@@ -870,6 +1033,11 @@ IMAGE_PATH =
# code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly.
#
+# Note that doxygen will use the data processed and written to standard output
+# for further processing, therefore nothing else, like debug statements or used
+# commands (so in case of a Windows batch file always use @echo OFF), should be
+# written to standard output.
+#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
@@ -911,6 +1079,15 @@ FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
+# The Fortran standard specifies that for fixed formatted Fortran code all
+# characters from position 72 are to be considered as comment. A common
+# extension is to allow longer lines before the automatic comment starts. The
+# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can
+# be processed before the automatic comment starts.
+# Minimum value: 7, maximum value: 10000, default value: 72.
+
+FORTRAN_COMMENT_AFTER = 72
+
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
@@ -938,7 +1115,7 @@ INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# function all documented functions referencing it will be listed.
+# entity all documented functions referencing it will be listed.
# The default value is: NO.
REFERENCED_BY_RELATION = NO
@@ -970,12 +1147,12 @@ SOURCE_TOOLTIPS = YES
# If the USE_HTAGS tag is set to YES then the references to source code will
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
# source browser. The htags tool is part of GNU's global source tagging system
-# (see http://www.gnu.org/software/global/global.html). You will need version
+# (see https://www.gnu.org/software/global/global.html). You will need version
# 4.8.6 or higher.
#
# To use it do the following:
# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
# - Make sure the INPUT points to the root of the source tree
# - Run doxygen as normal
#
@@ -997,27 +1174,6 @@ USE_HTAGS = NO
VERBATIM_HEADERS = YES
-# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
-# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
-# cost of reduced performance. This can be particularly helpful with template
-# rich C++ code for which doxygen's built-in parser lacks the necessary type
-# information.
-# Note: The availability of this option depends on whether or not doxygen was
-# generated with the -Duse-libclang=ON option for CMake.
-# The default value is: NO.
-
-# comment following to quiet warning
-# CLANG_ASSISTED_PARSING = NO
-
-# If clang assisted parsing is enabled you can provide the compiler with command
-# line options that you would normally use when invoking the compiler. Note that
-# the include paths will already be set by doxygen for the files and directories
-# specified with INPUT and INCLUDE_PATH.
-# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-
-# comment following to quiet warning
-# CLANG_OPTIONS =
-
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@@ -1029,17 +1185,11 @@ VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = YES
-# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
-# which the alphabetical index list will be split.
-# Minimum value: 1, maximum value: 20, default value: 5.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all classes will
-# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
-# can be used to specify a prefix (or a list of prefixes) that should be ignored
-# while generating the index headers.
+# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
+# that should be ignored while generating the index headers. The IGNORE_PREFIX
+# tag works for classes, function and member names. The entity will be placed in
+# the alphabetical list under the first letter of the entity name that remains
+# after removing the prefix.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
IGNORE_PREFIX =
@@ -1138,10 +1288,23 @@ HTML_EXTRA_STYLESHEET = ../_doxygen/extra_stylesheet.css
HTML_EXTRA_FILES =
+# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
+# should be rendered with a dark or light theme.
+# Possible values are: LIGHT always generate light mode output, DARK always
+# generate dark mode output, AUTO_LIGHT automatically set the mode according to
+# the user preference, use light mode if no preference is set (the default),
+# AUTO_DARK automatically set the mode according to the user preference, use
+# dark mode if no preference is set and TOGGLE allow to user to switch between
+# light and dark mode via a button.
+# The default value is: AUTO_LIGHT.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE = AUTO_LIGHT
+
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# this color. Hue is specified as an angle on a color-wheel, see
+# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
# Minimum value: 0, maximum value: 359, default value: 220.
@@ -1150,7 +1313,7 @@ HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
+# in the HTML output. For a value of 0 the output will use gray-scales only. A
# value of 255 will produce the most vivid colors.
# Minimum value: 0, maximum value: 255, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1177,6 +1340,17 @@ HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via JavaScript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have JavaScript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS = YES
+
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
@@ -1200,13 +1374,14 @@ HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see: http://developer.apple.com/tools/xcode/), introduced with
-# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
-# Makefile in the HTML output directory. Running make will produce the docset in
-# that directory and running make install will install the docset in
+# environment (see:
+# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
+# create a documentation set, doxygen will generate a Makefile in the HTML
+# output directory. Running make will produce the docset in that directory and
+# running make install will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
+# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
+# genXcode/_index.html for more information.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1220,6 +1395,13 @@ GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
+# This tag determines the URL of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDURL =
+
# This tag specifies a string that should uniquely identify the documentation
# set bundle. This should be a reverse domain-name style string, e.g.
# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
@@ -1245,8 +1427,12 @@ DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
-# Windows.
+# on Windows. In the beginning of 2021 Microsoft took the original page, with
+# a.o. the download links, offline the HTML help workshop was already many years
+# in maintenance mode). You can download the HTML help workshop from the web
+# archives at Installation executable (see:
+# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
+# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
@@ -1276,7 +1462,7 @@ CHM_FILE =
HHC_LOCATION =
# The GENERATE_CHI flag controls if a separate .chi index file is generated
-# (YES) or that it should be included in the master .chm file (NO).
+# (YES) or that it should be included in the main .chm file (NO).
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
@@ -1321,7 +1507,8 @@ QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
-# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1329,8 +1516,8 @@ QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
-# folders).
+# Folders (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1338,30 +1525,30 @@ QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
+# Filters (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
+# Filters (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
-# The QHG_LOCATION tag can be used to specify the location of Qt's
-# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
-# generated .qhp file.
+# The QHG_LOCATION tag can be used to specify the location (absolute path
+# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
+# run qhelpgenerator on the generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHG_LOCATION =
@@ -1404,16 +1591,28 @@ DISABLE_INDEX = NO
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
# (i.e. any modern browser). Windows users are probably better off using the
# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
+# further fine tune the look of the index (see "Fine-tuning the output"). As an
+# example, the default style sheet generated by doxygen has an example that
+# shows how to put an image at the root of the tree instead of the PROJECT_NAME.
+# Since the tree basically has the same information as the tab index, you could
+# consider setting DISABLE_INDEX to YES when enabling this option.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = NO
+# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the
+# FULL_SIDEBAR option determines if the side bar is limited to only the treeview
+# area (value NO) or if it should extend to the full height of the window (value
+# YES). Setting this to YES gives a layout similar to
+# https://docs.readthedocs.io with more room for contents, but less room for the
+# project logo, title, and description. If either GENERATE_TREEVIEW or
+# DISABLE_INDEX is set to NO, this option has no effect.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FULL_SIDEBAR = NO
+
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
#
@@ -1438,6 +1637,24 @@ TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
+# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email
+# addresses.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+OBFUSCATE_EMAILS = YES
+
+# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
+# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
+# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
+# the HTML output. These images will generally look nicer at scaled resolutions.
+# Possible values are: png (the default) and svg (looks nicer but requires the
+# pdf2svg or inkscape tool).
+# The default value is: png.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FORMULA_FORMAT = png
+
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
@@ -1447,19 +1664,14 @@ EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 16
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
+# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
+# to create new LaTeX commands to be used in formulas as building blocks. See
+# the section "Including formulas" for details.
-FORMULA_TRANSPARENT = YES
+FORMULA_MACROFILE =
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# http://www.mathjax.org) which uses client side Javascript for the rendering
+# https://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
@@ -1469,11 +1681,29 @@ FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
+# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
+# Note that the different versions of MathJax have different requirements with
+# regards to the different settings, so it is possible that also other MathJax
+# settings have to be changed when switching between the different MathJax
+# versions.
+# Possible values are: MathJax_2 and MathJax_3.
+# The default value is: MathJax_2.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_VERSION = MathJax_2
+
# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/latest/output.html) for more details.
+# the MathJax output. For more details about the output format see MathJax
+# version 2 (see:
+# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3
+# (see:
+# http://docs.mathjax.org/en/latest/web/components/output.html).
# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
+# compatibility. This is the name for Mathjax version 2, for MathJax version 3
+# this will be translated into chtml), NativeMML (i.e. MathML. Only supported
+# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This
+# is the name for Mathjax version 3, for MathJax version 2 this will be
+# translated into HTML-CSS) and SVG.
# The default value is: HTML-CSS.
# This tag requires that the tag USE_MATHJAX is set to YES.
@@ -1486,22 +1716,29 @@ MATHJAX_FORMAT = HTML-CSS
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from http://www.mathjax.org before deployment.
-# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# MathJax from https://www.mathjax.org before deployment. The default value is:
+# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
+# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
+# for MathJax version 2 (see
+# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions):
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# For example for MathJax version 3 (see
+# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html):
+# MATHJAX_EXTENSIONS = ams
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# (see:
+# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
@@ -1529,7 +1766,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = NO
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript. There
+# implemented using a web server instead of a web client using JavaScript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
@@ -1548,7 +1785,8 @@ SERVER_BASED_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/).
+# Xapian (see:
+# https://xapian.org/).
#
# See the section "External Indexing and Searching" for details.
# The default value is: NO.
@@ -1561,8 +1799,9 @@ EXTERNAL_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/). See the section "External Indexing and
-# Searching" for details.
+# Xapian (see:
+# https://xapian.org/). See the section "External Indexing and Searching" for
+# details.
# This tag requires that the tag SEARCHENGINE is set to YES.
SEARCHENGINE_URL =
@@ -1613,21 +1852,35 @@ LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked.
#
-# Note that when enabling USE_PDFLATEX this option is only used for generating
-# bitmaps for formulas in the HTML output, but not in the Makefile that is
-# written to the output directory.
-# The default file is: latex.
+# Note that when not enabling USE_PDFLATEX the default is latex when enabling
+# USE_PDFLATEX the default is pdflatex and when in the later case latex is
+# chosen this is overwritten by pdflatex. For specific output languages the
+# default can have been set differently, this depends on the implementation of
+# the output language.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
# index for LaTeX.
+# Note: This tag is used in the Makefile / make.bat.
+# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
+# (.tex).
# The default file is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
MAKEINDEX_CMD_NAME = makeindex
+# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
+# generate index for LaTeX. In case there is no backslash (\) as first character
+# it will be automatically added in the LaTeX code.
+# Note: This tag is used in the generated output file (.tex).
+# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
+# The default value is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_MAKEINDEX_CMD = makeindex
+
# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
# documents. This may be useful for small projects and may help to save some
# trees in general.
@@ -1657,29 +1910,31 @@ PAPER_TYPE = a4
EXTRA_PACKAGES =
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
+# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for
+# the generated LaTeX document. The header should contain everything until the
+# first chapter. If it is left blank doxygen will generate a standard header. It
+# is highly recommended to start with a default header using
+# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty
+# and then modify the file new_header.tex. See also section "Doxygen usage" for
+# information on how to generate the default header that doxygen normally uses.
#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
-# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
-# string, for the replacement values of the other commands the user is referred
-# to HTML_HEADER.
+# Note: Only use a user-defined header if you know what you are doing!
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. The following
+# commands have a special meaning inside the header (and footer): For a
+# description of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_HEADER =
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer. See
+# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for
+# the generated LaTeX document. The footer should contain everything after the
+# last chapter. If it is left blank doxygen will generate a standard footer. See
# LATEX_HEADER for more information on how to generate a default footer and what
-# special commands can be used inside the footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
+# special commands can be used inside the footer. See also section "Doxygen
+# usage" for information on how to generate the default footer that doxygen
+# normally uses. Note: Only use a user-defined footer if you know what you are
+# doing!
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_FOOTER =
@@ -1712,9 +1967,11 @@ LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
-# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
-# the PDF file directly from the LaTeX files. Set this option to YES, to get a
-# higher quality PDF documentation.
+# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
+# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
+# files. Set this option to YES, to get a higher quality PDF documentation.
+#
+# See also section LATEX_CMD_NAME for selecting the engine.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1722,8 +1979,7 @@ USE_PDFLATEX = YES
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
+# if errors occur, instead of asking the user for help.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1736,19 +1992,9 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE = NO
-
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
-# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# The default value is: plain.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1762,6 +2008,14 @@ LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
+# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
+# path from which the emoji images will be read. If a relative path is entered,
+# it will be relative to the LATEX_OUTPUT directory. If left blank the
+# LATEX_OUTPUT directory will be used.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EMOJI_DIRECTORY =
+
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -1801,9 +2055,9 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
-# Load stylesheet definitions from file. Syntax is similar to doxygen's config
-# file, i.e. a series of assignments. You only have to provide replacements,
-# missing definitions are set to their default value.
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# configuration file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
#
# See also section "Doxygen usage" for information on how to generate the
# default style sheet that doxygen normally uses.
@@ -1812,22 +2066,12 @@ RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's config file. A template extensions file can be generated
-# using doxygen -e rtf extensionFile.
+# similar to doxygen's configuration file. A template extensions file can be
+# generated using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_EXTENSIONS_FILE =
-# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
-# with syntax highlighting in the RTF output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_SOURCE_CODE = NO
-
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
@@ -1899,6 +2143,13 @@ XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
+# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
+# namespace members in file scope as well, matching the HTML output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_NS_MEMB_FILE_SCOPE = NO
+
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
@@ -1917,23 +2168,14 @@ GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
-# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
-# program listings (including syntax highlighting and cross-referencing
-# information) to the DOCBOOK output. Note that enabling this will significantly
-# increase the size of the DOCBOOK output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_PROGRAMLISTING = NO
-
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
-# AutoGen Definitions (see http://autogen.sf.net) file that captures the
-# structure of the code including all documentation. Note that this feature is
-# still experimental and incomplete at the moment.
+# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
+# the structure of the code including all documentation. Note that this feature
+# is still experimental and incomplete at the moment.
# The default value is: NO.
GENERATE_AUTOGEN_DEF = NO
@@ -2012,7 +2254,8 @@ SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by the
-# preprocessor.
+# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of
+# RECURSIVE has no effect here.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
INCLUDE_PATH =
@@ -2100,36 +2343,10 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of 'which perl').
-# The default file (with absolute path) is: /usr/bin/perl.
-
-# PERL_PATH is now obsolete
-# PERL_PATH = /usr/bin/perl
-
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
-# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see:
-# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-# MSCGEN_PATH is now obsolete
-# MSCGEN_PATH =
-
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
@@ -2148,7 +2365,7 @@ HIDE_UNDOC_RELATIONS = YES
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
# Bell Labs. The other options in this section have no effect if this option is
# set to NO
-# The default value is: YES.
+# The default value is: NO.
HAVE_DOT = NO
@@ -2162,35 +2379,50 @@ HAVE_DOT = NO
DOT_NUM_THREADS = 0
-# When you want a differently looking font in the dot files that doxygen
-# generates you can specify the font name using DOT_FONTNAME. You need to make
-# sure dot is able to find the font, which can be done by putting it in a
-# standard location or by setting the DOTFONTPATH environment variable or by
-# setting DOT_FONTPATH to the directory containing the font.
-# The default value is: Helvetica.
+# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of
+# subgraphs. When you want a differently looking font in the dot files that
+# doxygen generates you can specify fontname, fontcolor and fontsize attributes.
+# For details please see Node,
+# Edge and Graph Attributes specification You need to make sure dot is able
+# to find the font, which can be done by putting it in a standard location or by
+# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# directory containing the font. Default graphviz fontsize is 14.
+# The default value is: fontname=Helvetica,fontsize=10.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTNAME = Calibri
-# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
-# dot graphs.
-# Minimum value: 4, maximum value: 24, default value: 10.
+# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can
+# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about
+# arrows shapes.
+# The default value is: labelfontname=Helvetica,labelfontsize=10.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTSIZE = 11
-# By default doxygen will tell dot to use the default font as specified with
-# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
-# the path where dot can find it using this tag.
+# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes
+# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification
+# The default value is: shape=box,height=0.2,width=0.4.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4"
+
+# You can set the path where dot can find font specified with fontname in
+# DOT_COMMON_ATTR and others dot attributes.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTPATH =
-# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
-# each documented class showing the direct and indirect inheritance relations.
-# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
+# graph for each documented class showing the direct and indirect inheritance
+# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
+# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
+# to TEXT the direct and indirect inheritance relations will be shown as texts /
+# links.
+# Possible values are: NO, YES, TEXT and GRAPH.
# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
CLASS_GRAPH = YES
@@ -2204,7 +2436,8 @@ CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
-# groups, showing the direct groups dependencies.
+# groups, showing the direct groups dependencies. See also the chapter Grouping
+# in the manual.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
@@ -2227,10 +2460,32 @@ UML_LOOK = NO
# but if the number exceeds 15, the total amount of fields shown is limited to
# 10.
# Minimum value: 0, maximum value: 100, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
+# This tag requires that the tag UML_LOOK is set to YES.
UML_LIMIT_NUM_FIELDS = 10
+# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
+# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
+# tag is set to YES, doxygen will add type and arguments for attributes and
+# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
+# will not generate fields with class member information in the UML graphs. The
+# class diagrams will look similar to the default class diagrams but using UML
+# notation for the relationships.
+# Possible values are: NO, YES and NONE.
+# The default value is: NO.
+# This tag requires that the tag UML_LOOK is set to YES.
+
+DOT_UML_DETAILS = NO
+
+# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
+# to display on a single line. If the actual line length exceeds this threshold
+# significantly it will wrapped across multiple lines. Some heuristics are apply
+# to avoid ugly line breaks.
+# Minimum value: 0, maximum value: 1000, default value: 17.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_WRAP_THRESHOLD = 17
+
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
# collaboration graphs will show the relations between templates and their
# instances.
@@ -2297,6 +2552,13 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
+# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels
+# of child directories generated in directory dependency graphs by dot.
+# Minimum value: 1, maximum value: 25, default value: 1.
+# This tag requires that the tag DIRECTORY_GRAPH is set to YES.
+
+DIR_GRAPH_MAX_DEPTH = 1
+
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see:
@@ -2304,9 +2566,7 @@ DIRECTORY_GRAPH = YES
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
# to make the SVG files visible in IE 9+ (other browsers do not have this
# requirement).
-# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
-# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
-# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
+# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
# png:gdiplus:gdiplus.
# The default value is: png.
@@ -2352,13 +2612,18 @@ MSCFILE_DIRS =
DIAFILE_DIRS =
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
-# path where java can find the plantuml.jar file. If left blank, it is assumed
-# PlantUML is not used or called during a preprocessing step. Doxygen will
-# generate a warning when it encounters a \startuml command in this case and
-# will not generate output for the diagram.
+# path where java can find the plantuml.jar file or to the filename of jar file
+# to be used. If left blank, it is assumed PlantUML is not used or called during
+# a preprocessing step. Doxygen will generate a warning when it encounters a
+# \startuml command in this case and will not generate output for the diagram.
PLANTUML_JAR_PATH =
+# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE =
+
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
@@ -2388,18 +2653,6 @@ DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not seem
-# to support this out of the box.
-#
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_TRANSPARENT = NO
-
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
@@ -2412,15 +2665,19 @@ DOT_MULTI_TARGETS = YES
# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
# explaining the meaning of the various boxes and arrows in the dot generated
# graphs.
+# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal
+# graphical representation for inheritance and collaboration diagrams is used.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GENERATE_LEGEND = YES
-# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
# files that are used to generate the various graphs.
+#
+# Note: This setting is not only used for dot files but also for msc temporary
+# files.
# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES
diff --git a/projects/amdsmi/docs/esmi_lib_readme_link.md b/projects/amdsmi/docs/esmi_lib_readme_link.md
new file mode 100644
index 0000000000..f52aec131a
--- /dev/null
+++ b/projects/amdsmi/docs/esmi_lib_readme_link.md
@@ -0,0 +1,3 @@
+# ESMI Library README
+
+For more information, see the [ESMI Library README](https://raw.githubusercontent.com/am/esmi_ib_library/master/docs/README.md)
\ No newline at end of file
diff --git a/projects/amdsmi/docs/sphinx/_toc.yml.in b/projects/amdsmi/docs/sphinx/_toc.yml.in
index 3a4de74232..c05c3bfbf0 100644
--- a/projects/amdsmi/docs/sphinx/_toc.yml.in
+++ b/projects/amdsmi/docs/sphinx/_toc.yml.in
@@ -17,6 +17,10 @@ subtrees:
title: Python CLI Tool
- file: amdsmi_release_notes_link
title: Python CLI Release Notes
+ - caption: Libraries
+ entries:
+ - file: esmi_lib_readme_link
+ title: ESMI Library
- caption: About
entries:
- file: license
diff --git a/projects/amdsmi/docs/sphinx/requirements.txt b/projects/amdsmi/docs/sphinx/requirements.txt
index ca744335cb..53bd7f615d 100644
--- a/projects/amdsmi/docs/sphinx/requirements.txt
+++ b/projects/amdsmi/docs/sphinx/requirements.txt
@@ -47,7 +47,7 @@ fastjsonschema==2.17.1
# via rocm-docs-core
gitdb==4.0.10
# via gitpython
-gitpython==3.1.31
+gitpython==3.1.37
# via rocm-docs-core
idna==3.4
# via requests
@@ -110,7 +110,7 @@ requests==2.30.0
# via
# pygithub
# sphinx
-rocm-docs-core[api_reference]>=0.20.0
+rocm-docs-core[api_reference]>=0.26.0
# via -r requirements.in
smmap==5.0.0
# via gitdb
diff --git a/projects/amdsmi/example/amd_smi_drm_example.cc b/projects/amdsmi/example/amd_smi_drm_example.cc
index 7b6997404b..de0f794aed 100644
--- a/projects/amdsmi/example/amd_smi_drm_example.cc
+++ b/projects/amdsmi/example/amd_smi_drm_example.cc
@@ -312,9 +312,10 @@ int main() {
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_gpu_cache_info:\n");
for (unsigned int i = 0 ; i < cache_info.num_cache_types; i++) {
- printf("\tCache Level: %d, Cache Size: %d KB\n",
+ printf("\tCache Level: %d, Cache Size: %d KB, Cache type: 0x%x\n",
cache_info.cache[i].cache_level,
- cache_info.cache[i].cache_size_kb);
+ cache_info.cache[i].cache_size_kb,
+ cache_info.cache[i].flags);
}
// Get power measure
@@ -619,9 +620,11 @@ int main() {
std::cout << "\tdevice [" << j
<< "]\n\t\tProduct name: " << board_info.product_name
<< "\n"
- << "\t\tProduct number: " << board_info.product_serial
+ << "\t\tModel Number: " << board_info.model_number
<< "\n"
- << "\t\tSerial number: " << board_info.serial_number
+ << "\t\tBoard Serial: " << board_info.product_serial
+ << "\n"
+ << "\t\tManufacturer Name: " << board_info.manufacturer_name
<< "\n\n";
// Get temperature
diff --git a/projects/amdsmi/example/amd_smi_nodrm_example.cc b/projects/amdsmi/example/amd_smi_nodrm_example.cc
index 3b4adce76a..987c8c9225 100644
--- a/projects/amdsmi/example/amd_smi_nodrm_example.cc
+++ b/projects/amdsmi/example/amd_smi_nodrm_example.cc
@@ -302,9 +302,11 @@ int main() {
std::cout << "\tdevice [" << j
<< "]\n\t\tProduct name: " << board_info.product_name
<< "\n"
- << "\t\tProduct number: " << board_info.product_serial
+ << "\t\tModel Number: " << board_info.model_number
<< "\n"
- << "\t\tSerial number: " << board_info.serial_number
+ << "\t\tBoard Serial: " << board_info.product_serial
+ << "\n"
+ << "\t\tManufacturer Name: " << board_info.manufacturer_name
<< "\n\n";
// Get temperature
diff --git a/projects/amdsmi/include/amd_smi/amdsmi.h b/projects/amdsmi/include/amd_smi/amdsmi.h
index c8da0b4502..72894c3422 100644
--- a/projects/amdsmi/include/amd_smi/amdsmi.h
+++ b/projects/amdsmi/include/amd_smi/amdsmi.h
@@ -455,11 +455,23 @@ typedef struct {
uint32_t reserved[16];
} amdsmi_vbios_info_t;
+/**
+ * @brief cache flags
+ */
+typedef enum {
+ CACHE_FLAGS_ENABLED = 0x00000001,
+ CACHE_FLAGS_DATA_CACHE = 0x00000002,
+ CACHE_FLAGS_INST_CACHE = 0x00000004,
+ CACHE_FLAGS_CPU_CACHE = 0x00000008,
+ CACHE_FLAGS_SIMD_CACHE = 0x00000010,
+} amdsmi_cache_flags_type_t;
+
typedef struct {
uint32_t num_cache_types;
struct cache_ {
uint32_t cache_size_kb; /* In KB */
uint32_t cache_level;
+ uint32_t flags; // amdsmi_cache_flags_type_t which is a bitmask
uint32_t reserved[3];
} cache[AMDSMI_MAX_CACHE_TYPES];
uint32_t reserved[15];
@@ -501,13 +513,12 @@ typedef struct {
} amdsmi_driver_info_t;
typedef struct {
- uint64_t serial_number;
bool is_master;
char model_number[AMDSMI_NORMAL_STRING_LENGTH];
char product_serial[AMDSMI_NORMAL_STRING_LENGTH];
char fru_id[AMDSMI_NORMAL_STRING_LENGTH];
- char product_name[AMDSMI_PRODUCT_NAME_LENGTH];
char manufacturer_name[AMDSMI_NORMAL_STRING_LENGTH];
+ char product_name[AMDSMI_PRODUCT_NAME_LENGTH];
} amdsmi_board_info_t;
typedef struct {
@@ -1470,6 +1481,20 @@ amdsmi_status_t amdsmi_get_socket_info(
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
*/
amdsmi_status_t amdsmi_get_cpusocket_info(amdsmi_cpusocket_handle socket_handle, uint32_t sockid);
+
+/**
+ * @brief Get information about the given cpu core
+ *
+ * @details This function retrieves cpu core information. The @p core_handle must
+ * be provided to retrieve the core ID.
+ *
+ * @param[in] core_handle a processor handle
+ *
+ * @param[out] coreid The id of the core.
+ *
+ * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
+ */
+amdsmi_status_t amdsmi_get_cpucore_info(amdsmi_processor_handle core_handle, uint32_t coreid);
#endif
/**
@@ -4589,51 +4614,6 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_cpusocket_handle socket_handle,
/*---------------------------------------------------------------------------*/
/** @{ */
-/**
- * @brief Get cpu family.
- *
- * @param[in,out] family - Input buffer to fill family
- *
- * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
- */
-amdsmi_status_t amdsmi_get_cpu_family(uint32_t family);
-
-/**
- * @brief Get cpu model.
- *
- * @param[in,out] family - Input buffer to fill family
- *
- * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
- */
-amdsmi_status_t amdsmi_get_cpu_model(uint32_t model);
-
-/**
- * @brief Get threads per core.
- *
- * @param[in,out] threads - Input buffer to fill threads count.
- *
- * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
- */
-amdsmi_status_t amdsmi_get_cpu_threads_per_core(uint32_t threads);
-
-/**
- * @brief Get number of cpus.
- *
- * @param[in,out] cpus - Input buffer to fill number of cpus.
- *
- * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
- */
-amdsmi_status_t amdsmi_get_number_of_cpu_cores(uint32_t cpus);
-
-/**
- * @brief Get number of sockets
- *
- * @param[in,out] sockets - Input buffer to fill number of sockets.
- *
- * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
- */
-amdsmi_status_t amdsmi_get_number_of_cpu_sockets(uint32_t sockets);
-
/**
* @brief Get first online core on socket.
*
diff --git a/projects/amdsmi/include/amd_smi/impl/amd_smi_cpu_core.h b/projects/amdsmi/include/amd_smi/impl/amd_smi_cpu_core.h
index ffcca3a6c9..c721cd671c 100644
--- a/projects/amdsmi/include/amd_smi/impl/amd_smi_cpu_core.h
+++ b/projects/amdsmi/include/amd_smi/impl/amd_smi_cpu_core.h
@@ -60,14 +60,13 @@ public:
virtual ~AMDSmiCpuCore() {}
+ const uint32_t& get_core_id() const { return core_idx_; }
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
std::vector& get_processors() { return processors_;}
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
private:
uint32_t core_idx_;
- //uint64_t input;
- //uint32_t idx;
std::vector processors_;
};
diff --git a/projects/amdsmi/py-interface/CMakeLists.txt b/projects/amdsmi/py-interface/CMakeLists.txt
index 7996d04bf1..d55e9b6fca 100644
--- a/projects/amdsmi/py-interface/CMakeLists.txt
+++ b/projects/amdsmi/py-interface/CMakeLists.txt
@@ -37,15 +37,10 @@ if(NOT GOOD_CLANG_FOUND)
${PY_PACKAGE_DIR}/amdsmi_wrapper.py
DEPENDS ${AMD_SMI}
${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_wrapper.py
- COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_wrapper.py ${CMAKE_CURRENT_BINARY_DIR}/
- # hacky alternative to configure_file that will run at MAKE compile instead of CMake configure
- COMMAND sed -i
- s:"@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@":"${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}":g
- ${CMAKE_CURRENT_BINARY_DIR}/amdsmi_wrapper.py
COMMAND mkdir -p ${PY_PACKAGE_DIR}
- COMMAND ln -Pf ${CMAKE_CURRENT_BINARY_DIR}/amdsmi_wrapper.py ${PY_PACKAGE_DIR}/)
+ COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_wrapper.py ${PY_PACKAGE_DIR}/)
else()
- find_package(Python3 3.7 COMPONENTS Interpreter Development REQUIRED)
+ find_package(Python3 3.6 COMPONENTS Interpreter Development REQUIRED)
# --break-system-packages is needed for python 3.11
# see: https://peps.python.org/pep-0668/
if (NOT Python3_VERSION VERSION_LESS "3.11")
@@ -67,46 +62,58 @@ else()
${PROJECT_SOURCE_DIR}/include/amd_smi/amdsmi.h
COMMAND cp ${PROJECT_SOURCE_DIR}/include/amd_smi/amdsmi.h ./
COMMAND ${Python3_EXECUTABLE} generator.py "$<$:-e -DENABLE_ESMI_LIB>" -i amdsmi.h -l ${PROJECT_BINARY_DIR}/src/libamd_smi.so -o ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_wrapper.py
- COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_wrapper.py ${CMAKE_CURRENT_BINARY_DIR}/
- # hacky alternative to configure_file that will run at MAKE compile instead of CMake configure
- COMMAND sed -i
- s:"@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@":"${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}":g
- ${CMAKE_CURRENT_BINARY_DIR}/amdsmi_wrapper.py
COMMAND mkdir -p ${PY_PACKAGE_DIR}
- COMMAND ln -Pf ${CMAKE_CURRENT_BINARY_DIR}/amdsmi_wrapper.py ${PY_PACKAGE_DIR}/)
+ COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_wrapper.py ${PY_PACKAGE_DIR}/)
endif()
+# populate version string
+configure_file(pyproject.toml.in ${PY_BUILD_DIR}/pyproject.toml @ONLY)
+configure_file(setup.cfg.in ${PY_BUILD_DIR}/setup.cfg @ONLY)
+
add_custom_target(
python_wrapper
DEPENDS amdsmi_wrapper.py)
# hard-linking instead of copying avoids unnecessarry regeneration of packaged files
add_custom_command(
- OUTPUT ${PY_BUILD_DIR}/pyproject.toml
- ${PY_PACKAGE_DIR}/__init__.py
+ OUTPUT ${PY_PACKAGE_DIR}/__init__.py
${PY_PACKAGE_DIR}/amdsmi_exception.py
${PY_PACKAGE_DIR}/amdsmi_interface.py
${PY_PACKAGE_DIR}/README.md
${PY_PACKAGE_DIR}/LICENSE
DEPENDS python_wrapper
- COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml ${PY_BUILD_DIR}/
COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${PY_PACKAGE_DIR}/
COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_exception.py ${PY_PACKAGE_DIR}/
COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_interface.py ${PY_PACKAGE_DIR}/
COMMAND ln -Pf ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${PY_PACKAGE_DIR}/
- COMMAND ln -Pf ${PROJECT_SOURCE_DIR}/LICENSE ${PY_PACKAGE_DIR}/)
+ COMMAND ln -Pf ${PROJECT_SOURCE_DIR}/LICENSE ${PY_PACKAGE_DIR}/
+ )
+
+# copy libamd_smi.so to allow for a self-contained python package
+add_custom_command(
+ OUTPUT ${PY_PACKAGE_DIR}/libamd_smi.so
+ DEPENDS ${PROJECT_BINARY_DIR}/src/libamd_smi.so
+ COMMAND cp
+ "${PROJECT_BINARY_DIR}/src/libamd_smi.so"
+ ${PY_PACKAGE_DIR}/
+ )
add_custom_target(
python_package ALL
DEPENDS ${PY_BUILD_DIR}/pyproject.toml
+ ${PY_BUILD_DIR}/setup.cfg
${PY_PACKAGE_DIR}/__init__.py
${PY_PACKAGE_DIR}/amdsmi_exception.py
${PY_PACKAGE_DIR}/amdsmi_interface.py
${PY_PACKAGE_DIR}/README.md
- ${PY_PACKAGE_DIR}/LICENSE)
+ ${PY_PACKAGE_DIR}/LICENSE
+ ${PY_PACKAGE_DIR}/libamd_smi.so
+ )
install(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/${PY_BUILD_DIR}/pyproject.toml
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${PY_BUILD_DIR}/pyproject.toml
+ ${CMAKE_CURRENT_BINARY_DIR}/${PY_BUILD_DIR}/setup.cfg
DESTINATION ${PY_WRAPPER_INSTALL_DIR}
COMPONENT dev)
diff --git a/projects/amdsmi/py-interface/README.md b/projects/amdsmi/py-interface/README.md
index 25845075c1..6343bb1775 100644
--- a/projects/amdsmi/py-interface/README.md
+++ b/projects/amdsmi/py-interface/README.md
@@ -2,7 +2,7 @@
## Requirements
-* python 3.6 64-bit
+* python 3.6+ 64-bit
* driver must be loaded for amdsmi_init() to pass
## Overview
@@ -478,6 +478,10 @@ Field | Description
`cache #` | upt 10 caches will be available
`cache_size` | size of cache in KB
`cache_level` | level of cache
+`data_cache` | True if data cache is enabled, false otherwise
+`instruction_cache` | True if instruction cache is enabled, false otherwise
+`cpu_cache` | True if cpu cache is enabled, false otherwise
+`simd_cache` | True if simd cache is enabled, false otherwise
Exceptions that can be thrown by `amdsmi_get_gpu_cache_info` function:
@@ -499,6 +503,10 @@ try:
print(cache_index)
print(cache_values['cache_size'])
print(cache_values['cache_level'])
+ print(cache_values['data_cache'])
+ print(cache_values['instruction_cache'])
+ print(cache_values['cpu_cache'])
+ print(cache_values['simd_cache'])
except AmdSmiException as e:
print(e)
```
@@ -576,6 +584,7 @@ try:
firmware_list = amdsmi_get_fw_info(device)['fw_list']
for firmware_block in firmware_list:
print(firmware_block['fw_name'])
+ # String formated hex or decimal value ie: 21.00.00.AC or 130
print(firmware_block['fw_version'])
except AmdSmiException as e:
print(e)
@@ -998,8 +1007,10 @@ Output: Dictionary with fields correctable and uncorrectable
Field | Description
---|---
-`serial_number` | Board serial number
+`model_number` | Board serial number
`product_serial` | Product serial
+`fru_id` | FRU ID
+`manufacturer_name` | Manufacturer name
`product_name` | Product name
Exceptions that can be thrown by `amdsmi_get_gpu_board_info` function:
@@ -1014,8 +1025,10 @@ Example:
try:
device = amdsmi_get_processor_handle_from_bdf("0000:23.00.0")
board_info = amdsmi_get_gpu_board_info(device)
- print(board_info["serial_number"])
+ print(board_info["model_number"])
print(board_info["product_serial"])
+ print(board_info["fru_id"])
+ print(board_info["manufacturer_name"])
print(board_info["product_name"])
except AmdSmiException as e:
print(e)
@@ -1771,19 +1784,23 @@ except AmdSmiException as e:
```
## amdsmi_is_gpu_power_management_enabled
+
Description: Returns is power management enabled
Input parameters:
+
* `processor_handle` GPU device which to query
Output: Bool true if power management enabled else false
Exceptions that can be thrown by `amdsmi_is_gpu_power_management_enabled` function:
+
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
+
```python
try:
devices = amdsmi_get_processor_handles()
@@ -3268,7 +3285,6 @@ except AmdSmiException as e:
print(e)
```
-
### amdsmi_dev_compute_partition_get
Description: Get the compute partition from the given GPU
@@ -3495,3 +3511,436 @@ try:
except AmdSmiException as e:
print(e)
```
+
+### amdsmi_get_cpusocket_handles
+
+**Note: CURRENTLY HARDCODED TO RETURN DUMMY DATA**
+Description: Returns list of cpusocket handle objects on current machine
+
+Input parameters: `None`
+
+Output: List of cpusocket handle objects
+
+Exceptions that can be thrown by `amdsmi_get_cpusocket_handles` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ sockets = amdsmi_get_cpusocket_handles()
+ print('Socket numbers: {}'.format(len(sockets)))
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpusocket_info
+
+**Note: CURRENTLY HARDCODED TO RETURN EMPTY VALUES**
+Description: Return cpu socket index
+
+Input parameters:
+`socket_handle` cpu socket handle
+
+Output: Socket index
+
+Exceptions that can be thrown by `amdsmi_get_cpusocket_info` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ print(amdsmi_get_cpusocket_info(socket))
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpucore_handles
+
+Description: Returns list of CPU core handle objects on current machine
+
+Input parameters: `None`
+
+Output: List of CPU core handle objects
+
+Exceptions that can be thrown by `amdsmi_get_cpucore_handles` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ core_handles = amdsmi_get_cpucore_handles()
+ if len(core_handles) == 0:
+ print("No CPU cores on machine")
+ else:
+ for core in core_handles:
+ print(amdsmi_get_cpucore_info(core))
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_hsmp_proto_ver
+
+Description: Get the hsmp protocol version.
+
+Output: amdsmi hsmp protocol version
+
+Exceptions that can be thrown by `amdsmi_get_cpu_hsmp_proto_ver` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ version = amdsmi_get_cpu_hsmp_proto_ver(socket)
+ print(version)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_smu_fw_version
+
+Description: Get the SMU Firmware version.
+
+Output: amdsmi SMU Firmware version
+
+Exceptions that can be thrown by `amdsmi_get_cpu_smu_fw_version` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ version = amdsmi_get_cpu_smu_fw_version(socket)
+ print(version['debug'])
+ print(version['minor'])
+ print(version['major'])
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_prochot_status
+
+Description: Get the CPU's prochot status.
+
+Output: amdsmi cpu prochot status
+
+Exceptions that can be thrown by `amdsmi_get_cpu_prochot_status` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ prochot = amdsmi_get_cpu_prochot_status(socket)
+ print(prochot)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_fclk_mclk
+
+Description: Get the Data fabric clock and Memory clock in MHz.
+
+Output: amdsmi data fabric clock and memory clock
+
+Exceptions that can be thrown by `amdsmi_get_cpu_fclk_mclk` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ clk = amdsmi_get_cpu_fclk_mclk(socket)
+ for fclk, mclk in clk.items():
+ print(fclk)
+ print(mclk)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_cclk_limit
+
+Description: Get the core clock in MHz.
+
+Output: amdsmi core clock
+
+Exceptions that can be thrown by `amdsmi_get_cpu_cclk_limit` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ cclk_limit = amdsmi_get_cpu_cclk_limit(socket)
+ print(cclk_limit)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_socket_current_active_freq_limit
+
+Description: Get current active frequency limit of the socket.
+
+Output: amdsmi frequency value in MHz and frequency source name
+
+Exceptions that can be thrown by `amdsmi_get_cpu_socket_current_active_freq_limit` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ freq_limit = amdsmi_get_cpu_socket_current_active_freq_limit(socket)
+ for freq, src in freq_limit.items():
+ print(freq)
+ print(src)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_socket_freq_range
+
+Description: Get socket frequency range
+
+Output: amdsmi maximum frequency and minimum frequency
+
+Exceptions that can be thrown by `amdsmi_get_cpu_socket_freq_range` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ freq_range = amdsmi_get_cpu_socket_freq_range(socket)
+ for fmax, fmin in freq_range.items():
+ print(fmax)
+ print(fmin)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_core_current_freq_limit
+
+Description: Get socket frequency limit of the core
+
+Output: amdsmi frequency
+
+Exceptions that can be thrown by `amdsmi_get_cpu_core_current_freq_limit` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ core_handles = amdsmi_get_cpucore_handles()
+ if len(core_handles) == 0:
+ print("No CPU cores on machine")
+ else:
+ for core in core_handles:
+ freq_limit = amdsmi_get_cpu_core_current_freq_limit(core)
+ print(freq_limit)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_socket_power
+
+Description: Get the socket power.
+
+Output: amdsmi socket power
+
+Exceptions that can be thrown by `amdsmi_get_cpu_socket_power` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ sock_power = amdsmi_get_cpu_socket_power(socket)
+ print(sock_power)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_socket_power_cap
+
+Description: Get the socket power cap.
+
+Output: amdsmi socket power cap
+
+Exceptions that can be thrown by `amdsmi_get_cpu_socket_power_cap` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ sock_power = amdsmi_get_cpu_socket_power_cap(socket)
+ print(sock_power)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_socket_power_cap_max
+
+Description: Get the socket power cap max.
+
+Output: amdsmi socket power cap max
+
+Exceptions that can be thrown by `amdsmi_get_cpu_socket_power_cap_max` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ sock_power = amdsmi_get_cpu_socket_power_cap_max(socket)
+ print(sock_power)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_get_cpu_pwr_svi_telemetry_all_rails
+
+Description: Get the SVI based power telemetry for all rails.
+
+Output: amdsmi svi based power value
+
+Exceptions that can be thrown by `amdsmi_get_cpu_pwr_svi_telemetry_all_rails` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ power = amdsmi_get_cpu_pwr_svi_telemetry_all_rails(socket)
+ print(power)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_set_cpu_socket_power_cap
+
+Description: Set the power cap value for a given socket.
+
+Input: socket index, amdsmi socket power cap value
+
+Exceptions that can be thrown by `amdsmi_set_cpu_socket_power_cap` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ power = amdsmi_set_cpu_socket_power_cap(socket, 0, 1000)
+except AmdSmiException as e:
+ print(e)
+```
+
+### amdsmi_set_cpu_pwr_efficiency_mode
+
+Description: Set the power efficiency profile policy.
+
+Input: socket index, mode(0, 1, or 2)
+
+Exceptions that can be thrown by `amdsmi_set_cpu_pwr_efficiency_mode` function:
+
+* `AmdSmiLibraryException`
+
+Example:
+
+```python
+try:
+ socket_handles = amdsmi_get_cpusocket_handles()
+ if len(socket_handles) == 0:
+ print("No CPU sockets on machine")
+ else:
+ for socket in socket_handles:
+ policy = amdsmi_set_cpu_pwr_efficiency_mode(socket, 0, 0)
+except AmdSmiException as e:
+ print(e)
+```
diff --git a/projects/amdsmi/py-interface/amdsmi_interface.py b/projects/amdsmi/py-interface/amdsmi_interface.py
index 2b832eb7cd..d1069be1ab 100644
--- a/projects/amdsmi/py-interface/amdsmi_interface.py
+++ b/projects/amdsmi/py-interface/amdsmi_interface.py
@@ -385,7 +385,7 @@ class AmdSmiEventReader:
)
)
- ret = list()
+ ret = []
for i in range(0, num_elem):
unique_event_values = set(event.value for event in AmdSmiEvtNotificationType)
if self.event_info[i].event in unique_event_values:
@@ -436,7 +436,7 @@ def _format_bad_page_info(bad_page_info, bad_page_count: ctypes.c_uint32) -> Lis
amdsmi_wrapper.amdsmi_retired_page_record_t)
)
- table_records = list()
+ table_records = []
for i in range(bad_page_count.value):
table_records.append(
{
@@ -876,6 +876,101 @@ def amdsmi_get_cpu_socket_power(
return ppower.value
+def amdsmi_get_cpu_socket_power_cap(
+ socket_handle: amdsmi_wrapper.amdsmi_cpusocket_handle, sock_idx: int
+) -> int:
+ if not isinstance(socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle):
+ raise AmdSmiParameterException(
+ socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle
+ )
+ if not isinstance(sock_idx, int):
+ raise AmdSmiParameterException(sock_idx, int)
+
+ pcap = ctypes.c_uint32()
+ _check_res(
+ amdsmi_wrapper.amdsmi_get_cpu_socket_power_cap(
+ socket_handle, sock_idx, ctypes.byref(pcap)
+ )
+ )
+
+ return pcap.value
+
+def amdsmi_get_cpu_socket_power_cap_max(
+ socket_handle: amdsmi_wrapper.amdsmi_cpusocket_handle, sock_idx: int
+) -> int:
+ if not isinstance(socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle):
+ raise AmdSmiParameterException(
+ socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle
+ )
+ if not isinstance(sock_idx, int):
+ raise AmdSmiParameterException(sock_idx, int)
+
+ pmax = ctypes.c_uint32()
+ _check_res(
+ amdsmi_wrapper.amdsmi_get_cpu_socket_power_cap_max(
+ socket_handle, sock_idx, ctypes.byref(pmax)
+ )
+ )
+
+ return pmax.value
+
+def amdsmi_get_cpu_pwr_svi_telemetry_all_rails(
+ socket_handle: amdsmi_wrapper.amdsmi_cpusocket_handle, sock_idx: int
+) -> int:
+ if not isinstance(socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle):
+ raise AmdSmiParameterException(
+ socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle
+ )
+ if not isinstance(sock_idx, int):
+ raise AmdSmiParameterException(sock_idx, int)
+
+ power = ctypes.c_uint32()
+ _check_res(
+ amdsmi_wrapper.amdsmi_get_cpu_pwr_svi_telemetry_all_rails(
+ socket_handle, sock_idx, ctypes.byref(power)
+ )
+ )
+
+ return power.value
+
+def amdsmi_set_cpu_socket_power_cap(
+ socket_handle: amdsmi_wrapper.amdsmi_cpusocket_handle, sock_idx: int, power_cap: int
+):
+ if not isinstance(socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle):
+ raise AmdSmiParameterException(
+ socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle
+ )
+ if not isinstance(sock_idx, int):
+ raise AmdSmiParameterException(sock_idx, int)
+ if not isinstance(power_cap, int):
+ raise AmdSmiParameterException(power_cap, int)
+ sock_idx = ctypes.c_uint32(sock_idx)
+ power_cap = ctypes.c_uint32(power_cap)
+
+ _check_res(
+ amdsmi_wrapper.amdsmi_set_cpu_socket_power_cap(
+ processor_handle, sock_idx, power_cap)
+ )
+
+def amdsmi_set_cpu_pwr_efficiency_mode(
+ socket_handle: amdsmi_wrapper.amdsmi_cpusocket_handle, sock_idx: int, mode: int
+):
+ if not isinstance(socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle):
+ raise AmdSmiParameterException(
+ socket_handle, amdsmi_wrapper.amdsmi_cpusocket_handle
+ )
+ if not isinstance(sock_idx, int):
+ raise AmdSmiParameterException(sock_idx, int)
+ if not isinstance(mode, int):
+ raise AmdSmiParameterException(mode, int)
+ sock_idx = ctypes.c_uint8(sock_idx)
+ mode = ctypes.c_uint8(mode)
+
+ _check_res(
+ amdsmi_wrapper.amdsmi_set_cpu_pwr_efficiency_mode(
+ socket_handle, sock_idx, mode)
+ )
+
def amdsmi_init(flag=AmdSmiInitFlags.INIT_AMD_GPUS):
if not isinstance(flag, AmdSmiInitFlags):
raise AmdSmiParameterException(flag, AmdSmiInitFlags)
@@ -991,7 +1086,7 @@ def amdsmi_get_gpu_vram_info(
def amdsmi_get_gpu_cache_info(
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
-) -> Dict[str, Any]:
+) -> Dict[str, Dict[str, Any]]:
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
raise AmdSmiParameterException(
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
@@ -1007,8 +1102,17 @@ def amdsmi_get_gpu_cache_info(
for cache_index in range(cache_info.num_cache_types):
cache_size = cache_info.cache[cache_index].cache_size_kb
cache_level = cache_info.cache[cache_index].cache_level
+ cache_flags = cache_info.cache[cache_index].flags
+ data_cache = bool(cache_flags & amdsmi_wrapper.CACHE_FLAGS_DATA_CACHE)
+ inst_cache = bool(cache_flags & amdsmi_wrapper.CACHE_FLAGS_INST_CACHE)
+ cpu_cache = bool(cache_flags & amdsmi_wrapper.CACHE_FLAGS_CPU_CACHE)
+ simd_cache = bool(cache_flags & amdsmi_wrapper.CACHE_FLAGS_SIMD_CACHE)
cache_info_dict[f"cache {cache_index}"] = {"cache_size": cache_size,
- "cache_level": cache_level}
+ "cache_level": cache_level,
+ "data_cache": data_cache,
+ "instruction_cache": inst_cache,
+ "cpu_cache": cpu_cache,
+ "simd_cache": simd_cache}
return cache_info_dict
@@ -1147,7 +1251,7 @@ def amdsmi_get_gpu_board_info(
return {
"model_number": board_info.model_number.decode("utf-8").strip(),
- "product_serial": board_info.serial_number,
+ "product_serial": board_info.product_serial.decode("utf-8").strip(),
"fru_id": board_info.fru_id.decode("utf-8").strip(),
"manufacturer_name" : board_info.manufacturer_name.decode("utf-8").strip(),
"product_name": board_info.product_name.decode("utf-8").strip()
@@ -1171,7 +1275,7 @@ def amdsmi_get_gpu_ras_feature_info(
)
return {
- "eeprom_version": ras_feature.ras_eeprom_version,
+ "eeprom_version": hex(ras_feature.ras_eeprom_version),
"parity_schema" : bool(ras_feature.ecc_correction_schema_flag & 1),
"single_bit_schema" : bool(ras_feature.ecc_correction_schema_flag & 2),
"double_bit_schema" : bool(ras_feature.ecc_correction_schema_flag & 4),
@@ -1365,11 +1469,28 @@ def amdsmi_get_fw_info(
fw_info = amdsmi_wrapper.amdsmi_fw_info_t()
_check_res(amdsmi_wrapper.amdsmi_get_fw_info(
processor_handle, ctypes.byref(fw_info)))
- firmwares = list()
+
+ hex_format_fw = [AmdSmiFwBlock.FW_ID_SMC,
+ AmdSmiFwBlock.FW_ID_PSP_SOSDRV,
+ AmdSmiFwBlock.FW_ID_TA_RAS,
+ AmdSmiFwBlock.FW_ID_XGMI,
+ AmdSmiFwBlock.FW_ID_UVD,
+ AmdSmiFwBlock.FW_ID_VCE,
+ AmdSmiFwBlock.FW_ID_VCN]
+
+ firmwares = []
for i in range(0, fw_info.num_fw_info):
+ fw_name = AmdSmiFwBlock(fw_info.fw_info_list[i].fw_id)
+ fw_version = fw_info.fw_info_list[i].fw_version
+
+ if fw_name in hex_format_fw:
+ fw_version_string = ".".join(re.findall('..?', hex(fw_version)[2:]))
+ else:
+ fw_version_string = str(fw_version)
+
firmwares.append({
- 'fw_name': AmdSmiFwBlock(fw_info.fw_info_list[i].fw_id),
- 'fw_version': fw_info.fw_info_list[i].fw_version,
+ 'fw_name': fw_name,
+ 'fw_version': fw_version_string.upper(),
})
return {
'fw_list': firmwares
diff --git a/projects/amdsmi/py-interface/amdsmi_wrapper.py b/projects/amdsmi/py-interface/amdsmi_wrapper.py
index a7a16ce2de..fafa936ecf 100644
--- a/projects/amdsmi/py-interface/amdsmi_wrapper.py
+++ b/projects/amdsmi/py-interface/amdsmi_wrapper.py
@@ -168,19 +168,11 @@ def char_pointer_cast(string, encoding='utf-8'):
_libraries = {}
from pathlib import Path
-libamd_smi_cpack = Path("@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libamd_smi.so")
-libamd_smi_optrocm = Path("/opt/rocm/lib/libamd_smi.so")
libamd_smi_parent_dir = Path(__file__).resolve().parent / "libamd_smi.so"
libamd_smi_cwd = Path.cwd() / "libamd_smi.so"
try:
- if libamd_smi_cpack.is_file():
- # try to find library in install directory provided by CMake
- _libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_cpack)
- elif libamd_smi_optrocm.is_file():
- # try /opt/rocm/lib as a fallback
- _libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_optrocm)
- elif libamd_smi_parent_dir.is_file():
+ if libamd_smi_parent_dir.is_file():
# try to fall back to parent directory
_libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_parent_dir)
else:
@@ -751,6 +743,21 @@ struct_amdsmi_vbios_info_t._fields_ = [
]
amdsmi_vbios_info_t = struct_amdsmi_vbios_info_t
+
+# values for enumeration 'amdsmi_cache_flags_type_t'
+amdsmi_cache_flags_type_t__enumvalues = {
+ 1: 'CACHE_FLAGS_ENABLED',
+ 2: 'CACHE_FLAGS_DATA_CACHE',
+ 4: 'CACHE_FLAGS_INST_CACHE',
+ 8: 'CACHE_FLAGS_CPU_CACHE',
+ 16: 'CACHE_FLAGS_SIMD_CACHE',
+}
+CACHE_FLAGS_ENABLED = 1
+CACHE_FLAGS_DATA_CACHE = 2
+CACHE_FLAGS_INST_CACHE = 4
+CACHE_FLAGS_CPU_CACHE = 8
+CACHE_FLAGS_SIMD_CACHE = 16
+amdsmi_cache_flags_type_t = ctypes.c_uint32 # enum
class struct_amdsmi_gpu_cache_info_t(Structure):
pass
@@ -761,6 +768,7 @@ struct_cache_._pack_ = 1 # source:False
struct_cache_._fields_ = [
('cache_size_kb', ctypes.c_uint32),
('cache_level', ctypes.c_uint32),
+ ('flags', ctypes.c_uint32),
('reserved', ctypes.c_uint32 * 3),
]
@@ -840,14 +848,12 @@ class struct_amdsmi_board_info_t(Structure):
struct_amdsmi_board_info_t._pack_ = 1 # source:False
struct_amdsmi_board_info_t._fields_ = [
- ('serial_number', ctypes.c_uint64),
('is_master', ctypes.c_bool),
('model_number', ctypes.c_char * 32),
('product_serial', ctypes.c_char * 32),
('fru_id', ctypes.c_char * 32),
- ('product_name', ctypes.c_char * 128),
('manufacturer_name', ctypes.c_char * 32),
- ('PADDING_0', ctypes.c_ubyte * 7),
+ ('product_name', ctypes.c_char * 128),
]
amdsmi_board_info_t = struct_amdsmi_board_info_t
@@ -1658,6 +1664,9 @@ uint32_t = ctypes.c_uint32
amdsmi_get_cpusocket_info = _libraries['libamd_smi.so'].amdsmi_get_cpusocket_info
amdsmi_get_cpusocket_info.restype = amdsmi_status_t
amdsmi_get_cpusocket_info.argtypes = [amdsmi_cpusocket_handle, uint32_t]
+amdsmi_get_cpucore_info = _libraries['libamd_smi.so'].amdsmi_get_cpucore_info
+amdsmi_get_cpucore_info.restype = amdsmi_status_t
+amdsmi_get_cpucore_info.argtypes = [amdsmi_processor_handle, uint32_t]
amdsmi_get_processor_handles = _libraries['libamd_smi.so'].amdsmi_get_processor_handles
amdsmi_get_processor_handles.restype = amdsmi_status_t
amdsmi_get_processor_handles.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))]
@@ -2073,21 +2082,6 @@ class struct_hsmp_metric_table(Structure):
amdsmi_get_metrics_table = _libraries['libamd_smi.so'].amdsmi_get_metrics_table
amdsmi_get_metrics_table.restype = amdsmi_status_t
amdsmi_get_metrics_table.argtypes = [amdsmi_cpusocket_handle, uint8_t, ctypes.POINTER(struct_hsmp_metric_table)]
-amdsmi_get_cpu_family = _libraries['libamd_smi.so'].amdsmi_get_cpu_family
-amdsmi_get_cpu_family.restype = amdsmi_status_t
-amdsmi_get_cpu_family.argtypes = [uint32_t]
-amdsmi_get_cpu_model = _libraries['libamd_smi.so'].amdsmi_get_cpu_model
-amdsmi_get_cpu_model.restype = amdsmi_status_t
-amdsmi_get_cpu_model.argtypes = [uint32_t]
-amdsmi_get_cpu_threads_per_core = _libraries['libamd_smi.so'].amdsmi_get_cpu_threads_per_core
-amdsmi_get_cpu_threads_per_core.restype = amdsmi_status_t
-amdsmi_get_cpu_threads_per_core.argtypes = [uint32_t]
-amdsmi_get_number_of_cpu_cores = _libraries['libamd_smi.so'].amdsmi_get_number_of_cpu_cores
-amdsmi_get_number_of_cpu_cores.restype = amdsmi_status_t
-amdsmi_get_number_of_cpu_cores.argtypes = [uint32_t]
-amdsmi_get_number_of_cpu_sockets = _libraries['libamd_smi.so'].amdsmi_get_number_of_cpu_sockets
-amdsmi_get_number_of_cpu_sockets.restype = amdsmi_status_t
-amdsmi_get_number_of_cpu_sockets.argtypes = [uint32_t]
amdsmi_first_online_core_on_cpu_socket = _libraries['libamd_smi.so'].amdsmi_first_online_core_on_cpu_socket
amdsmi_first_online_core_on_cpu_socket.restype = amdsmi_status_t
amdsmi_first_online_core_on_cpu_socket.argtypes = [amdsmi_cpusocket_handle, uint32_t, ctypes.POINTER(ctypes.c_uint32)]
@@ -2207,22 +2201,24 @@ __all__ = \
'AMDSMI_VRAM_VENDOR__WINBOND', 'AMDSMI_XGMI_STATUS_ERROR',
'AMDSMI_XGMI_STATUS_MULTIPLE_ERRORS',
'AMDSMI_XGMI_STATUS_NO_ERRORS', 'AMD_APU', 'AMD_CPU',
- 'AMD_CPU_CORE', 'AMD_GPU', 'CLK_TYPE_DCEF', 'CLK_TYPE_DCLK0',
- 'CLK_TYPE_DCLK1', 'CLK_TYPE_DF', 'CLK_TYPE_FIRST', 'CLK_TYPE_GFX',
- 'CLK_TYPE_MEM', 'CLK_TYPE_PCIE', 'CLK_TYPE_SOC', 'CLK_TYPE_SYS',
- 'CLK_TYPE_VCLK0', 'CLK_TYPE_VCLK1', 'CLK_TYPE__MAX',
- 'COMPUTE_PARTITION_CPX', 'COMPUTE_PARTITION_DPX',
- 'COMPUTE_PARTITION_INVALID', 'COMPUTE_PARTITION_QPX',
- 'COMPUTE_PARTITION_SPX', 'COMPUTE_PARTITION_TPX',
- 'CONTAINER_DOCKER', 'CONTAINER_LXC', 'FW_ID_ASD', 'FW_ID_CP_CE',
- 'FW_ID_CP_ME', 'FW_ID_CP_MEC1', 'FW_ID_CP_MEC2',
- 'FW_ID_CP_MEC_JT1', 'FW_ID_CP_MEC_JT2', 'FW_ID_CP_MES',
- 'FW_ID_CP_PFP', 'FW_ID_CP_PM4', 'FW_ID_DFC', 'FW_ID_DMCU',
- 'FW_ID_DMCU_ERAM', 'FW_ID_DMCU_ISR', 'FW_ID_DRV_CAP',
- 'FW_ID_FIRST', 'FW_ID_IMU_DRAM', 'FW_ID_IMU_IRAM', 'FW_ID_ISP',
- 'FW_ID_MC', 'FW_ID_MES_KIQ', 'FW_ID_MES_STACK',
- 'FW_ID_MES_THREAD1', 'FW_ID_MES_THREAD1_STACK', 'FW_ID_MMSCH',
- 'FW_ID_PPTABLE', 'FW_ID_PSP_BL', 'FW_ID_PSP_DBG',
+ 'AMD_CPU_CORE', 'AMD_GPU', 'CACHE_FLAGS_CPU_CACHE',
+ 'CACHE_FLAGS_DATA_CACHE', 'CACHE_FLAGS_ENABLED',
+ 'CACHE_FLAGS_INST_CACHE', 'CACHE_FLAGS_SIMD_CACHE',
+ 'CLK_TYPE_DCEF', 'CLK_TYPE_DCLK0', 'CLK_TYPE_DCLK1',
+ 'CLK_TYPE_DF', 'CLK_TYPE_FIRST', 'CLK_TYPE_GFX', 'CLK_TYPE_MEM',
+ 'CLK_TYPE_PCIE', 'CLK_TYPE_SOC', 'CLK_TYPE_SYS', 'CLK_TYPE_VCLK0',
+ 'CLK_TYPE_VCLK1', 'CLK_TYPE__MAX', 'COMPUTE_PARTITION_CPX',
+ 'COMPUTE_PARTITION_DPX', 'COMPUTE_PARTITION_INVALID',
+ 'COMPUTE_PARTITION_QPX', 'COMPUTE_PARTITION_SPX',
+ 'COMPUTE_PARTITION_TPX', 'CONTAINER_DOCKER', 'CONTAINER_LXC',
+ 'FW_ID_ASD', 'FW_ID_CP_CE', 'FW_ID_CP_ME', 'FW_ID_CP_MEC1',
+ 'FW_ID_CP_MEC2', 'FW_ID_CP_MEC_JT1', 'FW_ID_CP_MEC_JT2',
+ 'FW_ID_CP_MES', 'FW_ID_CP_PFP', 'FW_ID_CP_PM4', 'FW_ID_DFC',
+ 'FW_ID_DMCU', 'FW_ID_DMCU_ERAM', 'FW_ID_DMCU_ISR',
+ 'FW_ID_DRV_CAP', 'FW_ID_FIRST', 'FW_ID_IMU_DRAM',
+ 'FW_ID_IMU_IRAM', 'FW_ID_ISP', 'FW_ID_MC', 'FW_ID_MES_KIQ',
+ 'FW_ID_MES_STACK', 'FW_ID_MES_THREAD1', 'FW_ID_MES_THREAD1_STACK',
+ 'FW_ID_MMSCH', 'FW_ID_PPTABLE', 'FW_ID_PSP_BL', 'FW_ID_PSP_DBG',
'FW_ID_PSP_INTF', 'FW_ID_PSP_KEYDB', 'FW_ID_PSP_SOC',
'FW_ID_PSP_SOSDRV', 'FW_ID_PSP_SPL', 'FW_ID_PSP_SYSDRV',
'FW_ID_PSP_TOC', 'FW_ID_REG_ACCESS_WHITELIST', 'FW_ID_RLC',
@@ -2256,12 +2252,12 @@ __all__ = \
'VRAM_TYPE_UNKNOWN', 'VRAM_TYPE__MAX', 'WR_BW0',
'amd_metrics_table_header_t', 'amdsmi_asic_info_t',
'amdsmi_bdf_t', 'amdsmi_bit_field_t', 'amdsmi_board_info_t',
- 'amdsmi_clk_info_t', 'amdsmi_clk_type_t',
- 'amdsmi_compute_partition_type_t', 'amdsmi_container_types_t',
- 'amdsmi_counter_command_t', 'amdsmi_counter_value_t',
- 'amdsmi_cpu_apb_disable', 'amdsmi_cpu_apb_enable',
- 'amdsmi_cpusocket_handle', 'amdsmi_ddr_bw_metrics_t',
- 'amdsmi_dev_compute_partition_get',
+ 'amdsmi_cache_flags_type_t', 'amdsmi_clk_info_t',
+ 'amdsmi_clk_type_t', 'amdsmi_compute_partition_type_t',
+ 'amdsmi_container_types_t', 'amdsmi_counter_command_t',
+ 'amdsmi_counter_value_t', 'amdsmi_cpu_apb_disable',
+ 'amdsmi_cpu_apb_enable', 'amdsmi_cpusocket_handle',
+ 'amdsmi_ddr_bw_metrics_t', 'amdsmi_dev_compute_partition_get',
'amdsmi_dev_compute_partition_reset',
'amdsmi_dev_compute_partition_set',
'amdsmi_dev_memory_partition_get',
@@ -2285,9 +2281,8 @@ __all__ = \
'amdsmi_get_cpu_current_xgmi_bw', 'amdsmi_get_cpu_ddr_bw',
'amdsmi_get_cpu_dimm_power_consumption',
'amdsmi_get_cpu_dimm_temp_range_and_refresh_rate',
- 'amdsmi_get_cpu_dimm_thermal_sensor', 'amdsmi_get_cpu_family',
- 'amdsmi_get_cpu_fclk_mclk', 'amdsmi_get_cpu_hsmp_proto_ver',
- 'amdsmi_get_cpu_model', 'amdsmi_get_cpu_prochot_status',
+ 'amdsmi_get_cpu_dimm_thermal_sensor', 'amdsmi_get_cpu_fclk_mclk',
+ 'amdsmi_get_cpu_hsmp_proto_ver', 'amdsmi_get_cpu_prochot_status',
'amdsmi_get_cpu_pwr_svi_telemetry_all_rails',
'amdsmi_get_cpu_smu_fw_version',
'amdsmi_get_cpu_socket_c0_residency',
@@ -2297,12 +2292,12 @@ __all__ = \
'amdsmi_get_cpu_socket_lclk_dpm_level',
'amdsmi_get_cpu_socket_power', 'amdsmi_get_cpu_socket_power_cap',
'amdsmi_get_cpu_socket_power_cap_max',
- 'amdsmi_get_cpu_socket_temperature',
- 'amdsmi_get_cpu_threads_per_core', 'amdsmi_get_cpucore_handles',
- 'amdsmi_get_cpusocket_handles', 'amdsmi_get_cpusocket_info',
- 'amdsmi_get_energy_count', 'amdsmi_get_esmi_err_msg',
- 'amdsmi_get_fw_info', 'amdsmi_get_gpu_activity',
- 'amdsmi_get_gpu_asic_info', 'amdsmi_get_gpu_available_counters',
+ 'amdsmi_get_cpu_socket_temperature', 'amdsmi_get_cpucore_handles',
+ 'amdsmi_get_cpucore_info', 'amdsmi_get_cpusocket_handles',
+ 'amdsmi_get_cpusocket_info', 'amdsmi_get_energy_count',
+ 'amdsmi_get_esmi_err_msg', 'amdsmi_get_fw_info',
+ 'amdsmi_get_gpu_activity', 'amdsmi_get_gpu_asic_info',
+ 'amdsmi_get_gpu_available_counters',
'amdsmi_get_gpu_bad_page_info', 'amdsmi_get_gpu_bdf_id',
'amdsmi_get_gpu_board_info', 'amdsmi_get_gpu_cache_info',
'amdsmi_get_gpu_compute_process_gpus',
@@ -2333,10 +2328,9 @@ __all__ = \
'amdsmi_get_gpu_vram_vendor', 'amdsmi_get_lib_version',
'amdsmi_get_metrics_table', 'amdsmi_get_metrics_table_version',
'amdsmi_get_minmax_bandwidth_between_processors',
- 'amdsmi_get_number_of_cpu_cores',
- 'amdsmi_get_number_of_cpu_sockets', 'amdsmi_get_pcie_link_caps',
- 'amdsmi_get_pcie_link_status', 'amdsmi_get_power_cap_info',
- 'amdsmi_get_power_info', 'amdsmi_get_processor_handle_from_bdf',
+ 'amdsmi_get_pcie_link_caps', 'amdsmi_get_pcie_link_status',
+ 'amdsmi_get_power_cap_info', 'amdsmi_get_power_info',
+ 'amdsmi_get_processor_handle_from_bdf',
'amdsmi_get_processor_handles', 'amdsmi_get_processor_type',
'amdsmi_get_socket_handles', 'amdsmi_get_socket_info',
'amdsmi_get_temp_metric', 'amdsmi_get_utilization_count',
diff --git a/projects/amdsmi/py-interface/pyproject.toml b/projects/amdsmi/py-interface/pyproject.toml.in
similarity index 76%
rename from projects/amdsmi/py-interface/pyproject.toml
rename to projects/amdsmi/py-interface/pyproject.toml.in
index fa2cb5d040..45b18e4d11 100644
--- a/projects/amdsmi/py-interface/pyproject.toml
+++ b/projects/amdsmi/py-interface/pyproject.toml.in
@@ -2,7 +2,7 @@
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
[build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools>=59.0"]
build-backend = "setuptools.build_meta"
[project]
@@ -10,11 +10,11 @@ name = "amdsmi"
authors = [
{name = "AMD", email = "amd-smi.support@amd.com"},
]
-version = "23.4.0.0"
+version = "@amd_smi_libraries_VERSION_STRING@"
license = {file = "amdsmi/LICENSE"}
readme = {file = "amdsmi/README.md", content-type = "text/markdown"}
description = "AMDSMI Python LIB - AMD GPU Monitoring Library"
-requires-python = ">=3.7"
+requires-python = ">=3.6"
dependencies = [
"PyYAML >= 5.0",
"clang >= 14.0"
@@ -25,3 +25,7 @@ dependencies = [
[tool.setuptools]
packages = ["amdsmi"]
+
+# install libamd_smi.so
+[tool.setuptools.package-data]
+amdsmi = ["*.so"]
diff --git a/projects/amdsmi/py-interface/setup.cfg.in b/projects/amdsmi/py-interface/setup.cfg.in
new file mode 100644
index 0000000000..3647feae6b
--- /dev/null
+++ b/projects/amdsmi/py-interface/setup.cfg.in
@@ -0,0 +1,9 @@
+# this file is only required for setuptools < 61.0
+# mostly a rhel8 limitation...
+
+[metadata]
+name = amdsmi
+version = @amd_smi_libraries_VERSION_STRING@
+
+[options.package_data]
+amdsmi = *.so
diff --git a/projects/amdsmi/rocm_smi/CMakeLists.txt b/projects/amdsmi/rocm_smi/CMakeLists.txt
index 3fa6a8972a..43b723a7d0 100755
--- a/projects/amdsmi/rocm_smi/CMakeLists.txt
+++ b/projects/amdsmi/rocm_smi/CMakeLists.txt
@@ -32,7 +32,7 @@ message("Package version: ${PKG_VERSION_STR}")
# Debian package specific variables
# Set a default value for the package version
-get_version_from_tag("5.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
+get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
# VERSION_* variables should be set by get_version_from_tag
if(${ROCM_PATCH_VERSION})
diff --git a/projects/amdsmi/rocm_smi/example/rocm_smi_example.cc b/projects/amdsmi/rocm_smi/example/rocm_smi_example.cc
index 83d141dc74..4427c0c446 100755
--- a/projects/amdsmi/rocm_smi/example/rocm_smi_example.cc
+++ b/projects/amdsmi/rocm_smi/example/rocm_smi_example.cc
@@ -156,6 +156,15 @@
} \
}
+void print_function_header_with_rsmi_ret(
+ rsmi_status_t myReturn, std::string header = "") {
+ std::cout << "\t** ";
+ if (!header.empty()) {
+ std::cout << header << ": ";
+ }
+ std::cout << amd::smi::getRSMIStatusString(myReturn, false) << "\n";
+}
+
static void print_test_header(const char *str, uint32_t dv_ind) {
std::cout << "********************************" << "\n";
std::cout << "*** " << str << "\n";
@@ -254,14 +263,24 @@ perf_level_string(rsmi_dev_perf_level_t perf_lvl) {
}
}
-static bool isUserRunningAsSudo() {
- bool isRunningWithSudo = false;
- auto myUID = getuid();
- auto myPrivledges = geteuid();
- if ((myUID == myPrivledges) && (myPrivledges == 0)) {
- isRunningWithSudo = true;
+static const std::string
+clock_type_string(rsmi_clk_type_t clk) {
+ switch (clk) {
+ case RSMI_CLK_TYPE_SYS:
+ return "RSMI_CLK_TYPE_SYS";
+ case RSMI_CLK_TYPE_DF:
+ return "RSMI_CLK_TYPE_DF";
+ case RSMI_CLK_TYPE_DCEF:
+ return "RSMI_CLK_TYPE_DCEF";
+ case RSMI_CLK_TYPE_SOC:
+ return "RSMI_CLK_TYPE_SOC";
+ case RSMI_CLK_TYPE_MEM:
+ return "RSMI_CLK_TYPE_MEM";
+ case RSMI_CLK_TYPE_PCIE:
+ return "RSMI_CLK_TYPE_PCIE";
+ default:
+ return "RSMI_CLK_INVALID";
}
- return isRunningWithSudo;
}
static bool isFileWritable(rsmi_status_t response) {
@@ -271,7 +290,7 @@ static bool isFileWritable(rsmi_status_t response) {
// isFileWritable(ret) - intends to capture this
// response situation.
bool fileWritable = true;
- if (isUserRunningAsSudo() && (response == RSMI_STATUS_PERMISSION)) {
+ if (amd::smi::is_sudo_user() && (response == RSMI_STATUS_PERMISSION)) {
std::cout << "[WARN] User is running with sudo "
<< "permissions, file is not writable." << "\n";
fileWritable = false;
@@ -574,9 +593,19 @@ static rsmi_status_t test_set_freq(uint32_t dv_ind) {
}
static void print_frequencies(rsmi_frequencies_t *f) {
- assert(f != nullptr);
+ bool hasDeepSleep = false;
+ if (f == nullptr) {
+ std::cout << "Freq was nullptr\n";
+ return;
+ }
for (uint32_t j = 0; j < f->num_supported; ++j) {
- std::cout << "\t** " << j << ": " << std::to_string(f->frequency[j]);
+ if (f->has_deep_sleep && j == 0) {
+ std::cout << "\t** S: " << std::to_string(f->frequency[j]);
+ hasDeepSleep = true;
+ } else {
+ std::cout << "\t** " << (hasDeepSleep ? j-1 : j)
+ << ": " << std::to_string(f->frequency[j]);
+ }
if (j == f->current) {
std::cout << " *";
}
@@ -714,6 +743,7 @@ int main() {
rsmi_frequencies_t f;
uint32_t num_monitor_devs = 0;
rsmi_gpu_metrics_t p;
+ std::string val_str;
RSMI_POWER_TYPE power_type = RSMI_INVALID_POWER;
rsmi_num_monitor_devices(&num_monitor_devs);
@@ -725,6 +755,8 @@ int main() {
ret = rsmi_dev_revision_get(i, &val_ui16);
CHK_RSMI_RET_I(ret)
std::cout << "\t**Dev.Rev.ID: 0x" << std::hex << val_ui16 << "\n";
+ ret = amd::smi::rsmi_get_gfx_target_version(i , &val_str);
+ std::cout << "\t**Target Graphics Version: " << val_str << "\n";
char pcie_vendor_name[256];
ret = rsmi_dev_pcie_vendor_name_get(i, pcie_vendor_name, 256);
@@ -741,7 +773,7 @@ int main() {
? "UNKNOWN" : current_compute_partition);
if (ret != RSMI_STATUS_SUCCESS) {
std::cout << ", RSMI_STATUS = ";
-} else {
+ } else {
std::cout << "\n";
}
CHK_RSMI_NOT_SUPPORTED_OR_UNEXPECTED_DATA_RET(ret)
@@ -778,8 +810,42 @@ int main() {
}
ret = rsmi_dev_gpu_metrics_info_get(i, &p);
- CHK_AND_PRINT_RSMI_ERR_RET(ret)
- std::cout << "\t**GPU METRICS" << "\n";
+ print_test_header("GPU METRICS", i);
+ print_function_header_with_rsmi_ret(ret,
+ "rsmi_dev_gpu_metrics_info_get(" + std::to_string(i) + ", &p)");
+ std::cout << "\t**p.common_header.content_revision: " << std::dec
+ << p.common_header.content_revision << "\n";
+ std::cout << "\t**p.common_header.format_revision: " << std::dec
+ << p.common_header.format_revision << "\n";
+ std::cout << "\t**p.average_gfxclk_frequency: " << std::dec
+ << p.average_gfxclk_frequency << "\n";
+ std::cout << "\t**p.average_socclk_frequency: " << std::dec
+ << p.average_socclk_frequency << "\n";
+ std::cout << "\t**p.average_uclk_frequency: " << std::dec
+ << p.average_uclk_frequency << "\n";
+ std::cout << "\t**p.average_vclk0_frequency: " << std::dec
+ << p.average_vclk0_frequency << "\n";
+ std::cout << "\t**p.average_dclk0_frequency: " << std::dec
+ << p.average_dclk0_frequency << "\n";
+ std::cout << "\t**p.average_vclk1_frequency: " << std::dec
+ << p.average_vclk1_frequency << "\n";
+ std::cout << "\t**p.average_dclk1_frequency: " << std::dec
+ << p.average_dclk1_frequency << "\n";
+
+ std::cout << "\t**p.current_gfxclk: " << std::dec
+ << p.current_gfxclk << "\n";
+ std::cout << "\t**p.current_socclk: " << std::dec
+ << p.current_socclk << "\n";
+ std::cout << "\t**p.current_uclk: " << std::dec
+ << p.current_uclk << "\n";
+ std::cout << "\t**p.current_vclk0: " << std::dec
+ << p.current_vclk0 << "\n";
+ std::cout << "\t**p.current_dclk0: " << std::dec
+ << p.current_dclk0 << "\n";
+ std::cout << "\t**p.current_vclk1: " << std::dec
+ << p.current_vclk1 << "\n";
+ std::cout << "\t**p.current_dclk1: " << std::dec
+ << p.current_dclk1 << "\n";
ret = rsmi_dev_perf_level_get(i, &pfl);
CHK_AND_PRINT_RSMI_ERR_RET(ret)
@@ -789,25 +855,25 @@ int main() {
CHK_AND_PRINT_RSMI_ERR_RET(ret)
std::cout << "\t**OverDrive Level:" << val_ui32 << "\n";
- ret = rsmi_dev_gpu_clk_freq_get(i, RSMI_CLK_TYPE_MEM, &f);
- CHK_AND_PRINT_RSMI_ERR_RET(ret)
- std::cout << "\t**Supported GPU Memory clock frequencies: ";
- std::cout << f.num_supported << "\n";
- print_frequencies(&f);
-
- ret = rsmi_dev_gpu_clk_freq_get(i, RSMI_CLK_TYPE_SYS, &f);
- CHK_AND_PRINT_RSMI_ERR_RET(ret)
- std::cout << "\t**Supported GPU clock frequencies: ";
- std::cout << f.num_supported << "\n";
- print_frequencies(&f);
-
- ret = rsmi_dev_gpu_clk_freq_get(i, RSMI_CLK_TYPE_SOC, &f);
- CHK_RSMI_NOT_SUPPORTED_OR_UNEXPECTED_DATA_RET(ret)
- std::cout << "\t**Supported GPU clock frequencies (SOC clk): ";
- std::cout << f.num_supported << "\n";
- std::cout << "\t**Current value (SOC clk): ";
- std::cout << f.current << "\n";
- print_frequencies(&f);
+ print_test_header("GPU Clocks", i);
+ for (int clkType = static_cast(RSMI_CLK_TYPE_SYS);
+ clkType <= static_cast(RSMI_CLK_TYPE_PCIE);
+ clkType++) {
+ rsmi_clk_type_t type = static_cast(clkType);
+ ret = rsmi_dev_gpu_clk_freq_get(i, type, &f);
+ print_function_header_with_rsmi_ret(ret,
+ "rsmi_dev_gpu_clk_freq_get(" + std::to_string(i) +
+ ", " + clock_type_string(type) + ", &f)");
+ if (ret != RSMI_STATUS_SUCCESS) {
+ continue;
+ }
+ std::cout << "\t** " << clock_type_string(type)
+ << " - Supported # of freqs: ";
+ std::cout << f.num_supported << "\n";
+ std::cout << "\t** " << clock_type_string(type) << " f.current: "
+ << f.current << "\n";
+ print_frequencies(&f);
+ }
std::cout << "\t**Monitor name: ";
char name[128];
@@ -897,7 +963,7 @@ int main() {
}
std::cout << "***** Testing write api's" << "\n";
- if (isUserRunningAsSudo() == false) {
+ if (amd::smi::is_sudo_user() == false) {
std::cout << "Write APIs require users to execute with sudo. "
<< "Cannot proceed." << "\n";
return 0;
diff --git a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi.h b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi.h
index fef797cc5f..3460bebac2 100755
--- a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi.h
+++ b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi.h
@@ -377,16 +377,16 @@ typedef rsmi_clk_type_t rsmi_clk_type;
*/
typedef enum {
RSMI_COMPUTE_PARTITION_INVALID = 0,
- RSMI_COMPUTE_PARTITION_CPX, //!< Core mode (CPX)- Per-chip XCC with
- //!< shared memory
- RSMI_COMPUTE_PARTITION_SPX, //!< Single GPU mode (SPX)- All XCCs work
- //!< together with shared memory
- RSMI_COMPUTE_PARTITION_DPX, //!< Dual GPU mode (DPX)- Half XCCs work
- //!< together with shared memory
- RSMI_COMPUTE_PARTITION_TPX, //!< Triple GPU mode (TPX)- One-third XCCs
- //!< work together with shared memory
- RSMI_COMPUTE_PARTITION_QPX //!< Quad GPU mode (QPX)- Quarter XCCs
- //!< work together with shared memory
+ RSMI_COMPUTE_PARTITION_CPX = 1, //!< Core mode (CPX)- Per-chip XCC with
+ //!< shared memory
+ RSMI_COMPUTE_PARTITION_SPX = 2, //!< Single GPU mode (SPX)- All XCCs work
+ //!< together with shared memory
+ RSMI_COMPUTE_PARTITION_DPX = 3, //!< Dual GPU mode (DPX)- Half XCCs work
+ //!< together with shared memory
+ RSMI_COMPUTE_PARTITION_TPX = 4, //!< Triple GPU mode (TPX)- One-third XCCs
+ //!< work together with shared memory
+ RSMI_COMPUTE_PARTITION_QPX = 5, //!< Quad GPU mode (QPX)- Quarter XCCs
+ //!< work together with shared memory
} rsmi_compute_partition_type_t;
/// \cond Ignore in docs.
typedef rsmi_compute_partition_type_t rsmi_compute_partition_type;
@@ -713,6 +713,10 @@ typedef enum _RSMI_IO_LINK_TYPE {
RSMI_IOLINK_TYPE_SIZE = 0xFFFFFFFF //!< Max of IO Link types
} RSMI_IO_LINK_TYPE;
+//! The CPU node index which will be used in rsmi_topo_get_link_type
+//! to query the link type between GPU and CPU
+#define CPU_NODE_INDEX 0xFFFFFFFF
+
/**
* @brief The utilization counter type
*/
@@ -864,6 +868,14 @@ typedef struct {
struct {
uint32_t cache_size_kb; /* In KB */
uint32_t cache_level;
+ /*
+ HSA_CACHE_TYPE_DATA 0x00000001
+ HSA_CACHE_TYPE_INSTRUCTION 0x00000002
+ HSA_CACHE_TYPE_CPU 0x00000004
+ HSA_CACHE_TYPE_HSACU 0x00000008
+ so HSA_CACHE_TYPE_DATA|HSA_CACHE_TYPE_HSACU == 9
+ */
+ uint32_t flags;
} cache[RSMI_MAX_CACHE_TYPES];
} rsmi_gpu_cache_info_t;
/// \cond Ignore in docs.
@@ -3848,7 +3860,7 @@ rsmi_minmax_bandwidth_get(uint32_t dv_ind_src, uint32_t dv_ind_dst,
uint64_t *min_bandwidth, uint64_t *max_bandwidth);
/**
- * @brief Retrieve the hops and the connection type between 2 GPUs
+ * @brief Retrieve the hops and the connection type between GPU to GPU/CPU
*
* @details Given a source device index @p dv_ind_src and
* a destination device index @p dv_ind_dst, and a pointer to an
@@ -3857,6 +3869,14 @@ rsmi_minmax_bandwidth_get(uint32_t dv_ind_src, uint32_t dv_ind_dst,
* between the device @p dv_ind_src and @p dv_ind_dst to the memory
* pointed to by @p hops and @p type.
*
+ * To query the link type between GPU and CPU, given a source GPU index
+ * @p dev_ind_srcc and a destination device index @p dv_ind_dst
+ * CPU_NODE_INDEX(0xFFFFFFFF), a pointer to an
+ * uint64_t @p hops and a pointer to an RSMI_IO_LINK_TYPE @p type,
+ * this function will write the number of hops and the connection type
+ * between the device @p dv_ind_src and CPU to the memory
+ * pointed to by @p hops and @p type.
+ *
* @param[in] dv_ind_src the source device index
*
* @param[in] dv_ind_dst the destination device index
@@ -3960,6 +3980,8 @@ rsmi_dev_compute_partition_get(uint32_t dv_ind, char *compute_partition,
* unavailable for current device
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function
+ * @retval ::RSMI_STATUS_BUSY A resource or mutex could not be acquired
+ * because it is already being used - device is busy
*
*/
rsmi_status_t
@@ -3979,6 +4001,8 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
* @retval ::RSMI_STATUS_PERMISSION function requires root access
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function
+ * @retval ::RSMI_STATUS_BUSY A resource or mutex could not be acquired
+ * because it is already being used - device is busy
*
*/
rsmi_status_t rsmi_dev_compute_partition_reset(uint32_t dv_ind);
@@ -4043,6 +4067,8 @@ rsmi_dev_memory_partition_get(uint32_t dv_ind, char *memory_partition,
* support this function
* @retval ::RSMI_STATUS_AMDGPU_RESTART_ERR could not successfully restart
* the amdgpu driver
+ * @retval ::RSMI_STATUS_BUSY A resource or mutex could not be acquired
+ * because it is already being used - device is busy
*
*/
rsmi_status_t
@@ -4064,6 +4090,8 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
* support this function
* @retval ::RSMI_STATUS_AMDGPU_RESTART_ERR could not successfully restart
* the amdgpu driver
+ * @retval ::RSMI_STATUS_BUSY A resource or mutex could not be acquired
+ * because it is already being used - device is busy
*
*/
rsmi_status_t rsmi_dev_memory_partition_reset(uint32_t dv_ind);
diff --git a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_device.h b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_device.h
index c728326691..a64852133a 100755
--- a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_device.h
+++ b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_device.h
@@ -272,7 +272,8 @@ class Device {
std::vector *retVec);
int readDevInfoBinary(DevInfoTypes type, std::size_t b_size,
void *p_binary_data);
- int writeDevInfoStr(DevInfoTypes type, std::string valStr);
+ int writeDevInfoStr(DevInfoTypes type, std::string valStr,
+ bool returnWriteErr = false);
rsmi_status_t run_amdgpu_property_reinforcement_query(const AMDGpuPropertyQuery_t& amdgpu_property_query);
diff --git a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_kfd.h b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_kfd.h
index 7e11130bd4..1173f48109 100755
--- a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_kfd.h
+++ b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_kfd.h
@@ -87,6 +87,9 @@ class KFDNode {
// Get cache info from kfd
int get_cache_info(rsmi_gpu_cache_info_t *info);
+ // Get gfx target version from kfd
+ int get_gfx_target_version(uint64_t* gfx_target_version);
+
private:
uint32_t node_indx_;
uint32_t amdgpu_dev_index_;
diff --git a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_utils.h b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_utils.h
index febbf5c049..a6c3e80c31 100755
--- a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_utils.h
+++ b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_utils.h
@@ -51,6 +51,8 @@
#include
#include
#include
+#include
+#include
#include "rocm_smi/rocm_smi_device.h"
@@ -97,10 +99,10 @@ rsmi_status_t
GetDevBinaryBlob(amd::smi::DevInfoTypes type,
uint32_t dv_ind, std::size_t b_size, void* p_binary_data);
rsmi_status_t ErrnoToRsmiStatus(int err);
-std::string getRSMIStatusString(rsmi_status_t ret);
+std::string getRSMIStatusString(rsmi_status_t ret, bool fullStatus = true);
std::tuple
+ std::string, std::string, std::string, std::string, std::string>
getSystemDetails(void);
void logSystemDetails(void);
rsmi_status_t getBDFString(uint64_t bdf_id, std::string& bfd_str);
@@ -110,11 +112,20 @@ void logHexDump(const char *desc, const void *addr, const size_t len,
bool isSystemBigEndian();
std::string getBuildType();
std::string getMyLibPath();
+std::string getFileCreationDate(std::string path);
int subDirectoryCountInPath(const std::string path);
+std::queue getAllDeviceGfxVers();
std::string monitor_type_string(amd::smi::MonitorTypes type);
std::string power_type_string(RSMI_POWER_TYPE type);
+std::string splitString(std::string str, char delim);
+std::string print_rsmi_od_volt_freq_data_t(rsmi_od_volt_freq_data_t *odv);
+std::string print_rsmi_od_volt_freq_regions(uint32_t num_regions,
+ rsmi_freq_volt_region_t *regions);
+bool is_sudo_user();
+rsmi_status_t rsmi_get_gfx_target_version(uint32_t dv_ind,
+ std::string *gfx_version);
template
-std::string print_int_as_hex(T i, bool showHexNotation=true) {
+ std::string print_int_as_hex(T i, bool showHexNotation = true) {
std::stringstream ss;
if (showHexNotation) {
ss << "0x" << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex;
@@ -133,7 +144,7 @@ std::string print_int_as_hex(T i, bool showHexNotation=true) {
}
ss << std::dec;
return ss.str();
-};
+}
template
std::string print_unsigned_int(T i) {
@@ -264,7 +275,7 @@ class ScopedAcquire {
LockType* lock_;
bool doRelease;
/// @brief: Disable copiable and assignable ability.
- DISALLOW_COPY_AND_ASSIGN(ScopedAcquire);
+ DISALLOW_COPY_AND_ASSIGN(ScopedAcquire)
};
// The best effort way to decide whether it is in VM guest environment:
diff --git a/projects/amdsmi/rocm_smi/python_smi_tools/README.md b/projects/amdsmi/rocm_smi/python_smi_tools/README.md
index 42e051fb5e..bbb8652019 100644
--- a/projects/amdsmi/rocm_smi/python_smi_tools/README.md
+++ b/projects/amdsmi/rocm_smi/python_smi_tools/README.md
@@ -1,4 +1,6 @@
-### ROCm System Management Interface
+## Synopsis
+
+Radeon Open Compute Platform - System Management Interface - Command Line tool.
This tool acts as a command line interface for manipulating
and monitoring the amdgpu kernel, and is intended to replace
@@ -7,172 +9,195 @@ It uses Ctypes to call the rocm_smi_lib API.
Recommended: At least one AMD GPU with ROCm driver installed
Required: ROCm SMI library installed (librocm_smi64)
-#### Installation
+## Installation
Follow installation procedure for rocm_smi_lib.
Please refer to [https://github.com/RadeonOpenCompute/rocm_smi_lib](https://github.com/RadeonOpenCompute/rocm_smi_lib) for the installation guide.
LD_LIBRARY_PATH should be set to the folder containing librocm_smi64.
-
-### Version
+## Version
The SMI will report a "version" which is the version of the kernel installed:
-```shell
-AMD ROCm System Management Interface v$(uname)
-```
+ AMD ROCm System Management Interface v$(uname)
For ROCk installations, this will be the AMDGPU module version (e.g. 5.0.71)
For non-ROCk or monolithic ROCk installations, this will be the kernel version,
which will be equivalent to the following bash command:
-```shell
-$(uname -a) | cut -d ' ' -f 3)
-```
+ $(uname -a) | cut -d ' ' -f 3)
-#### Usage
+## Usage
For detailed and up to date usage information, we recommend consulting the help:
-```shell
-/opt/rocm/bin/rocm-smi -h
-```
+
+ /opt/rocm/bin/rocm-smi -h
For convenience purposes, following is the output from the -h flag:
-```shell
+ usage: rocm-smi [-h] [-V] [-d DEVICE [DEVICE ...]] [--alldevices] [--showhw] [-a] [-i] [-v] [-e [EVENT ...]]
+ [--showdriverversion] [--showtempgraph] [--showfwinfo [BLOCK ...]] [--showmclkrange] [--showmemvendor]
+ [--showsclkrange] [--showproductname] [--showserial] [--showuniqueid] [--showvoltagerange] [--showbus]
+ [--showpagesinfo] [--showpendingpages] [--showretiredpages] [--showunreservablepages] [-f] [-P] [-t]
+ [-u] [--showmemuse] [--showvoltage] [-b] [-c] [-g] [-l] [-M] [-m] [-o] [-p] [-S] [-s]
+ [--showmeminfo TYPE [TYPE ...]] [--showpids [VERBOSE]] [--showpidgpus [SHOWPIDGPUS ...]]
+ [--showreplaycount] [--showrasinfo [SHOWRASINFO ...]] [--showvc] [--showxgmierr] [--showtopo]
+ [--showtopoaccess] [--showtopoweight] [--showtopohops] [--showtopotype] [--showtoponuma]
+ [--showenergycounter] [--shownodesbw] [--showcomputepartition] [--showmemorypartition] [-r]
+ [--resetfans] [--resetprofile] [--resetpoweroverdrive] [--resetxgmierr] [--resetperfdeterminism]
+ [--resetcomputepartition] [--resetmemorypartition] [--setclock TYPE LEVEL] [--setsclk LEVEL [LEVEL ...]]
+ [--setmclk LEVEL [LEVEL ...]] [--setpcie LEVEL [LEVEL ...]] [--setslevel SCLKLEVEL SCLK SVOLT]
+ [--setmlevel MCLKLEVEL MCLK MVOLT] [--setvc POINT SCLK SVOLT] [--setsrange SCLKMIN SCLKMAX]
+ [--setmrange MCLKMIN MCLKMAX] [--setfan LEVEL] [--setperflevel LEVEL] [--setoverdrive %]
+ [--setmemoverdrive %] [--setpoweroverdrive WATTS] [--setprofile SETPROFILE] [--setperfdeterminism SCLK]
+ [--setcomputepartition {CPX,SPX,DPX,TPX,QPX,cpx,spx,dpx,tpx,qpx}]
+ [--setmemorypartition {NPS1,NPS2,NPS4,NPS8,nps1,nps2,nps4,nps8}] [--rasenable BLOCK ERRTYPE]
+ [--rasdisable BLOCK ERRTYPE] [--rasinject BLOCK] [--gpureset] [--load FILE | --save FILE]
+ [--autorespond RESPONSE] [--loglevel LEVEL] [--json] [--csv]
-usage: rocmSmiLib_cli.py [-h] [-d DEVICE [DEVICE ...]] [--alldevices] [--showhw] [-a] [-i] [-v] [--showdriverversion]
- [--showfwinfo [BLOCK [BLOCK ...]]] [--showmclkrange] [--showmemvendor] [--showsclkrange]
- [--showproductname] [--showserial] [--showuniqueid] [--showvoltagerange] [--showbus]
- [--showpagesinfo] [--showpendingpages] [--showretiredpages] [--showunreservablepages] [-f] [-P]
- [-t] [-u] [--showmemuse] [--showvoltage] [-b] [-c] [-g] [-l] [-M] [-m] [-o] [-p] [-S] [-s]
- [--showmeminfo TYPE [TYPE ...]] [--showpids] [--showpidgpus [SHOWPIDGPUS [SHOWPIDGPUS ...]]]
- [--showreplaycount] [--showrasinfo [SHOWRASINFO [SHOWRASINFO ...]]] [--showvc] [--showxgmierr]
- [--showtopo] [--showtopoweight] [--showtopohops] [--showtopotype] [--showtoponuma] [-r]
- [--resetfans] [--resetprofile] [--resetpoweroverdrive] [--resetxgmierr]
- [--setsclk LEVEL [LEVEL ...]] [--setmclk LEVEL [LEVEL ...]] [--setpcie LEVEL [LEVEL ...]]
- [--setslevel SCLKLEVEL SCLK SVOLT] [--setmlevel MCLKLEVEL MCLK MVOLT]
- [--setvc POINT SCLK SVOLT] [--setsrange MINMAX SCLK] [--setmrange MINMAX MCLK] [--setfan LEVEL]
- [--setperflevel LEVEL] [--setoverdrive %] [--setmemoverdrive %] [--setpoweroverdrive WATTS]
- [--setprofile SETPROFILE] [--rasenable BLOCK ERRTYPE] [--rasdisable BLOCK ERRTYPE]
- [--rasinject BLOCK] [--gpureset] [--load FILE | --save FILE] [--autorespond RESPONSE]
- [--loglevel LEVEL] [--json] [--csv]
+ AMD ROCm System Management Interface | ROCM-SMI version: 1.5.0
-AMD ROCm System Management Interface | ROCM-SMI version: 1.4.1 | Kernel version: 5.4.8
+ options:
+ -h, --help show this help message and exit
+ --gpureset Reset specified GPU (One GPU must be specified)
+ --load FILE Load Clock, Fan, Performance and Profile settings
+ from FILE
+ --save FILE Save Clock, Fan, Performance and Profile settings to
+ FILE
-optional arguments:
- -h, --help show this help message and exit
- --gpureset Reset specified GPU (One GPU must be specified)
- --load FILE Load Clock, Fan, Performance and Profile settings from FILE
- --save FILE Save Clock, Fan, Performance and Profile settings to FILE
+ -V, --version Show version information
- -d DEVICE [DEVICE ...], --device DEVICE [DEVICE ...] Execute command on specified device
+ -d DEVICE [DEVICE ...], --device DEVICE [DEVICE ...] Execute command on specified device
-Display Options:
- --alldevices
- --showhw Show Hardware details
- -a, --showallinfo Show Temperature, Fan and Clock values
+ Display Options:
+ --alldevices
+ --showhw Show Hardware details
+ -a, --showallinfo Show Temperature, Fan and Clock values
-Topology:
- -i, --showid Show DEVICE ID
- -v, --showvbios Show VBIOS version
- --showdriverversion Show kernel driver version
- --showfwinfo [BLOCK [BLOCK ...]] Show FW information
- --showmclkrange Show mclk range
- --showmemvendor Show GPU memory vendor
- --showsclkrange Show sclk range
- --showproductname Show SKU/Vendor name
- --showserial Show GPU's Serial Number
- --showuniqueid Show GPU's Unique ID
- --showvoltagerange Show voltage range
- --showbus Show PCI bus number
+ Topology:
+ -i, --showid Show DEVICE ID
+ -v, --showvbios Show VBIOS version
+ -e [EVENT ...], --showevents [EVENT ...] Show event list
+ --showdriverversion Show kernel driver version
+ --showtempgraph Show Temperature Graph
+ --showfwinfo [BLOCK ...] Show FW information
+ --showmclkrange Show mclk range
+ --showmemvendor Show GPU memory vendor
+ --showsclkrange Show sclk range
+ --showproductname Show SKU/Vendor name
+ --showserial Show GPU's Serial Number
+ --showuniqueid Show GPU's Unique ID
+ --showvoltagerange Show voltage range
+ --showbus Show PCI bus number
-Pages information:
- --showpagesinfo Show retired, pending and unreservable pages
- --showpendingpages Show pending retired pages
- --showretiredpages Show retired pages
- --showunreservablepages Show unreservable pages
+ Pages information:
+ --showpagesinfo Show retired, pending and unreservable pages
+ --showpendingpages Show pending retired pages
+ --showretiredpages Show retired pages
+ --showunreservablepages Show unreservable pages
-Hardware-related information:
- -f, --showfan Show current fan speed
- -P, --showpower Show current Average Graphics Package Power Consumption
- -t, --showtemp Show current temperature
- -u, --showuse Show current GPU use
- --showmemuse Show current GPU memory used
- --showvoltage Show current GPU voltage
+ Hardware-related information:
+ -f, --showfan Show current fan speed
+ -P, --showpower Show current Average Graphics Package Power
+ Consumption
+ -t, --showtemp Show current temperature
+ -u, --showuse Show current GPU use
+ --showmemuse Show current GPU memory used
+ --showvoltage Show current GPU voltage
-Software-related/controlled information:
- -b, --showbw Show estimated PCIe use
- -c, --showclocks Show current clock frequencies
- -g, --showgpuclocks Show current GPU clock frequencies
- -l, --showprofile Show Compute Profile attributes
- -M, --showmaxpower Show maximum graphics package power this GPU will consume
- -m, --showmemoverdrive Show current GPU Memory Clock OverDrive level
- -o, --showoverdrive Show current GPU Clock OverDrive level
- -p, --showperflevel Show current DPM Performance Level
- -S, --showclkvolt Show supported GPU and Memory Clocks and Voltages
- -s, --showclkfrq Show supported GPU and Memory Clock
- --showmeminfo TYPE [TYPE ...] Show Memory usage information for given block(s) TYPE
- --showpids Show current running KFD PIDs
- --showpidgpus [SHOWPIDGPUS [SHOWPIDGPUS ...]] Show GPUs used by specified KFD PIDs (all if no arg given)
- --showreplaycount Show PCIe Replay Count
- --showrasinfo [SHOWRASINFO [SHOWRASINFO ...]] Show RAS enablement information and error counts for the
- specified block(s) (all if no arg given)
- --showvc Show voltage curve
- --showxgmierr Show XGMI error information since last read
- --showtopo Show hardware topology information
- --showtopoweight Shows the relative weight between GPUs
- --showtopohops Shows the number of hops between GPUs
- --showtopotype Shows the link type between GPUs
- --showtoponuma Shows the numa nodes
+ Software-related/controlled information:
+ -b, --showbw Show estimated PCIe use
+ -c, --showclocks Show current clock frequencies
+ -g, --showgpuclocks Show current GPU clock frequencies
+ -l, --showprofile Show Compute Profile attributes
+ -M, --showmaxpower Show maximum graphics package power this GPU will
+ consume
+ -m, --showmemoverdrive Show current GPU Memory Clock OverDrive level
+ -o, --showoverdrive Show current GPU Clock OverDrive level
+ -p, --showperflevel Show current DPM Performance Level
+ -S, --showclkvolt Show supported GPU and Memory Clocks and Voltages
+ -s, --showclkfrq Show supported GPU and Memory Clock
+ --showmeminfo TYPE [TYPE ...] Show Memory usage information for given block(s) TYPE
+ --showpids [VERBOSE] Show current running KFD PIDs (pass details to
+ VERBOSE for detailed information)
+ --showpidgpus [SHOWPIDGPUS ...] Show GPUs used by specified KFD PIDs (all if no arg
+ given)
+ --showreplaycount Show PCIe Replay Count
+ --showrasinfo [SHOWRASINFO ...] Show RAS enablement information and error counts for
+ the specified block(s) (all if no arg given)
+ --showvc Show voltage curve
+ --showxgmierr Show XGMI error information since last read
+ --showtopo Show hardware topology information
+ --showtopoaccess Shows the link accessibility between GPUs
+ --showtopoweight Shows the relative weight between GPUs
+ --showtopohops Shows the number of hops between GPUs
+ --showtopotype Shows the link type between GPUs
+ --showtoponuma Shows the numa nodes
+ --showenergycounter Energy accumulator that stores amount of energy
+ consumed
+ --shownodesbw Shows the numa nodes
+ --showcomputepartition Shows current compute partitioning
+ --showmemorypartition Shows current memory partition
-Set options:
- --setsclk LEVEL [LEVEL ...] Set GPU Clock Frequency Level(s) (requires manual Perf level)
- --setmclk LEVEL [LEVEL ...] Set GPU Memory Clock Frequency Level(s) (requires manual Perf
- level)
- --setpcie LEVEL [LEVEL ...] Set PCIE Clock Frequency Level(s) (requires manual Perf level)
- --setslevel SCLKLEVEL SCLK SVOLT Change GPU Clock frequency (MHz) and Voltage (mV) for a specific
- Level
- --setmlevel MCLKLEVEL MCLK MVOLT Change GPU Memory clock frequency (MHz) and Voltage for (mV) a
- specific Level
- --setvc POINT SCLK SVOLT Change SCLK Voltage Curve (MHz mV) for a specific point
- --setsrange MINMAX SCLK Set min(0) or max(1) SCLK speed
- --setmrange MINMAX MCLK Set min(0) or max(1) MCLK speed
- --setfan LEVEL Set GPU Fan Speed (Level or %)
- --setperflevel LEVEL Set Performance Level
- --setoverdrive % Set GPU OverDrive level (requires manual|high Perf level)
- --setmemoverdrive % Set GPU Memory Overclock OverDrive level (requires manual|high
- Perf level)
- --setpoweroverdrive WATTS Set the maximum GPU power using Power OverDrive in Watts
- --setprofile SETPROFILE Specify Power Profile level (#) or a quoted string of CUSTOM
- Profile attributes "# # # #..." (requires manual Perf level)
- --rasenable BLOCK ERRTYPE Enable RAS for specified block and error type
- --rasdisable BLOCK ERRTYPE Disable RAS for specified block and error type
- --rasinject BLOCK Inject RAS poison for specified block (ONLY WORKS ON UNSECURE
- BOARDS)
+ Set options:
+ --setclock TYPE LEVEL Set Clock Frequency Level(s) for specified clock
+ (requires manual Perf level)
+ --setsclk LEVEL [LEVEL ...] Set GPU Clock Frequency Level(s) (requires manual
+ Perf level)
+ --setmclk LEVEL [LEVEL ...] Set GPU Memory Clock Frequency Level(s) (requires
+ manual Perf level)
+ --setpcie LEVEL [LEVEL ...] Set PCIE Clock Frequency Level(s) (requires manual
+ Perf level)
+ --setslevel SCLKLEVEL SCLK SVOLT Change GPU Clock frequency (MHz) and Voltage (mV) for
+ a specific Level
+ --setmlevel MCLKLEVEL MCLK MVOLT Change GPU Memory clock frequency (MHz) and Voltage
+ for (mV) a specific Level
+ --setvc POINT SCLK SVOLT Change SCLK Voltage Curve (MHz mV) for a specific
+ point
+ --setsrange SCLKMIN SCLKMAX Set min and max SCLK speed
+ --setmrange MCLKMIN MCLKMAX Set min and max MCLK speed
+ --setfan LEVEL Set GPU Fan Speed (Level or %)
+ --setperflevel LEVEL Set Performance Level
+ --setoverdrive % Set GPU OverDrive level (requires manual|high Perf
+ level)
+ --setmemoverdrive % Set GPU Memory Overclock OverDrive level (requires
+ manual|high Perf level)
+ --setpoweroverdrive WATTS Set the maximum GPU power using Power OverDrive in
+ Watts
+ --setprofile SETPROFILE Specify Power Profile level (#) or a quoted string of
+ CUSTOM Profile attributes "# # # #..." (requires
+ manual Perf level)
+ --setperfdeterminism SCLK Set clock frequency limit to get minimal performance
+ variation
+ --setcomputepartition {CPX,SPX,DPX,TPX,QPX,cpx,spx,dpx,tpx,qpx} Set compute partition
+ --setmemorypartition {NPS1,NPS2,NPS4,NPS8,nps1,nps2,nps4,nps8} Set memory partition
+ --rasenable BLOCK ERRTYPE Enable RAS for specified block and error type
+ --rasdisable BLOCK ERRTYPE Disable RAS for specified block and error type
+ --rasinject BLOCK Inject RAS poison for specified block (ONLY WORKS ON
+ UNSECURE BOARDS)
-Reset options:
- -r, --resetclocks Reset clocks and OverDrive to default
- --resetfans Reset fans to automatic (driver) control
- --resetprofile Reset Power Profile back to default
- --resetpoweroverdrive Set the maximum GPU power back to the device deafult state
- --resetxgmierr Reset XGMI error count
+ Reset options:
+ -r, --resetclocks Reset clocks and OverDrive to default
+ --resetfans Reset fans to automatic (driver) control
+ --resetprofile Reset Power Profile back to default
+ --resetpoweroverdrive Set the maximum GPU power back to the device deafult
+ state
+ --resetxgmierr Reset XGMI error count
+ --resetperfdeterminism Disable performance determinism
+ --resetcomputepartition Resets to boot compute partition state
+ --resetmemorypartition Resets to boot memory partition state
-Auto-response options:
- --autorespond RESPONSE Response to automatically provide for all prompts (NOT
- RECOMMENDED)
+ Auto-response options:
+ --autorespond RESPONSE Response to automatically provide for all prompts
+ (NOT RECOMMENDED)
-Output options:
- --loglevel LEVEL How much output will be printed for what program is doing, one
- of debug/info/warning/error/critical
- --json Print output in JSON format
- --csv Print output in CSV format
+ Output options:
+ --loglevel LEVEL How much output will be printed for what program is
+ doing, one of debug/info/warning/error/critical
+ --json Print output in JSON format
+ --csv Print output in CSV format
-
-```
-
-
-#### Detailed Option Descriptions
+## Detailed Option Descriptions
--setsclk/--setmclk # [# # ...]:
This allows you to set a mask for the levels. For example, if a GPU has 8 clock levels,
@@ -240,21 +265,28 @@ Output options:
The Compute Profile accepts 1 or n parameters, either the Profile to select (see --showprofile for a list
of preset Power Profiles) or a quoted string of values for the CUSTOM profile.
NOTE: These values can vary based on the ASIC, and may include:
- SCLK_PROFILE_ENABLE - Whether or not to apply the 3 following SCLK settings (0=disable,1=enable)
- NOTE: This is a hidden field. If set to 0, the following 3 values are displayed as '-'
- SCLK_UP_HYST - Delay before sclk is increased (in milliseconds)
- SCLK_DOWN_HYST - Delay before sclk is decresed (in milliseconds)
- SCLK_ACTIVE_LEVEL - Workload required before sclk levels change (in %)
- MCLK_PROFILE_ENABLE - Whether or not to apply the 3 following MCLK settings (0=disable,1=enable)
- NOTE: This is a hidden field. If set to 0, the following 3 values are displayed as '-'
- MCLK_UP_HYST - Delay before mclk is increased (in milliseconds)
- MCLK_DOWN_HYST - Delay before mclk is decresed (in milliseconds)
- MCLK_ACTIVE_LEVEL - Workload required before mclk levels change (in %)
- BUSY_SET_POINT - Threshold for raw activity level before levels change
- FPS - Frames Per Second
- USE_RLC_BUSY - When set to 1, DPM is switched up as long as RLC busy message is received
- MIN_ACTIVE_LEVEL - Workload required before levels change (in %)
+| Setting | Description |
+|---------------------|----------------------------------------------------|
+| SCLK_PROFILE_ENABLE | Whether or not to apply the 3 following SCLK settings (0=disable,1=enable) |
+| | **NOTE: This is a hidden field. If set to 0, the following 3 values are displayed as '-’** |
+| SCLK_UP_HYST | Delay before sclk is increased (in milliseconds) |
+| SCLK_DOWN_HYST | Delay before sclk is decresed (in milliseconds) |
+| SCLK_ACTIVE_LEVEL | Workload required before sclk levels change (in %) |
+| MCLK_PROFILE_ENABLE | Whether or not to apply the 3 following MCLK settings (0=disable,1=enable) |
+| | **NOTE: This is a hidden field. If set to 0, the following 3 values are displayed as '-'** |
+| MCLK_UP_HYST | Delay before mclk is increased (in milliseconds) |
+| MCLK_DOWN_HYST | Delay before mclk is decresed (in milliseconds) |
+| MCLK_ACTIVE_LEVEL | Workload required before mclk levels change (in %) |
+
+ Other settings:
+
+| Setting | Description |
+|------------------|---------------------------------------------------------------------------|
+| BUSY_SET_POINT | Threshold for raw activity level before levels change |
+| FPS | Frames Per Second |
+| USE_RLC_BUSY | When set to 1, DPM is switched up as long as RLC busy message is received |
+| MIN_ACTIVE_LEVEL | Workload required before levels change (in %) |
NOTES:
When a compute queue is detected, the COMPUTE Power Profile values will be automatically
@@ -306,16 +338,19 @@ This shows the RAS information for a given block. This includes enablement of th
ue - Uncorrectable errors
ce - Correctable errors
-### Clock Type Descriptions
-DCEFCLK - DCE (Display)
-FCLK - Data fabric (VG20 and later) - Data flow from XGMI, Memory, PCIe
-SCLK - GFXCLK (Graphics core)
- Note - SOCCLK split from SCLK as of Vega10. Pre-Vega10 they were both controlled by SCLK
-MCLK - GPU Memory (VRAM)
-PCLK - PCIe bus
- Note - This gives 2 speeds, PCIe Gen1 x1 and the highest available based on the hardware
-SOCCLK - System clock (VG10 and later) - Data Fabric (DF), MM HUB, AT HUB, SYSTEM HUB, OSS, DFD
- Note - DF split from SOCCLK as of Vega20. Pre-Vega20 they were both controlled by SOCCLK
+## Clock Type Descriptions
+
+| Clock type | Description |
+| ---------- | --- |
+| DCEFCLK | DCE (Display) |
+| FCLK | Data fabric (VG20 and later) - Data flow from XGMI, Memory, PCIe |
+| SCLK | GFXCLK (Graphics core) |
+| | **Note - SOCCLK split from SCLK as of Vega10. Pre-Vega10 they were both controlled by SCLK** |
+| MCLK | GPU Memory (VRAM) |
+| PCLK | PCIe bus |
+| | **Note - This gives 2 speeds, PCIe Gen1 x1 and the highest available based on the hardware** |
+| SOCCLK | System clock (VG10 and later) - Data Fabric (DF), MM HUB, AT HUB, SYSTEM HUB, OSS, DFD |
+| | **Note - DF split from SOCCLK as of Vega20. Pre-Vega20 they were both controlled by SOCCLK** |
--gpureset:
This flag will attempt to reset the GPU for a specified device. This will invoke the GPU reset through
@@ -355,7 +390,7 @@ is calculated in a generic sense.
as well as the total available for those partitions. The percentage shown there indicates the
amount of used memory in terms of current allocations
-### OverDrive settings ####
+## OverDrive settings
Enabling OverDrive requires both a card that support OverDrive and a driver parameter that enables its use.
Because OverDrive features can damage your card, most workstation and server GPUs cannot use OverDrive.
@@ -371,22 +406,21 @@ As an example, if the ppfeaturemask is set to 0xffffbfff (1111111111111111101111
then enabling the OverDrive bit would make it 0xffffffff (11111111111111111111111111111111).
These are the flags that require OverDrive functionality to be enabled for the flag to work:
---showclkvolt
---showvoltagerange
---showvc
---showsclkrange
---showmclkrange
---setslevel
---setmlevel
---setoverdrive
---setpoweroverdrive
---resetpoweroverdrive
---setvc
---setsrange
---setmrange
+ --showclkvolt
+ --showvoltagerange
+ --showvc
+ --showsclkrange
+ --showmclkrange
+ --setslevel
+ --setmlevel
+ --setoverdrive
+ --setpoweroverdrive
+ --resetpoweroverdrive
+ --setvc
+ --setsrange
+ --setmrange
-
-#### Disclaimer
+## Disclaimer
The information contained herein is for informational purposes only, and is subject to change without notice. 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.
diff --git a/projects/amdsmi/rocm_smi/python_smi_tools/build_manual.sh b/projects/amdsmi/rocm_smi/python_smi_tools/build_manual.sh
new file mode 100755
index 0000000000..0a00b2095c
--- /dev/null
+++ b/projects/amdsmi/rocm_smi/python_smi_tools/build_manual.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+# Build manpages using ronn
+
+set -eu
+set -o pipefail
+
+if ! command -v ronn > /dev/null; then
+ echo "ERROR: no ronn found!" >&2
+ echo "Please follow installation instructions here:" >&2
+ echo "https://github.com/apjanke/ronn-ng" >&2
+ exit 1
+fi
+
+set -x
+ronn ./README.md
diff --git a/projects/amdsmi/rocm_smi/python_smi_tools/rocm_smi.py b/projects/amdsmi/rocm_smi/python_smi_tools/rocm_smi.py
index 6af7ac098b..6c1de2d7a7 100755
--- a/projects/amdsmi/rocm_smi/python_smi_tools/rocm_smi.py
+++ b/projects/amdsmi/rocm_smi/python_smi_tools/rocm_smi.py
@@ -966,6 +966,9 @@ def resetComputePartition(deviceList):
printLog(device, 'Permission denied', None)
elif ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED:
printLog(device, 'Not supported on the given system', None)
+ elif ret == rsmi_status_t.RSMI_STATUS_BUSY:
+ printLog(device, 'Device is currently busy, try again later',
+ None)
else:
rsmi_ret_ok(ret, device, 'reset_compute_partition')
printErrLog(device, 'Failed to reset the compute partition to boot state')
@@ -1002,6 +1005,9 @@ def resetMemoryPartition(deviceList):
printLog(device, 'Permission denied', None, addExtraLine)
elif ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED:
printLog(device, 'Not supported on the given system', None, addExtraLine)
+ elif ret == rsmi_status_t.RSMI_STATUS_BUSY:
+ printLog(device, 'Device is currently busy, try again later',
+ None)
else:
rsmi_ret_ok(ret, device, 'reset_memory_partition')
printErrLog(device, 'Failed to reset memory partition to boot state')
@@ -1603,6 +1609,9 @@ def setComputePartition(deviceList, computePartitionType):
%computePartitionType, None)
elif ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED:
printLog(device, 'Not supported on the given system', None)
+ elif ret == rsmi_status_t.RSMI_STATUS_BUSY:
+ printLog(device, 'Device is currently busy, try again later',
+ None)
else:
rsmi_ret_ok(ret, device, 'set_compute_partition')
printErrLog(device, 'Failed to retrieve compute partition, even though device supports it.')
@@ -1673,6 +1682,9 @@ def setMemoryPartition(deviceList, memoryPartition):
printLog(device, 'Permission denied', None, addExtraLine)
elif ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED:
printLog(device, 'Not supported on the given system', None, addExtraLine)
+ elif ret == rsmi_status_t.RSMI_STATUS_BUSY:
+ printLog(device, 'Device is currently busy, try again later',
+ None, addExtraLine)
else:
rsmi_ret_ok(ret, device, 'set_memory_partition')
printErrLog(device, 'Failed to retrieve memory partition, even though device supports it.')
diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi.cc b/projects/amdsmi/rocm_smi/src/rocm_smi.cc
index 6fe0c41d26..92836a9d4c 100755
--- a/projects/amdsmi/rocm_smi/src/rocm_smi.cc
+++ b/projects/amdsmi/rocm_smi/src/rocm_smi.cc
@@ -1062,6 +1062,9 @@ rsmi_status_t
rsmi_perf_determinism_mode_set(uint32_t dv_ind, uint64_t clkvalue) {
TRY
DEVICE_MUTEX
+ std::ostringstream ss;
+ ss << __PRETTY_FUNCTION__ << " | ======= start =======";
+ LOG_TRACE(ss);
// Set perf. level to performance determinism so that we can then set the power profile
rsmi_status_t ret = rsmi_dev_perf_level_set_v1(dv_ind,
@@ -1676,6 +1679,9 @@ rsmi_status_t rsmi_dev_od_volt_info_set(uint32_t dv_ind, uint32_t vpoint,
static void get_vc_region(uint32_t start_ind,
std::vector *val_vec, rsmi_freq_volt_region_t *p) {
+ std::ostringstream ss;
+ ss << __PRETTY_FUNCTION__ << " | ======= start =======";
+ LOG_TRACE(ss);
assert(p != nullptr);
assert(val_vec != nullptr);
THROW_IF_NULLPTR_DEREF(p)
@@ -1686,6 +1692,9 @@ static void get_vc_region(uint32_t start_ind,
assert((*val_vec)[kOD_OD_RANGE_label_array_index] == "OD_RANGE:");
if ((val_vec->size() < kOD_OD_RANGE_label_array_index + 2) ||
((*val_vec)[kOD_OD_RANGE_label_array_index] != "OD_RANGE:") ) {
+ ss << __PRETTY_FUNCTION__ << " | ======= end ======= | returning "
+ << getRSMIStatusString(RSMI_STATUS_UNEXPECTED_DATA);
+ LOG_TRACE(ss);
throw amd::smi::rsmi_exception(RSMI_STATUS_UNEXPECTED_DATA, __FUNCTION__);
}
od_value_pair_str_to_range((*val_vec)[start_ind], &p->freq_range);
@@ -1705,6 +1714,7 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
TRY
std::vector val_vec;
rsmi_status_t ret;
+ std::ostringstream ss;
assert(num_regions != nullptr);
assert(p != nullptr);
@@ -1713,12 +1723,20 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
ret = GetDevValueVec(amd::smi::kDevPowerODVoltage, dv_ind, &val_vec);
if (ret != RSMI_STATUS_SUCCESS) {
+ ss << __PRETTY_FUNCTION__
+ << " | Issue: could not retreive kDevPowerODVoltage" << "; returning "
+ << getRSMIStatusString(ret);
+ LOG_ERROR(ss);
return ret;
}
// This is a work-around to handle systems where kDevPowerODVoltage is not
// fully supported yet.
if (val_vec.size() < 2) {
+ ss << __PRETTY_FUNCTION__
+ << " | Issue: val_vec.size() < 2" << "; returning "
+ << getRSMIStatusString(RSMI_STATUS_NOT_YET_IMPLEMENTED);
+ LOG_ERROR(ss);
return RSMI_STATUS_NOT_YET_IMPLEMENTED;
}
@@ -1726,8 +1744,17 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
assert((val_vec_size - kOD_VDDC_CURVE_start_index) > 0);
assert((val_vec_size - kOD_VDDC_CURVE_start_index)%2 == 0);
+ ss << __PRETTY_FUNCTION__
+ << " | val_vec_size = " << std::dec
+ << val_vec_size
+ << " | kOD_VDDC_CURVE_start_index = " << kOD_VDDC_CURVE_start_index;
+ LOG_DEBUG(ss);
if (((val_vec_size - kOD_VDDC_CURVE_start_index) <= 0) ||
(((val_vec_size - kOD_VDDC_CURVE_start_index)%2 != 0))) {
+ ss << __PRETTY_FUNCTION__ << " | Issue: od vdd curve returned unexpected "
+ << "data" << "; returning "
+ << getRSMIStatusString(RSMI_STATUS_UNEXPECTED_SIZE);
+ LOG_ERROR(ss);
throw amd::smi::rsmi_exception(RSMI_STATUS_UNEXPECTED_SIZE, __FUNCTION__);
}
@@ -2980,6 +3007,9 @@ rsmi_dev_od_volt_info_get(uint32_t dv_ind, rsmi_od_volt_freq_data_t *odv) {
ss << __PRETTY_FUNCTION__ << "| ======= start =======";
LOG_TRACE(ss);
DEVICE_MUTEX
+ if (odv == nullptr) {
+ return RSMI_STATUS_INVALID_ARGS;
+ }
CHK_SUPPORT_NAME_ONLY(odv)
rsmi_status_t ret = get_od_clk_volt_info(dv_ind, odv);
@@ -3010,7 +3040,7 @@ rsmi_status_t rsmi_dev_od_volt_curve_regions_get(uint32_t dv_ind,
uint32_t *num_regions, rsmi_freq_volt_region_t *buffer) {
TRY
std::ostringstream ss;
- ss << __PRETTY_FUNCTION__ << "| ======= start =======";
+ ss << __PRETTY_FUNCTION__ << " | ======= start =======";
LOG_TRACE(ss);
CHK_SUPPORT_NAME_ONLY((num_regions == nullptr || buffer == nullptr) ?
@@ -3022,6 +3052,12 @@ rsmi_status_t rsmi_dev_od_volt_curve_regions_get(uint32_t dv_ind,
DEVICE_MUTEX
rsmi_status_t ret = get_od_clk_volt_curve_regions(dv_ind, num_regions,
buffer);
+ if (*num_regions == 0) {
+ ret = RSMI_STATUS_NOT_SUPPORTED;
+ }
+ ss << __PRETTY_FUNCTION__ << " | ======= end ======= | returning "
+ << getRSMIStatusString(ret);
+ LOG_TRACE(ss);
return ret;
CATCH
}
@@ -3969,7 +4005,6 @@ rsmi_status_t rsmi_dev_serial_number_get(uint32_t dv_ind,
if (ret != RSMI_STATUS_SUCCESS) {
return ret;
}
-
uint32_t ln = static_cast(val_str.copy(serial_num, len));
serial_num[std::min(len - 1, ln)] = '\0';
@@ -4614,6 +4649,30 @@ rsmi_topo_get_link_type(uint32_t dv_ind_src, uint32_t dv_ind_dst,
rsmi_status_t status;
uint32_t node_ind_dst;
+
+ // handle the link type for CPU
+ if (dv_ind_dst == CPU_NODE_INDEX) {
+ // No CPU connected
+ if (kfd_node->numa_node_weight() == 0) {
+ return RSMI_STATUS_NOT_SUPPORTED;
+ }
+ amd::smi::IO_LINK_TYPE io_link_type =
+ kfd_node->numa_node_type();
+ switch (io_link_type) {
+ case amd::smi::IOLINK_TYPE_XGMI:
+ *type = RSMI_IOLINK_TYPE_XGMI;
+ *hops = 1;
+ return RSMI_STATUS_SUCCESS;
+ case amd::smi::IOLINK_TYPE_PCIEXPRESS:
+ *type = RSMI_IOLINK_TYPE_PCIEXPRESS;
+ // always be the same CPU node
+ *hops = 2;
+ return RSMI_STATUS_SUCCESS;
+ default:
+ return RSMI_STATUS_NOT_SUPPORTED;
+ }
+ }
+
int ret = smi.get_node_index(dv_ind_dst, &node_ind_dst);
if (ret == 0) {
@@ -4731,7 +4790,7 @@ get_compute_partition(uint32_t dv_ind, std::string &compute_partition) {
return ret;
}
- switch (mapStringToRSMIComputePartitionTypes[compute_partition_str]) {
+ switch (mapStringToRSMIComputePartitionTypes.at(compute_partition_str)) {
case RSMI_COMPUTE_PARTITION_CPX:
case RSMI_COMPUTE_PARTITION_SPX:
case RSMI_COMPUTE_PARTITION_DPX:
@@ -4848,9 +4907,12 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
ss << __PRETTY_FUNCTION__ << "| ======= start =======";
LOG_TRACE(ss);
REQUIRE_ROOT_ACCESS
+ if (!amd::smi::is_sudo_user()) {
+ return RSMI_STATUS_PERMISSION;
+ }
DEVICE_MUTEX
std::string newComputePartitionStr
- = mapRSMIToStringComputePartitionTypes[compute_partition];
+ = mapRSMIToStringComputePartitionTypes.at(compute_partition);
std::string currentComputePartition;
switch (compute_partition) {
@@ -4868,6 +4930,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
<< " | Device #: " << dv_ind
<< " | Type: "
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
+ << " | Data: " << newComputePartitionStr
<< " | Cause: requested setting was invalid"
<< " | Returning = "
<< getRSMIStatusString(RSMI_STATUS_INVALID_ARGS) << " |";
@@ -4886,6 +4949,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
<< " | Device #: " << dv_ind
<< " | Type: "
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
+ << " | Data: " << newComputePartitionStr
<< " | Cause: not an available compute partition setting"
<< " | Returning = "
<< getRSMIStatusString(available_ret) << " |";
@@ -4913,7 +4977,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
return ret_get;
}
rsmi_compute_partition_type_t currRSMIComputePartition
- = mapStringToRSMIComputePartitionTypes[currentComputePartition];
+ = mapStringToRSMIComputePartitionTypes.at(currentComputePartition);
if (currRSMIComputePartition == compute_partition) {
ss << __PRETTY_FUNCTION__
<< " | ======= end ======= "
@@ -4928,6 +4992,15 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
return RSMI_STATUS_SUCCESS;
}
+ ss << __PRETTY_FUNCTION__ << " | about to try writing |"
+ << newComputePartitionStr
+ << "| size of string = " << newComputePartitionStr.size()
+ << "| size of c-string = "<< std::dec
+ << sizeof(newComputePartitionStr.c_str())/sizeof(newComputePartitionStr[0])
+ << "| sizeof string = " << std::dec
+ << sizeof(newComputePartitionStr);
+ LOG_DEBUG(ss);
+
GET_DEV_FROM_INDX
int ret = dev->writeDevInfo(amd::smi::kDevComputePartition,
newComputePartitionStr);
@@ -4962,7 +5035,7 @@ static rsmi_status_t get_memory_partition(uint32_t dv_ind,
return ret;
}
- switch (mapStringToMemoryPartitionTypes[val_str]) {
+ switch (mapStringToMemoryPartitionTypes.at(val_str)) {
case RSMI_MEMORY_PARTITION_NPS1:
case RSMI_MEMORY_PARTITION_NPS2:
case RSMI_MEMORY_PARTITION_NPS4:
@@ -5018,7 +5091,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
}
std::string newMemoryPartition
- = mapRSMIToStringMemoryPartitionTypes[memory_partition];
+ = mapRSMIToStringMemoryPartitionTypes.at(memory_partition);
std::string currentMemoryPartition;
switch (memory_partition) {
@@ -5061,7 +5134,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
return ret_get;
}
rsmi_memory_partition_type_t currRSMIMemoryPartition
- = mapStringToMemoryPartitionTypes[currentMemoryPartition];
+ = mapStringToMemoryPartitionTypes.at(currentMemoryPartition);
if (currRSMIMemoryPartition == memory_partition) {
ss << __PRETTY_FUNCTION__
<< " | ======= end ======= "
@@ -5205,7 +5278,7 @@ rsmi_status_t rsmi_dev_compute_partition_reset(uint32_t dv_ind) {
// Likely due to device not supporting it
if (bootState != "UNKNOWN") {
rsmi_compute_partition_type_t compute_partition =
- mapStringToRSMIComputePartitionTypes[bootState];
+ mapStringToRSMIComputePartitionTypes.at(bootState);
ret = rsmi_dev_compute_partition_set(dv_ind, compute_partition);
}
ss << __PRETTY_FUNCTION__
@@ -5244,7 +5317,7 @@ rsmi_status_t rsmi_dev_memory_partition_reset(uint32_t dv_ind) {
// Likely due to device not supporting it
if (bootState != "UNKNOWN") {
rsmi_memory_partition_type_t memory_partition =
- mapStringToMemoryPartitionTypes[bootState];
+ mapStringToMemoryPartitionTypes.at(bootState);
ret = rsmi_dev_memory_partition_set(dv_ind, memory_partition);
}
ss << __PRETTY_FUNCTION__
diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi_device.cc b/projects/amdsmi/rocm_smi/src/rocm_smi_device.cc
index 61fd9a3885..dc0506a2ab 100755
--- a/projects/amdsmi/rocm_smi/src/rocm_smi_device.cc
+++ b/projects/amdsmi/rocm_smi/src/rocm_smi_device.cc
@@ -628,14 +628,17 @@ int Device::openSysfsFileStream(DevInfoTypes type, T *fs, const char *str) {
int ret = isRegularFile(sysfs_path, ®_file);
if (ret != 0) {
- ss << "File did not exist - SYSFS file (" << sysfs_path
+ ss << __PRETTY_FUNCTION__ << " | Issue: File did not exist - SYSFS file ("
+ << sysfs_path
<< ") for DevInfoInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
<< "), returning " << std::to_string(ret);
LOG_ERROR(ss);
return ret;
}
if (!reg_file) {
- ss << "File is not a regular file - SYSFS file (" << sysfs_path << ") for "
+ ss << __PRETTY_FUNCTION__
+ << " | Issue: File is not a regular file - SYSFS file ("
+ << sysfs_path << ") for "
<< "DevInfoInfoType (" << RocmSMI::devInfoTypesStrings.at(type) << "),"
<< " returning ENOENT (" << std::strerror(ENOENT) << ")";
LOG_ERROR(ss);
@@ -644,8 +647,9 @@ int Device::openSysfsFileStream(DevInfoTypes type, T *fs, const char *str) {
fs->open(sysfs_path);
- if (!fs) {
- ss << "Could not open - SYSFS file (" << sysfs_path << ") for "
+ if (!fs->is_open()) {
+ ss << __PRETTY_FUNCTION__
+ << " | Issue: Could not open - SYSFS file (" << sysfs_path << ") for "
<< "DevInfoInfoType (" << RocmSMI::devInfoTypesStrings.at(type) << "), "
<< ", returning " << std::to_string(errno) << " ("
<< std::strerror(errno) << ")";
@@ -653,7 +657,8 @@ int Device::openSysfsFileStream(DevInfoTypes type, T *fs, const char *str) {
return errno;
}
- ss << "Successfully opened SYSFS file (" << sysfs_path
+ ss << __PRETTY_FUNCTION__ << " | Successfully opened SYSFS file ("
+ << sysfs_path
<< ") for DevInfoInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
<< ")";
LOG_INFO(ss);
@@ -701,32 +706,51 @@ int Device::readDevInfoStr(DevInfoTypes type, std::string *retStr) {
ret = openSysfsFileStream(type, &fs);
if (ret != 0) {
ss << "Could not read device info string for DevInfoType ("
- << RocmSMI::devInfoTypesStrings.at(type)<< "), returning "
+ << RocmSMI::devInfoTypesStrings.at(type) << "), returning "
<< std::to_string(ret);
LOG_ERROR(ss);
return ret;
}
fs >> *retStr;
- std::string info = "Successfully read device info string for DevInfoType (" +
- RocmSMI::devInfoTypesStrings.at(type) + "): " +
- *retStr;
- LOG_INFO(info);
fs.close();
-
+ ss << __PRETTY_FUNCTION__
+ << "Successfully read device info string for DevInfoType (" +
+ RocmSMI::devInfoTypesStrings.at(type) + "): " + *retStr
+ << " | "
+ << (fs.is_open() ? " File stream is opened" : " File stream is closed")
+ << " | " << (fs.bad() ? "[ERROR] Bad read operation" :
+ "[GOOD] No bad bit read, successful read operation")
+ << " | " << (fs.fail() ? "[ERROR] Failed read - format error" :
+ "[GOOD] No fail - Successful read operation")
+ << " | " << (fs.eof() ? "[ERROR] Failed read - EOF error" :
+ "[GOOD] No eof error - Successful read operation")
+ << " | " << (fs.good() ? "[GOOD] read good - Successful read operation" :
+ "[ERROR] Failed read - good error");
+ LOG_INFO(ss);
return 0;
}
-int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
- auto tempPath = path_;
+int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr,
+ bool returnWriteErr) {
+ // returnWriteErr = false, backwards compatability (old calls)
+ // returnWriteErr = true, improvement - allows us to detect errors
+ // when writing to file
+ // (such as EBUSY)
+ auto sysfs_path = path_;
+ sysfs_path += "/device/";
+ sysfs_path += kDevAttribNameMap.at(type);
std::ofstream fs;
int ret;
std::ostringstream ss;
- fs.rdbuf()->pubsetbuf(nullptr,0);
+ fs.flush();
+ fs.rdbuf()->pubsetbuf(0, 0);
ret = openSysfsFileStream(type, &fs, valStr.c_str());
if (ret != 0) {
- ss << "Could not write device info string (" << valStr
+ fs.close();
+ ss << __PRETTY_FUNCTION__ << " | Issue: Could not open fileStream; "
+ << "Could not write device info string (" << valStr
<< ") for DevInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
<< "), returning " << std::to_string(ret);
LOG_ERROR(ss);
@@ -735,19 +759,39 @@ int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
// We'll catch any exceptions in rocm_smi.cc code.
if (fs << valStr) {
+ fs.flush();
+ fs.close();
ss << "Successfully wrote device info string (" << valStr
<< ") for DevInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
<< "), returning RSMI_STATUS_SUCCESS";
LOG_INFO(ss);
ret = RSMI_STATUS_SUCCESS;
} else {
- ss << "Could not write device info string (" << valStr
+ if (returnWriteErr) {
+ ret = errno;
+ } else {
+ ret = RSMI_STATUS_NOT_SUPPORTED;
+ }
+ fs.flush();
+ fs.close();
+ ss << __PRETTY_FUNCTION__ << " | Issue: Could not write to file; "
+ << "Could not write device info string (" << valStr
<< ") for DevInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
- << "), returning RSMI_STATUS_NOT_SUPPORTED";
+ << "), returning " << getRSMIStatusString(ErrnoToRsmiStatus(ret));
+ ss << " | "
+ << (fs.is_open() ? "[ERROR] File stream open" :
+ "[GOOD] File stream closed")
+ << " | " << (fs.bad() ? "[ERROR] Bad write operation" :
+ "[GOOD] No bad bit write, successful write operation")
+ << " | " << (fs.fail() ? "[ERROR] Failed write - format error" :
+ "[GOOD] No fail - Successful write operation")
+ << " | " << (fs.eof() ? "[ERROR] Failed write - EOF error" :
+ "[GOOD] No eof error - Successful write operation")
+ << " | " << (fs.good() ?
+ "[GOOD] Write good - Successful write operation" :
+ "[ERROR] Failed write - good error");
LOG_ERROR(ss);
- ret = RSMI_STATUS_NOT_SUPPORTED;
}
- fs.close();
return ret;
}
@@ -786,6 +830,9 @@ int Device::writeDevInfo(DevInfoTypes type, uint64_t val) {
}
int Device::writeDevInfo(DevInfoTypes type, std::string val) {
+ auto sysfs_path = path_;
+ sysfs_path += "/device/";
+ sysfs_path += kDevAttribNameMap.at(type);
switch (type) {
case kDevGPUMClk:
case kDevDCEFClk:
@@ -794,9 +841,10 @@ int Device::writeDevInfo(DevInfoTypes type, std::string val) {
case kDevPCIEClk:
case kDevPowerODVoltage:
case kDevSOCClk:
+ return writeDevInfoStr(type, val);
case kDevComputePartition:
case kDevMemoryPartition:
- return writeDevInfoStr(type, val);
+ return writeDevInfoStr(type, val, true);
default:
return EINVAL;
@@ -929,6 +977,7 @@ int Device::readDevInfo(DevInfoTypes type, uint64_t *val) {
std::string tempStr;
int ret;
int tmp_val;
+ std::ostringstream ss;
switch (type) {
case kDevDevID:
diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi_gpu_metrics.cc b/projects/amdsmi/rocm_smi/src/rocm_smi_gpu_metrics.cc
index e8aa54eef9..23a498876d 100755
--- a/projects/amdsmi/rocm_smi/src/rocm_smi_gpu_metrics.cc
+++ b/projects/amdsmi/rocm_smi/src/rocm_smi_gpu_metrics.cc
@@ -496,6 +496,17 @@ rsmi_dev_gpu_metrics_info_get(uint32_t dv_ind, rsmi_gpu_metrics_t *smu) {
// a specific version.
*smu = {};
+ bool isRevisionExpected = ((dev->gpu_metrics_ver().content_revision == 1) ||
+ (dev->gpu_metrics_ver().content_revision == 2) ||
+ (dev->gpu_metrics_ver().content_revision == 3));
+ if (isRevisionExpected == false) {
+ ss << __PRETTY_FUNCTION__ << " | content revision was = "
+ << print_unsigned_hex_and_int(dev->gpu_metrics_ver().content_revision)
+ << ", expected version 1,2, or 3 | returning "
+ << getRSMIStatusString(RSMI_STATUS_NOT_SUPPORTED);
+ LOG_ERROR(ss);
+ return RSMI_STATUS_NOT_SUPPORTED;
+ }
if (dev->gpu_metrics_ver().content_revision ==
RSMI_GPU_METRICS_API_CONTENT_VER_1) {
ret = GetDevBinaryBlob(amd::smi::kDevGpuMetrics, dv_ind,
diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi_kfd.cc b/projects/amdsmi/rocm_smi/src/rocm_smi_kfd.cc
index 68fccb9a49..2c74b289e8 100755
--- a/projects/amdsmi/rocm_smi/src/rocm_smi_kfd.cc
+++ b/projects/amdsmi/rocm_smi/src/rocm_smi_kfd.cc
@@ -926,10 +926,15 @@ int KFDNode::get_cache_info(rsmi_gpu_cache_info_t *info) {
int cache_level = std::stoi(level);
if (cache_level < 0 ) continue;
+ std::string type = get_properties_from_file(prop_file, "type ");
+ int cache_type = std::stoi(type);
+ if (cache_type <= 0) continue;
+
// only count once
bool is_count_already = false;
for (unsigned int i=0; i < info->num_cache_types; i++) {
- if (info->cache->cache_level == static_cast(cache_level)) {
+ if (info->cache[i].cache_level == static_cast(cache_level) &&
+ info->cache[i].flags == static_cast(cache_type)) {
is_count_already = true;
break;
}
@@ -940,8 +945,10 @@ int KFDNode::get_cache_info(rsmi_gpu_cache_info_t *info) {
std::string size = get_properties_from_file(prop_file, "size ");
int cache_size = std::stoi(size);
if (cache_size <= 0) continue;
+
info->cache[info->num_cache_types].cache_level = cache_level;
info->cache[info->num_cache_types].cache_size_kb = cache_size;
+ info->cache[info->num_cache_types].flags = cache_type;
info->num_cache_types++;
} catch (...) {
continue;
@@ -1035,5 +1042,26 @@ int get_gpu_id(uint32_t node, uint64_t *gpu_id) {
return retVal;
}
+// /sys/class/kfd/kfd/topology/nodes/*/properties | grep gfx_target_version
+int KFDNode::get_gfx_target_version(uint64_t *gfx_target_version) {
+ std::ostringstream ss;
+ std::string properties_path = "/sys/class/kfd/kfd/topology/nodes/"
+ + std::to_string(this->node_indx_) + "/properties";
+ uint64_t gfx_version = 0;
+ int ret = read_node_properties(this->node_indx_, "gfx_target_version",
+ &gfx_version);
+ *gfx_target_version = gfx_version;
+ ss << __PRETTY_FUNCTION__
+ << " | File: " << properties_path
+ << " | Successfully read node #" << std::to_string(this->node_indx_)
+ << " for gfx_target_version"
+ << " | Data (gfx_target_version) *gfx_target_version = "
+ << std::to_string(*gfx_target_version)
+ << " | return = " << std::to_string(ret)
+ << " | ";
+ LOG_DEBUG(ss);
+ return ret;
+}
+
} // namespace smi
} // namespace amd
diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi_main.cc b/projects/amdsmi/rocm_smi/src/rocm_smi_main.cc
index 22200ea273..c29916bedc 100755
--- a/projects/amdsmi/rocm_smi/src/rocm_smi_main.cc
+++ b/projects/amdsmi/rocm_smi/src/rocm_smi_main.cc
@@ -450,6 +450,12 @@ RocmSMI::Initialize(uint64_t flags) {
// store each device boot partition state, if file doesn't exist
dev->storeDevicePartitions(dv_ind);
}
+
+ // Assists displaying GPU information after device enumeration
+ // Otherwise GPU related info will not be discoverable
+ if (ROCmLogging::Logger::getInstance()->isLoggerEnabled()) {
+ logSystemDetails();
+ }
// Leaving below to help debug temp file issues
// displayAppTmpFilesContent();
std::string amdGPUDeviceList = displayAllDevicePaths(devices_);
diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc b/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc
index fd20783e89..dfba3e687d 100755
--- a/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc
+++ b/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc
@@ -618,9 +618,19 @@ std::tuple readTmpFile(uint32_t dv_ind,
}
// wrapper to return string expression of a rsmi_status_t return
-std::string getRSMIStatusString(rsmi_status_t ret) {
+// rsmi_status_t ret - return value of RSMI API function
+// bool fullStatus - defaults to true, set to false to chop off description
+// Returns:
+// string - if fullStatus == true, returns full decription of return value
+// ex. 'RSMI_STATUS_SUCCESS: The function has been executed successfully.'
+// string - if fullStatus == false, returns a minimalized return value
+// ex. 'RSMI_STATUS_SUCCESS'
+std::string getRSMIStatusString(rsmi_status_t ret, bool fullStatus) {
const char *err_str;
rsmi_status_string(ret, &err_str);
+ if (!fullStatus) {
+ return splitString(std::string(err_str), ':');
+ }
return std::string(err_str);
}
@@ -639,9 +649,13 @@ std::string getRSMIStatusString(rsmi_status_t ret) {
// Expressed as big endian or little endian.
// Big Endian (BE), multi-bit symbols encoded as big endian (MSB first)
// Little Endian (LE), multi-bit symbols encoded as little endian (LSB first)
+// string rocm_lib_path = Path to library
+// string rocm_build_type = Release or debug
+// string rocm_build_date = Creation date of library
+// string dev_gfx_versions = GPU target graphics version
std::tuple
+ std::string, std::string, std::string, std::string, std::string>
getSystemDetails(void) {
struct utsname buf;
bool errorDetected = false;
@@ -656,7 +670,9 @@ std::tuple devGraphicsVersions = getAllDeviceGfxVers();
+ if (devGraphicsVersions.empty() == false) {
+ dev_gfx_versions = "";
+ while (devGraphicsVersions.empty() == false) {
+ dev_gfx_versions += "\n\t" + devGraphicsVersions.front();
+ devGraphicsVersions.pop();
+ }
+ }
return std::make_tuple(errorDetected, sysname, nodename, release,
version, machine, domainName, os_distribution,
endianness, rocm_build_type, rocm_lib_path,
- rocm_env_variables);
+ rocm_build_date, rocm_env_variables, dev_gfx_versions);
}
// If logging is enabled through RSMI_LOGGING environment variable.
@@ -706,10 +731,11 @@ void logSystemDetails(void) {
std::ostringstream ss;
bool errorDetected;
std::string sysname, node, release, version, machine, domain, distName,
- endianness, rocm_build_type, lib_path, rocm_env_vars;
+ endianness, rocm_build_type, lib_path, build_date, rocm_env_vars,
+ dev_gfx_versions;
std::tie(errorDetected, sysname, node, release, version, machine, domain,
- distName, endianness, rocm_build_type, lib_path,
- rocm_env_vars) = getSystemDetails();
+ distName, endianness, rocm_build_type, lib_path, build_date,
+ rocm_env_vars, dev_gfx_versions) = getSystemDetails();
if (errorDetected == false) {
ss << "====== Gathered system details ============\n"
<< "SYSTEM NAME: " << sysname << "\n"
@@ -722,7 +748,9 @@ void logSystemDetails(void) {
<< "ENDIANNESS: " << endianness << "\n"
<< "ROCM BUILD TYPE: " << rocm_build_type << "\n"
<< "ROCM-SMI-LIB PATH: " << lib_path << "\n"
- << "ROCM ENV VARIABLES: " << rocm_env_vars << "\n";
+ << "ROCM-SMI-LIB BUILD DATE: " << build_date << "\n"
+ << "ROCM ENV VARIABLES: " << rocm_env_vars
+ << "AMD GFX VERSIONS: " << dev_gfx_versions << "\n";
LOG_INFO(ss);
} else {
ss << "====== Gathered system details ============\n"
@@ -873,6 +901,13 @@ std::string getMyLibPath(void) {
return path;
}
+std::string getFileCreationDate(std::string path) {
+ struct stat t_stat;
+ stat(path.c_str(), &t_stat);
+ struct tm *timeinfo = localtime(&t_stat.st_ctime); // NOLINT
+ return removeNewLines(std::string(asctime(timeinfo))); // NOLINT
+}
+
rsmi_status_t getBDFString(uint64_t bdf_id, std::string& bfd_str)
{
auto result = rsmi_status_t::RSMI_STATUS_SUCCESS;
@@ -1016,5 +1051,164 @@ std::string power_type_string(RSMI_POWER_TYPE type) {
return powerTypesToString.at(type);
}
+std::string splitString(std::string str, char delim) {
+ std::vector tokens;
+ std::stringstream ss(str);
+ std::string token;
+
+ if (str.empty()) {
+ return "";
+ }
+
+ while (std::getline(ss, token, delim)) {
+ tokens.push_back(token);
+ return token; // return 1st match
+ }
+}
+
+static std::string pt_rng_Mhz(std::string title, rsmi_range *r) {
+ std::ostringstream ss;
+ if (r == nullptr) {
+ ss << "pt_rng_Mhz | rsmi_range r = nullptr\n";
+ return ss.str();
+ }
+
+ ss << title;
+ ss << r->lower_bound/1000000 << " to "
+ << r->upper_bound/1000000 << " MHz" << "\n";
+ return ss.str();
+}
+
+static std::string pt_rng_mV(std::string title, rsmi_range *r) {
+ std::ostringstream ss;
+ if (r == nullptr) {
+ ss << "pt_rng_mV | rsmi_range r = nullptr\n";
+ return ss.str();
+ }
+
+ ss << title;
+ ss << r->lower_bound << " to " << r->upper_bound
+ << " mV" << "\n";
+ return ss.str();
+}
+
+static std::string print_pnt(rsmi_od_vddc_point_t *pt) {
+ std::ostringstream ss;
+ ss << "\t\t** Frequency: " << pt->frequency/1000000 << " MHz\n";
+ ss << "\t\t** Voltage: " << pt->voltage << " mV\n";
+ return ss.str();
+}
+static std::string pt_vddc_curve(rsmi_od_volt_curve *c) {
+ std::ostringstream ss;
+ if (c == nullptr) {
+ ss << "pt_vddc_curve | rsmi_od_volt_curve c = nullptr\n";
+ return ss.str();
+ }
+
+ for (uint32_t i = 0; i < RSMI_NUM_VOLTAGE_CURVE_POINTS; ++i) {
+ ss << print_pnt(&c->vc_points[i]);
+ }
+ return ss.str();
+}
+
+std::string print_rsmi_od_volt_freq_data_t(rsmi_od_volt_freq_data_t *odv) {
+ std::ostringstream ss;
+ if (odv == nullptr) {
+ ss << "rsmi_od_volt_freq_data_t odv = nullptr\n";
+ return ss.str();
+ }
+
+ ss << pt_rng_Mhz("\t**Current SCLK frequency range: ", &odv->curr_sclk_range);
+ ss << pt_rng_Mhz("\t**Current MCLK frequency range: ", &odv->curr_mclk_range);
+ ss << pt_rng_Mhz("\t**Min/Max Possible SCLK frequency range: ",
+ &odv->sclk_freq_limits);
+ ss << pt_rng_Mhz("\t**Min/Max Possible MCLK frequency range: ",
+ &odv->mclk_freq_limits);
+
+ ss << "\t**Current Freq/Volt. curve: " << "\n";
+ ss << pt_vddc_curve(&odv->curve);
+
+ ss << "\t**Number of Freq./Volt. regions: " << odv->num_regions << "\n\n";
+ return ss.str();
+}
+
+std::string print_odv_region(rsmi_freq_volt_region_t *region) {
+ std::ostringstream ss;
+ ss << pt_rng_Mhz("\t\tFrequency range: ", ®ion->freq_range);
+ ss << pt_rng_mV("\t\tVoltage range: ", ®ion->volt_range);
+ return ss.str();
+}
+
+std::string print_rsmi_od_volt_freq_regions(uint32_t num_regions,
+ rsmi_freq_volt_region_t *regions) {
+ std::ostringstream ss;
+ if (regions == nullptr) {
+ ss << "rsmi_freq_volt_region_t regions = nullptr\n";
+ return ss.str();
+ }
+ for (uint32_t i = 0; i < num_regions; ++i) {
+ ss << "\tRegion " << i << ": " << "\n";
+ ss << print_odv_region(®ions[i]);
+ }
+ return ss.str();
+}
+
+bool is_sudo_user() {
+ std::ostringstream ss;
+ bool isRunningWithSudo = false;
+ auto myUID = getuid();
+ auto myPrivledges = geteuid();
+ if ((myUID == myPrivledges) && (myPrivledges == 0)) {
+ isRunningWithSudo = true;
+ }
+ ss << __PRETTY_FUNCTION__ << (isRunningWithSudo ? " | running as sudoer" :
+ " | NOT running as sudoer");
+ LOG_DEBUG(ss);
+ return isRunningWithSudo;
+}
+
+rsmi_status_t rsmi_get_gfx_target_version(uint32_t dv_ind,
+ std::string *gfx_version) {
+ std::ostringstream ss;
+ uint64_t kfd_gfx_version = 0;
+ GET_DEV_AND_KFDNODE_FROM_INDX
+
+ int ret = kfd_node->get_gfx_target_version(&kfd_gfx_version);
+ if (ret == 0) {
+ ss << "gfx" << kfd_gfx_version;
+ *gfx_version = ss.str();
+ return RSMI_STATUS_SUCCESS;
+ } else {
+ *gfx_version = "Unknown";
+ return RSMI_STATUS_NOT_SUPPORTED;
+ }
+}
+
+std::queue getAllDeviceGfxVers() {
+ uint32_t num_monitor_devs = 0;
+ rsmi_status_t ret;
+ std::queue deviceGfxVersions;
+ std::string response = "";
+ std::string dev_gfx_ver = "";
+
+ ret = rsmi_num_monitor_devices(&num_monitor_devs);
+ if (ret != RSMI_STATUS_SUCCESS || num_monitor_devs == 0) {
+ response = "N/A - No AMD devices detected";
+ deviceGfxVersions.push(response);
+ return deviceGfxVersions;
+ }
+
+ for (uint32_t i = 0; i < num_monitor_devs; ++i) {
+ ret = amd::smi::rsmi_get_gfx_target_version(i , &dev_gfx_ver);
+ response = "Device[" + std::to_string(i) + "]: ";
+ if (ret != RSMI_STATUS_SUCCESS) {
+ deviceGfxVersions.push(response + getRSMIStatusString(ret, false));
+ } else {
+ deviceGfxVersions.push(response + std::string(dev_gfx_ver));
+ }
+ }
+ return deviceGfxVersions;
+}
+
} // namespace smi
} // namespace amd
diff --git a/projects/amdsmi/src/CMakeLists.txt b/projects/amdsmi/src/CMakeLists.txt
index 7e5d043e75..15e3a1977b 100644
--- a/projects/amdsmi/src/CMakeLists.txt
+++ b/projects/amdsmi/src/CMakeLists.txt
@@ -3,7 +3,7 @@
#
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
-message(" CMake AMD SMI (Library) ")
+message(" CMake AMD SMI C/C++ Library ")
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
message("")
diff --git a/projects/amdsmi/src/amd_smi/amd_smi.cc b/projects/amdsmi/src/amd_smi/amd_smi.cc
index 145f4e639b..f25b3d6f92 100644
--- a/projects/amdsmi/src/amd_smi/amd_smi.cc
+++ b/projects/amdsmi/src/amd_smi/amd_smi.cc
@@ -330,6 +330,25 @@ amdsmi_status_t amdsmi_get_cpusocket_info(
return AMDSMI_STATUS_SUCCESS;
}
+
+amdsmi_status_t amdsmi_get_cpucore_info(
+ amdsmi_processor_handle core_handle,
+ uint32_t core_id) {
+ AMDSMI_CHECK_INIT();
+
+ if (core_handle == nullptr) {
+ return AMDSMI_STATUS_INVAL;
+ }
+
+ amd::smi::AMDSmiProcessor* core = nullptr;
+ amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance()
+ .handle_to_processor(core_handle, &core);
+ if (r != AMDSMI_STATUS_SUCCESS) return r;
+
+ core_id = static_cast(core)->get_core_id();
+
+ return AMDSMI_STATUS_SUCCESS;
+}
#endif
amdsmi_status_t amdsmi_get_processor_handles(amdsmi_socket_handle socket_handle,
@@ -446,7 +465,7 @@ amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_hand
AMDSMI_CHECK_INIT();
- if (board_info == NULL) {
+ if (board_info == nullptr) {
return AMDSMI_STATUS_INVAL;
}
@@ -466,15 +485,10 @@ amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_hand
status = rsmi_wrapper(rsmi_dev_name_get, processor_handle,
board_info->product_name, AMDSMI_PRODUCT_NAME_LENGTH);
- if (board_info->product_serial[0] == '\0') {
- status = rsmi_wrapper(rsmi_dev_serial_number_get, processor_handle,
+ status = rsmi_wrapper(rsmi_dev_serial_number_get, processor_handle,
board_info->product_serial, AMDSMI_NORMAL_STRING_LENGTH);
- }
}
- // Get FRU ID
- // Get manufacturer name
-
return AMDSMI_STATUS_SUCCESS;
}
@@ -496,12 +510,29 @@ amdsmi_status_t amdsmi_get_gpu_cache_info(
processor_handle, &rsmi_info);
if (status != AMDSMI_STATUS_SUCCESS)
return status;
+ // Sysfs cache type
+ #define HSA_CACHE_TYPE_DATA 0x00000001
+ #define HSA_CACHE_TYPE_INSTRUCTION 0x00000002
+ #define HSA_CACHE_TYPE_CPU 0x00000004
+ #define HSA_CACHE_TYPE_HSACU 0x00000008
info->num_cache_types = rsmi_info.num_cache_types;
for (unsigned int i =0; i < rsmi_info.num_cache_types; i++) {
info->cache[i].cache_size_kb = rsmi_info.cache[i].cache_size_kb;
info->cache[i].cache_level = rsmi_info.cache[i].cache_level;
+ // convert from sysfs type to CRAT type(HSA Cache Affinity type)
+ info->cache[i].flags = 0;
+ if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_DATA)
+ info->cache[i].flags |= CACHE_FLAGS_DATA_CACHE;
+ if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_INSTRUCTION)
+ info->cache[i].flags |= CACHE_FLAGS_INST_CACHE;
+ if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_CPU)
+ info->cache[i].flags |= CACHE_FLAGS_CPU_CACHE;
+ if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_HSACU)
+ info->cache[i].flags |= CACHE_FLAGS_SIMD_CACHE;
}
+
+
return AMDSMI_STATUS_SUCCESS;
}
@@ -537,7 +568,7 @@ amdsmi_status_t amdsmi_get_gpu_vram_usage(amdsmi_processor_handle processor_hand
AMDSMI_CHECK_INIT();
- if (vram_info == NULL) {
+ if (vram_info == nullptr) {
return AMDSMI_STATUS_INVAL;
}
@@ -1091,9 +1122,8 @@ amdsmi_get_gpu_compute_process_gpus(uint32_t pid, uint32_t *dv_indices,
amdsmi_status_t amdsmi_get_gpu_ecc_count(amdsmi_processor_handle processor_handle,
amdsmi_gpu_block_t block, amdsmi_error_count_t *ec) {
AMDSMI_CHECK_INIT();
+ // nullptr api supported
- if (ec == nullptr)
- return AMDSMI_STATUS_INVAL;
return rsmi_wrapper(rsmi_dev_ecc_count_get, processor_handle,
static_cast(block),
reinterpret_cast(ec));
@@ -1101,9 +1131,8 @@ amdsmi_status_t amdsmi_get_gpu_ecc_count(amdsmi_processor_handle processor_hand
amdsmi_status_t amdsmi_get_gpu_ecc_enabled(amdsmi_processor_handle processor_handle,
uint64_t *enabled_blocks) {
AMDSMI_CHECK_INIT();
+ // nullptr api supported
- if (enabled_blocks == nullptr)
- return AMDSMI_STATUS_INVAL;
return rsmi_wrapper(rsmi_dev_ecc_enabled_get, processor_handle,
enabled_blocks);
}
@@ -1111,9 +1140,8 @@ amdsmi_status_t amdsmi_get_gpu_ecc_status(amdsmi_processor_handle processor_han
amdsmi_gpu_block_t block,
amdsmi_ras_err_state_t *state) {
AMDSMI_CHECK_INIT();
+ // nullptr api supported
- if (state == nullptr)
- return AMDSMI_STATUS_INVAL;
return rsmi_wrapper(rsmi_dev_ecc_status_get, processor_handle,
static_cast(block),
reinterpret_cast(state));
@@ -1123,9 +1151,8 @@ amdsmi_status_t amdsmi_get_gpu_metrics_info(
amdsmi_processor_handle processor_handle,
amdsmi_gpu_metrics_t *pgpu_metrics) {
AMDSMI_CHECK_INIT();
+ // nullptr api supported
- if (pgpu_metrics == nullptr)
- return AMDSMI_STATUS_INVAL;
return rsmi_wrapper(rsmi_dev_gpu_metrics_info_get, processor_handle,
reinterpret_cast(pgpu_metrics));
}
@@ -1212,9 +1239,8 @@ amdsmi_status_t
uint32_t sensor_ind,
amdsmi_power_profile_status_t *status) {
AMDSMI_CHECK_INIT();
+ // nullptr api supported
- if (status == nullptr)
- return AMDSMI_STATUS_INVAL;
return rsmi_wrapper(rsmi_dev_power_profile_presets_get, processor_handle,
sensor_ind,
reinterpret_cast(status));
@@ -1233,15 +1259,16 @@ amdsmi_status_t
reserved,
static_cast(profile));
}
+
amdsmi_status_t amdsmi_get_gpu_perf_level(amdsmi_processor_handle processor_handle,
amdsmi_dev_perf_level_t *perf) {
AMDSMI_CHECK_INIT();
+ // nullptr api supported
- if (perf == nullptr)
- return AMDSMI_STATUS_INVAL;
return rsmi_wrapper(rsmi_dev_perf_level_get, processor_handle,
reinterpret_cast(perf));
}
+
amdsmi_status_t
amdsmi_set_gpu_perf_level(amdsmi_processor_handle processor_handle,
amdsmi_dev_perf_level_t perf_lvl) {
@@ -1265,37 +1292,44 @@ amdsmi_status_t amdsmi_get_gpu_pci_bandwidth(amdsmi_processor_handle processor_h
amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
amdsmi_clk_type_t clk_type, amdsmi_frequencies_t *f) {
AMDSMI_CHECK_INIT();
-
- if (f == nullptr)
- return AMDSMI_STATUS_INVAL;
+ // nullptr api supported
// Get from gpu_metrics
if (clk_type == CLK_TYPE_VCLK0 ||
clk_type == CLK_TYPE_VCLK1 ||
clk_type == CLK_TYPE_DCLK0 ||
clk_type == CLK_TYPE_DCLK1 ) {
+
+ // when f == nullptr -> check if metrics are supported
amdsmi_gpu_metrics_t metric_info;
+ amdsmi_gpu_metrics_t * metric_info_p = nullptr;
+
+ if (f != nullptr) {
+ metric_info_p = &metric_info;
+ }
+
+ // when metric_info_p == nullptr - this will not return AMDSMI_STATUS_SUCCESS
auto r_status = amdsmi_get_gpu_metrics_info(
- processor_handle, &metric_info);
+ processor_handle, metric_info_p);
if (r_status != AMDSMI_STATUS_SUCCESS)
return r_status;
f->num_supported = 1;
if (clk_type == CLK_TYPE_VCLK0) {
- f->current = metric_info.current_vclk0;
- f->frequency[0] = metric_info.average_vclk0_frequency;
+ f->current = metric_info_p->current_vclk0;
+ f->frequency[0] = metric_info_p->average_vclk0_frequency;
}
if (clk_type == CLK_TYPE_VCLK1) {
- f->current = metric_info.current_vclk1;
- f->frequency[0] = metric_info.average_vclk1_frequency;
+ f->current = metric_info_p->current_vclk1;
+ f->frequency[0] = metric_info_p->average_vclk1_frequency;
}
if (clk_type == CLK_TYPE_DCLK0) {
- f->current = metric_info.current_dclk0;
- f->frequency[0] = metric_info.average_dclk0_frequency;
+ f->current = metric_info_p->current_dclk0;
+ f->frequency[0] = metric_info_p->average_dclk0_frequency;
}
if (clk_type == CLK_TYPE_DCLK1) {
- f->current = metric_info.current_dclk1;
- f->frequency[0] = metric_info.average_dclk1_frequency;
+ f->current = metric_info_p->current_dclk1;
+ f->frequency[0] = metric_info_p->average_dclk1_frequency;
}
return r_status;
@@ -1310,7 +1344,7 @@ amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle,
amdsmi_clk_type_t clk_type, uint64_t freq_bitmask) {
AMDSMI_CHECK_INIT();
- // Not support the clock type read from gpu_metrics
+ // Not support the clock type write into gpu_metrics
if (clk_type == CLK_TYPE_VCLK0 ||
clk_type == CLK_TYPE_VCLK1 ||
clk_type == CLK_TYPE_DCLK0 ||
@@ -2950,51 +2984,6 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_cpusocket_handle socket_handle,
return AMDSMI_STATUS_SUCCESS;
}
-amdsmi_status_t amdsmi_get_number_of_cpu_sockets(uint32_t sockets)
-{
- amdsmi_status_t status = amd::smi::AMDSmiSystem::getInstance().get_cpu_sockets(sockets);
- if (status != AMDSMI_STATUS_SUCCESS)
- return status;
-
- return AMDSMI_STATUS_SUCCESS;
-}
-
-amdsmi_status_t amdsmi_get_number_of_cpu_cores(uint32_t cpus)
-{
- amdsmi_status_t status = amd::smi::AMDSmiSystem::getInstance().get_cpu_cores(cpus);
- if (status != AMDSMI_STATUS_SUCCESS)
- return status;
-
- return AMDSMI_STATUS_SUCCESS;
-}
-
-amdsmi_status_t amdsmi_get_cpu_threads_per_core(uint32_t threads)
-{
- amdsmi_status_t status = amd::smi::AMDSmiSystem::getInstance().get_threads_per_core(threads);
- if (status != AMDSMI_STATUS_SUCCESS)
- return status;
-
- return AMDSMI_STATUS_SUCCESS;
-}
-
-amdsmi_status_t amdsmi_get_cpu_family(uint32_t family)
-{
- amdsmi_status_t status = amd::smi::AMDSmiSystem::getInstance().get_cpu_family(family);
- if (status != AMDSMI_STATUS_SUCCESS)
- return status;
-
- return AMDSMI_STATUS_SUCCESS;
-}
-
-amdsmi_status_t amdsmi_get_cpu_model(uint32_t model)
-{
- amdsmi_status_t status = amd::smi::AMDSmiSystem::getInstance().get_cpu_model(model);
- if (status != AMDSMI_STATUS_SUCCESS)
- return status;
-
- return AMDSMI_STATUS_SUCCESS;
-}
-
amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_cpusocket_handle socket_handle,
uint32_t sock_ind, uint32_t *pcore_ind)
{
diff --git a/projects/amdsmi/src/amd_smi/amd_smi_drm.cc b/projects/amdsmi/src/amd_smi/amd_smi_drm.cc
index f3c6d8e090..3d47e2d074 100644
--- a/projects/amdsmi/src/amd_smi/amd_smi_drm.cc
+++ b/projects/amdsmi/src/amd_smi/amd_smi_drm.cc
@@ -86,7 +86,7 @@ amdsmi_status_t AMDSmiDrm::init() {
int fd = -1;
- amdsmi_status_t status = lib_loader_.load("libdrm.so");
+ amdsmi_status_t status = lib_loader_.load("libdrm.so.2");
if (status != AMDSMI_STATUS_SUCCESS) {
return status;
}
diff --git a/projects/amdsmi/src/amd_smi/amd_smi_utils.cc b/projects/amdsmi/src/amd_smi/amd_smi_utils.cc
index 8aef5c8dc1..d733d0b031 100644
--- a/projects/amdsmi/src/amd_smi/amd_smi_utils.cc
+++ b/projects/amdsmi/src/amd_smi/amd_smi_utils.cc
@@ -116,29 +116,41 @@ amdsmi_status_t smi_amdgpu_get_board_info(amd::smi::AMDSmiGPUDevice* device, amd
return AMDSMI_STATUS_NOT_SUPPORTED;
}
SMIGPUDEVICE_MUTEX(device->get_mutex())
- std::string product_name_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/product_name");
- std::string product_number_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/product_number");
- std::string serial_number_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/serial_number");
+ std::string model_number_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/product_number");
+ std::string product_serial_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/serial_number");
+ std::string fru_id_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/fru_id");
+ std::string manufacturer_name_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/manufacturer");
+ std::string product_name_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/product_name");
FILE *fp;
- fp = fopen(product_name_path.c_str(), "rb");
- if (fp) {
- fgets(info->product_name, sizeof(info->product_name), fp);
- fclose(fp);
- }
-
-
- fp = fopen(product_number_path.c_str(), "rb");
+ fp = fopen(model_number_path.c_str(), "rb");
if (fp) {
fgets(info->model_number, sizeof(info->model_number), fp);
fclose(fp);
}
-
- fp = fopen(serial_number_path.c_str(), "rb");
+ fp = fopen(product_serial_path.c_str(), "rb");
if (fp) {
- fscanf(fp, "%lx", &info->product_serial);
+ fgets(info->product_serial, sizeof(info->product_serial), fp);
+ fclose(fp);
+ }
+
+ fp = fopen(fru_id_path.c_str(), "rb");
+ if (fp) {
+ fgets(info->fru_id, sizeof(info->fru_id), fp);
+ fclose(fp);
+ }
+
+ fp = fopen(manufacturer_name_path.c_str(), "rb");
+ if (fp) {
+ fgets(info->manufacturer_name, sizeof(info->manufacturer_name), fp);
+ fclose(fp);
+ }
+
+ fp = fopen(product_name_path.c_str(), "rb");
+ if (fp) {
+ fgets(info->product_name, sizeof(info->product_name), fp);
fclose(fp);
}
diff --git a/projects/amdsmi/tests/amd_smi_test/functional/err_cnt_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/err_cnt_read.cc
index c63d561fa1..ab341b21a0 100755
--- a/projects/amdsmi/tests/amd_smi_test/functional/err_cnt_read.cc
+++ b/projects/amdsmi/tests/amd_smi_test/functional/err_cnt_read.cc
@@ -109,7 +109,7 @@ void TestErrCntRead::Run(void) {
}
// Verify api support checking functionality is working
err = amdsmi_get_gpu_ecc_enabled(processor_handles_[i], nullptr);
- ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
+ ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
continue;
} else {
@@ -150,7 +150,7 @@ void TestErrCntRead::Run(void) {
// Verify api support checking functionality is working
err = amdsmi_get_gpu_ecc_count(processor_handles_[i], static_cast(b),
nullptr);
- ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
+ ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
} else {
CHK_ERR_ASRT(err)
diff --git a/projects/amdsmi/tests/amd_smi_test/functional/fan_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/fan_read.cc
index 5829567ec7..78e257e895 100755
--- a/projects/amdsmi/tests/amd_smi_test/functional/fan_read.cc
+++ b/projects/amdsmi/tests/amd_smi_test/functional/fan_read.cc
@@ -107,6 +107,9 @@ void TestFanRead::Run(void) {
std::cout << "\t**" << ": " <<
"Not supported on this machine" << std::endl;
}
+ // Verify api support checking functionality is working
+ err = amdsmi_get_gpu_fan_speed(processor_handles_[i], 0, nullptr);
+ ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
return;
} else {
CHK_ERR_ASRT(err)
diff --git a/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read.cc
index 33d678e7da..98e310d64b 100755
--- a/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read.cc
+++ b/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read.cc
@@ -128,7 +128,7 @@ void TestFrequenciesRead::Run(void) {
": Not supported on this machine" << std::endl;
// Verify api support checking functionality is working
err = amdsmi_get_clk_freq(processor_handles_[i], t, nullptr);
- ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
+ ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
return;
}
diff --git a/projects/amdsmi/tests/amd_smi_test/functional/perf_determinism.cc b/projects/amdsmi/tests/amd_smi_test/functional/perf_determinism.cc
index f20215606e..7a410ba71d 100644
--- a/projects/amdsmi/tests/amd_smi_test/functional/perf_determinism.cc
+++ b/projects/amdsmi/tests/amd_smi_test/functional/perf_determinism.cc
@@ -5,7 +5,7 @@
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
- * Copyright (c) 022, Advanced Micro Devices, Inc.
+ * Copyright (c) 2020-2023, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Developed by:
@@ -106,20 +106,25 @@ void TestPerfDeterminism::Run(void) {
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;
+ std::cout << "\t** Not supported on this machine\n";
}
return;
- }
- else{
+ } else if (err == AMDSMI_STATUS_SUCCESS) {
clkvalue = (odv.curr_sclk_range.lower_bound/1000000) + 50;
+ } else {
+ IF_VERB(STANDARD) {
+ std::cout << "\t** Unable to retrieve lower bound sclk, continue.. \n";
+ }
+ continue;
}
+ std::cout << "About to rsmi_perf_determinism_mode_set() -->\n";
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;
+ continue;
} else {
ret = amdsmi_get_gpu_perf_level(processor_handles_[i], &pfl);
CHK_ERR_ASRT(ret)
@@ -138,7 +143,6 @@ void TestPerfDeterminism::Run(void) {
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
std::endl;
}
- return;
- }
- }
+ } // END - SET SUPPORTED
+ } // END - DEVICE LOOP
}
diff --git a/projects/amdsmi/tests/amd_smi_test/functional/volt_freq_curv_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/volt_freq_curv_read.cc
index 0595702ecf..a35bacc1dd 100755
--- a/projects/amdsmi/tests/amd_smi_test/functional/volt_freq_curv_read.cc
+++ b/projects/amdsmi/tests/amd_smi_test/functional/volt_freq_curv_read.cc
@@ -160,6 +160,7 @@ void TestVoltCurvRead::Run(void) {
err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], &odv);
if (err == AMDSMI_STATUS_NOT_SUPPORTED
|| err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) {
+ //TODO add perf_level tests
IF_VERB(STANDARD) {
std::cout <<
"\t** amdsmi_get_gpu_od_volt_info: Not supported on this machine"
diff --git a/projects/amdsmi/tools/generator.py b/projects/amdsmi/tools/generator.py
index 18383ee118..cc3db2f92b 100644
--- a/projects/amdsmi/tools/generator.py
+++ b/projects/amdsmi/tools/generator.py
@@ -114,19 +114,11 @@ 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_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}"
try:
- 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():
+ if libamd_smi_parent_dir.is_file():
# try to fall back to parent directory
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_parent_dir)
else:
diff --git a/projects/amdsmi/update_wrapper.sh b/projects/amdsmi/update_wrapper.sh
index 0a836f5405..d6557d92c0 100755
--- a/projects/amdsmi/update_wrapper.sh
+++ b/projects/amdsmi/update_wrapper.sh
@@ -44,7 +44,8 @@ cp -r /src /tmp/src \
&& rm -rf build .cache \
&& cmake -B build -DBUILD_WRAPPER=ON $ENABLE_ESMI_LIB \
&& make -C build -j $(nproc) \
- && cp /tmp/src/py-interface/amdsmi_wrapper.py /src/py-interface/amdsmi_wrapper.py"
+ && cp /tmp/src/py-interface/amdsmi_wrapper.py /src/py-interface/amdsmi_wrapper.py \
+ && chown --reference /src/py-interface/CMakeLists.txt /src/py-interface/amdsmi_wrapper.py"
echo -e "Generated new wrapper!
[$DIR/py-interface/amdsmi_wrapper.py]"