docs: Remove redundant/stale docs
bump rocm-docs-core to 1.8.2
rm unused files
rm stale docs
fix sphinx conf
reorg docs
SWDEV-482203 -- add note to usage guides
update readmes
Change-Id: I9e0111ac8fe2a691ac964b27436ba47747c27904
Signed-off-by: Peter Park <Peter.Park@amd.com>
[ROCm/amdsmi commit: e196f98dba]
Этот коммит содержится в:
коммит произвёл
Maisam Arif
родитель
16ffa7714c
Коммит
a003e50130
+154
-293
@@ -1,345 +1,195 @@
|
||||
# AMD System Management Interface (AMD SMI) Library
|
||||
# AMD System Management Interface (AMD SMI) library
|
||||
|
||||
The AMD System Management Interface Library, or AMD SMI library, is a C library for Linux that provides a user space interface for applications to monitor and control AMD devices.
|
||||
The AMD System Management Interface (AMD SMI) library offers a unified tool for managing and monitoring GPUs,
|
||||
particularly in high-performance computing environments. It provides a user-space interface that allows applications to
|
||||
control GPU operations, monitor performance, and retrieve information about the system's drivers and GPUs.
|
||||
|
||||
For additional information refer to [ROCm Documentation](https://rocm.docs.amd.com/projects/amdsmi/en/latest/)
|
||||
For information on available features, installation steps, API reference material, and helpful tips, refer to the online
|
||||
documentation at [rocm.docs.amd.com/projects/amdsmi](https://rocm.docs.amd.com/projects/amdsmi/en/latest/)
|
||||
|
||||
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)
|
||||
>[!NOTE]
|
||||
>This project is a successor to [rocm_smi_lib](https://github.com/ROCm/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.
|
||||
At initial release, the AMD SMI library will support Linux bare metal and Linux
|
||||
virtual machine guest for AMD GPUs. In a future release, the library will be
|
||||
extended to support AMD EPYC™ CPUs.
|
||||
|
||||
AMD SMI library can run on AMD ROCm supported platforms, refer to [System requirements (Linux)](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html) for more information.
|
||||
AMD SMI library can run on AMD ROCm supported platforms, refer to
|
||||
[System requirements (Linux)](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html)
|
||||
for more information.
|
||||
|
||||
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.
|
||||
## Installation
|
||||
|
||||
## Install CLI Tool and Libraries
|
||||
* [Install the AMD SMI library and CLI tool](https://rocm.docs.amd.com/projects/amdsmi/en/latest/install/install.html)
|
||||
|
||||
**Disclaimer: CLI Tool is provided as an example code to aid the development of telemetry tools and is not guaranteed to be backwards compatible. The Python or C++ Library is recommended as a reliable data source.**
|
||||
## Requirements
|
||||
The following are required to install and use the AMD SMI libraries and CLI tool.
|
||||
|
||||
### Requirements
|
||||
* Python 3.6.8+ (64-bit)
|
||||
* `amdgpu` driver must be loaded for [`amdsmi_init()`](./docs/how-to/amdsmi-cpp-lib#hello-amd-smi) to work.
|
||||
|
||||
* python 3.6.8+ 64-bit
|
||||
- prerequisite modules:
|
||||
- python3-wheel
|
||||
- python3-setuptools
|
||||
* amdgpu driver must be loaded for amdsmi_init() to pass
|
||||
## Install amdgpu driver and AMD SMI with ROCm
|
||||
|
||||
### Installation
|
||||
1. Get the `amdgpu-install` installer following the instructions for your Linux distribution at
|
||||
[Installation via AMDGPU installer](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/amdgpu-install.html#installation).
|
||||
|
||||
### Install amdgpu using ROCm
|
||||
* Install amdgpu driver:
|
||||
See example below, your release and link may differ. The `amdgpu-install --usecase=rocm` triggers both an amdgpu driver update and AMD SMI packages to be installed on your device.
|
||||
```shell
|
||||
sudo apt update
|
||||
wget https://repo.radeon.com/amdgpu-install/6.0.2/ubuntu/jammy/amdgpu-install_6.0.60002-1_all.deb
|
||||
sudo apt install ./amdgpu-install_6.0.60002-1_all.deb
|
||||
sudo amdgpu-install --usecase=rocm
|
||||
```
|
||||
* amd-smi --help
|
||||
2. Use `amdgpu-install` to install the `amdgpu` driver and ROCm packages with
|
||||
AMD SMI included.
|
||||
|
||||
### Install Example for Ubuntu 22.04 (without ROCm)
|
||||
``` shell
|
||||
sudo amdgpu-install --usecase=rocm
|
||||
```
|
||||
|
||||
``` bash
|
||||
apt install amd-smi-lib
|
||||
# if installed with rocm ignore the export
|
||||
export PATH="${PATH:+${PATH}:}~/opt/rocm/bin"
|
||||
amd-smi --help
|
||||
```
|
||||
The `amdgpu-install --usecase=rocm` option triggers both an `amdgpu` driver
|
||||
update and AMD SMI packages to be installed on your device.
|
||||
|
||||
### Optional autocompletion
|
||||
3. Verify your installation.
|
||||
|
||||
`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:
|
||||
```shell
|
||||
amd-smi --help
|
||||
```
|
||||
|
||||
```bash
|
||||
python3 -m pip install argcomplete
|
||||
activate-global-python-argcomplete --user
|
||||
# restart shell to enable
|
||||
```
|
||||
## Install AMD SMI without ROCm
|
||||
|
||||
### Manual/Multiple Rocm Instance Python Library Install
|
||||
The following are example steps to install the AMD SMI libraries and CLI tool on
|
||||
Ubuntu 22.04.
|
||||
|
||||
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.
|
||||
1. Install the library.
|
||||
|
||||
#### Python Library Install Example for Ubuntu 22.04
|
||||
```shell
|
||||
sudo apt install amd-smi-lib
|
||||
```
|
||||
|
||||
Remove previous amdsmi installation:
|
||||
2. Add the installation directory to your PATH. If installed with ROCm, ignore
|
||||
this step.
|
||||
|
||||
```bash
|
||||
python3 -m pip list | grep amd
|
||||
python3 -m pip uninstall amdsmi
|
||||
```
|
||||
```shell
|
||||
export PATH="${PATH:+${PATH}:}~/opt/rocm/bin"
|
||||
```
|
||||
|
||||
Then install Python library from your target rocm instance:
|
||||
3. Verify your installation.
|
||||
|
||||
``` bash
|
||||
apt install amd-smi-lib
|
||||
cd /opt/rocm/share/amd_smi
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install --user .
|
||||
```
|
||||
```shell
|
||||
amd-smi --help
|
||||
```
|
||||
|
||||
Now you have the amdsmi python library in your python path:
|
||||
## AMD SMI basic usage
|
||||
|
||||
``` 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
|
||||
>>>
|
||||
```
|
||||
### C++ library
|
||||
|
||||
### Installing the Python Prerequisite Modules
|
||||
For developers focused on performance monitoring, system diagnostics, or resource management, the AMD SMI C++ library
|
||||
offers a powerful and versatile tool to unlock the full capabilities of AMD hardware.
|
||||
|
||||
Python3-setuptools and python3-wheel can both be installed through the pip installer as shown below:
|
||||
Refer to the [user guide](https://rocm.docs.amd.com/projects/amdsmi/en/latest/how-to/amdsmi-cpp-lib.html) and the
|
||||
detailed [C++ API reference](https://rocm.docs.amd.com/projects/amdsmi/en/latest/reference/amdsmi-cpp-api.html) in the
|
||||
ROCm documentation portal.
|
||||
|
||||
```bash
|
||||
python3 -m pip install setuptools wheel
|
||||
```
|
||||
### Python library
|
||||
|
||||
## Usage Basics for the C Library
|
||||
The AMD SMI Python interface provides an easy-to-use
|
||||
[API](https://rocm.docs.amd.com/projects/amdsmi/en/latest/reference/amdsmi-py-lib.html) for interacting with AMD
|
||||
hardware. It simplifies tasks like monitoring and controlling GPU operations, allowing for rapid development.
|
||||
|
||||
### Device/Socket handles
|
||||
Refer to the [user guide](https://rocm.docs.amd.com/projects/amdsmi/en/latest/how-to/amdsmi-py-lib.html) and the
|
||||
detailed [Python API reference](https://rocm.docs.amd.com/projects/amdsmi/en/latest/reference/amdsmi-py-api.html) in the
|
||||
ROCm documentation portal.
|
||||
|
||||
Many of the functions in the library take a "socket handle" or "device handle". The socket is an abstraction of hardware physical socket. This will enable amd-smi to provide a better representation of the hardware to user. Although there is always one distinct GPU for a socket, the APU may have both
|
||||
GPU device and CPU device on the same socket. Moreover, for MI200, it may have multiple GCDs.
|
||||
### CLI tool
|
||||
|
||||
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.
|
||||
A versatile command line tool for managing and monitoring AMD hardware. You can use `amd-smi` for:
|
||||
|
||||
The list of socket handles discovered using `amdsmi_get_socket_handles()`,can also be used to query the cpus in that socket using `amdsmi_get_processor_handles_by_type()`, which in turn can then be used to query the cores in that cpu using `amdsmi_get_processor_handles_by_type()` again.
|
||||
- Device information: Quickly retrieve detailed information about AMD GPUs
|
||||
|
||||
- Performance monitoring: Real-time monitoring of GPU utilization, memory, temperature, and power consumption
|
||||
|
||||
## Hello AMD SMI
|
||||
- Process information: Identify which processes are using GPUs
|
||||
|
||||
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.
|
||||
- Configuration management: Adjust GPU settings like clock speeds and power limits
|
||||
|
||||
When AMD-SMI is no longer being used, `amdsmi_shut_down()` should be called. This provides a way to do any releasing of resources that AMD-SMI may have held.
|
||||
- Error reporting: Monitor and report GPU errors for proactive maintenance
|
||||
|
||||
1) A simple "Hello World" type program that displays the temperature of detected devices would look like this:
|
||||
|
||||
```c++
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
int main() {
|
||||
amdsmi_status_t ret;
|
||||
|
||||
// Init amdsmi for sockets and devices. Here we are only interested in AMD_GPUS.
|
||||
ret = amdsmi_init(AMDSMI_INIT_AMD_GPUS);
|
||||
|
||||
// Get all sockets
|
||||
uint32_t socket_count = 0;
|
||||
|
||||
// Get the socket count available in the system.
|
||||
ret = amdsmi_get_socket_handles(&socket_count, nullptr);
|
||||
|
||||
// Allocate the memory for the sockets
|
||||
std::vector<amdsmi_socket_handle> sockets(socket_count);
|
||||
// Get the socket handles in the system
|
||||
ret = amdsmi_get_socket_handles(&socket_count, &sockets[0]);
|
||||
|
||||
std::cout << "Total Socket: " << socket_count << std::endl;
|
||||
|
||||
// For each socket, get identifier and devices
|
||||
for (uint32_t i=0; i < socket_count; i++) {
|
||||
// Get Socket info
|
||||
char socket_info[128];
|
||||
ret = amdsmi_get_socket_info(sockets[i], 128, socket_info);
|
||||
std::cout << "Socket " << socket_info<< std::endl;
|
||||
|
||||
// Get the device count for the socket.
|
||||
uint32_t device_count = 0;
|
||||
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
|
||||
|
||||
// Allocate the memory for the device handlers on the socket
|
||||
std::vector<amdsmi_processor_handle> processor_handles(device_count);
|
||||
// Get all devices of the socket
|
||||
ret = amdsmi_get_processor_handles(sockets[i],
|
||||
&device_count, &processor_handles[0]);
|
||||
|
||||
// For each device of the socket, get name and temperature.
|
||||
for (uint32_t j=0; j < device_count; j++) {
|
||||
// Get device type. Since the amdsmi is initialized with
|
||||
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMDSMI_PROCESSOR_TYPE_AMD_GPU.
|
||||
processor_type_t processor_type;
|
||||
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
|
||||
if (processor_type != AMDSMI_PROCESSOR_TYPE_AMD_GPU) {
|
||||
std::cout << "Expect AMDSMI_PROCESSOR_TYPE_AMD_GPU device type!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get device name
|
||||
amdsmi_board_info_t board_info;
|
||||
ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info);
|
||||
std::cout << "\tdevice "
|
||||
<< j <<"\n\t\tName:" << board_info.product_name << std::endl;
|
||||
|
||||
// Get temperature
|
||||
int64_t val_i64 = 0;
|
||||
ret = amdsmi_get_temp_metric(processor_handles[j], AMDSMI_TEMPERATURE_TYPE_EDGE,
|
||||
AMDSMI_TEMP_CURRENT, &val_i64);
|
||||
std::cout << "\t\tTemperature: " << val_i64 << "C" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up resources allocated at amdsmi_init. It will invalidate sockets
|
||||
// and devices pointers
|
||||
ret = amdsmi_shut_down();
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
2) A sample program that displays the power of detected cpus would look like this:
|
||||
|
||||
```c++
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
amdsmi_status_t ret;
|
||||
uint32_t socket_count = 0;
|
||||
|
||||
// Initialize amdsmi for AMD CPUs
|
||||
ret = amdsmi_init(AMDSMI_INIT_AMD_CPUS);
|
||||
|
||||
ret = amdsmi_get_socket_handles(&socket_count, nullptr);
|
||||
|
||||
// Allocate the memory for the sockets
|
||||
std::vector<amdsmi_socket_handle> sockets(socket_count);
|
||||
|
||||
// Get the sockets of the system
|
||||
ret = amdsmi_get_socket_handles(&socket_count, &sockets[0]);
|
||||
|
||||
std::cout << "Total Socket: " << socket_count << std::endl;
|
||||
|
||||
// For each socket, get cpus
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
uint32_t cpu_count = 0;
|
||||
|
||||
// Set processor type as AMDSMI_PROCESSOR_TYPE_AMD_CPU
|
||||
processor_type_t processor_type = AMDSMI_PROCESSOR_TYPE_AMD_CPU;
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &cpu_count);
|
||||
|
||||
// Allocate the memory for the cpus
|
||||
std::vector<amdsmi_processor_handle> plist(cpu_count);
|
||||
|
||||
// Get the cpus for each socket
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, &plist[0], &cpu_count);
|
||||
|
||||
for (uint32_t index = 0; index < plist.size(); index++) {
|
||||
uint32_t socket_power;
|
||||
std::cout<<"CPU "<<index<<"\t"<< std::endl;
|
||||
std::cout<<"Power (Watts): ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power(plist[index], &socket_power);
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
std::cout<<"Failed to get cpu socket power"<<"["<<index<<"] , Err["<<ret<<"] "<< std::endl;
|
||||
|
||||
if (!ret) {
|
||||
std::cout<<static_cast<double>(socket_power)/1000<<std::endl;
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up resources allocated at amdsmi_init
|
||||
ret = amdsmi_shut_down();
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
### Documentation
|
||||
|
||||
The reference manual, `AMD_SMI_Manual.pdf` will be in the /opt/rocm/share/doc/amd_smi directory upon a successful build.
|
||||
|
||||
### Sphinx Documentation
|
||||
|
||||
To build the documentation locally, run the commands below:
|
||||
|
||||
``` bash
|
||||
cd docs
|
||||
|
||||
python3 -m pip install -r sphinx/requirements.txt
|
||||
|
||||
python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
|
||||
```
|
||||
|
||||
The output will be in `docs/_build/html`.
|
||||
|
||||
For additional details, see [Contribute to ROCm documentation](https://rocm.docs.amd.com/en/latest/contribute/contributing.html).
|
||||
Check out
|
||||
[Getting to Know Your GPU: A Deep Dive into AMD SMI -- ROCm Blogs](https://rocm.blogs.amd.com/software-tools-optimization/amd-smi-overview/README.html)
|
||||
for a rundown.
|
||||
|
||||
## Building AMD SMI
|
||||
|
||||
### Rebuilding Python wrapper
|
||||
This section describes the prerequisites and steps to build AMD SMI from source.
|
||||
|
||||
The python wrapper (binding) is an auto-generated file `py-interface/amdsmi_wrapper.py`
|
||||
### Required software
|
||||
|
||||
Wrapper should be re-generated on each C++ API change, by doing:
|
||||
To build the AMD SMI library, the following components are required. Note that the software versions specified were used
|
||||
during development; earlier versions are not guaranteed to work.
|
||||
|
||||
```bash
|
||||
* CMake (v3.14.0 or later) -- `python3 -m pip install cmake`
|
||||
* g++ (v5.4.0 or later)
|
||||
|
||||
In order to build the AMD SMI Python package, the following components are required:
|
||||
|
||||
* Python (3.6.8 or later)
|
||||
* prerequisite modules:
|
||||
* python3-wheel
|
||||
* python3-setuptools
|
||||
* virtualenv -- `python3 -m pip install virtualenv`
|
||||
|
||||
### Build steps
|
||||
|
||||
1. Clone the AMD SMI repository to your local Linux machine.
|
||||
|
||||
```shell
|
||||
git clone https://github.com/ROCm/amdsmi.git
|
||||
```
|
||||
|
||||
2. The default installation location for the library and headers is `/opt/rocm`. Before installation, any old ROCm
|
||||
directories should be deleted:
|
||||
|
||||
* `/opt/rocm`
|
||||
* `/opt/rocm-<version_number>`
|
||||
|
||||
3. Build the library by following the typical CMake build sequence (run as root user or use `sudo` before `make install`
|
||||
command); for instance:
|
||||
|
||||
```bash
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake ..
|
||||
make -j $(nproc)
|
||||
make install
|
||||
```
|
||||
|
||||
The built library is located in the `build/` directory. To build the `rpm` and `deb` packages use the following
|
||||
command:
|
||||
|
||||
```bash
|
||||
make package
|
||||
```
|
||||
|
||||
### Rebuild the Python wrapper
|
||||
|
||||
The Python wrapper for the AMD SMI library is found in the [auto-generated file](#py_lib_fs)
|
||||
`py-interface/amdsmi_wrapper.py`. It is essential to regenerate this wrapper whenever there are changes to the C++ API.
|
||||
It is not regenerated automatically.
|
||||
|
||||
To regenerate the wrapper, use the following command.
|
||||
|
||||
```shell
|
||||
./update_wrapper.sh
|
||||
```
|
||||
|
||||
After this command, the file in `py-interface/amdsmi_wrapper.py` will be automatically updated on each compile.
|
||||
After this command, the file in `py-interface/amdsmi_wrapper.py` will be updated
|
||||
on compile.
|
||||
|
||||
Note: To be able to re-generate python wrapper you need **docker** installed.
|
||||
>[!NOTE]
|
||||
>You need Docker installed on your system to regenerate the Python wrapper.
|
||||
|
||||
Note: python_wrapper is NOT automatically re-generated. You must run `./update_wrapper.sh`.
|
||||
### Build the tests
|
||||
|
||||
### 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:
|
||||
|
||||
* CMake (v3.14.0) - `python3 -m pip install cmake`
|
||||
* g++ (5.4.0)
|
||||
|
||||
In order to build the AMD SMI python package, the following components are required:
|
||||
|
||||
* python (3.6.8 or above)
|
||||
* virtualenv - `python3 -m pip install virtualenv`
|
||||
|
||||
In order to build the latest documentation, the following are required:
|
||||
|
||||
* DOxygen (1.8.11)
|
||||
* latex (pdfTeX 3.14159265-2.6-1.40.16)
|
||||
|
||||
The source code for AMD SMI is available on Github.
|
||||
|
||||
After the AMD SMI library git repository has been cloned to a local Linux machine, the Default location for the library and headers is /opt/rocm. Before installation, the old rocm directories should be deleted:
|
||||
/opt/rocm
|
||||
/opt/rocm-{number}
|
||||
|
||||
Building the library is achieved by following the typical CMake build sequence (run as root user or use 'sudo' before 'make install' command), specifically:
|
||||
|
||||
```bash
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake ..
|
||||
make -j $(nproc)
|
||||
make install
|
||||
```
|
||||
|
||||
The built library will appear in the `build` folder.
|
||||
|
||||
To build the rpm and deb packages follow the above steps with:
|
||||
|
||||
```bash
|
||||
make package
|
||||
```
|
||||
|
||||
### Building the Tests
|
||||
|
||||
In order to verify the build and capability of AMD SMI on your system and to see an example of how AMD SMI can be used, you may build and run the tests that are available in the repo. To build the tests, follow these steps:
|
||||
To verify the build and capabilities of AMD SMI on your system, as well as to see practical examples of its usage, you
|
||||
can build and run the available [tests in the repository](https://github.com/ROCm/amdsmi/tree/amd-staging/tests). Follow
|
||||
these steps to build the tests:
|
||||
|
||||
```bash
|
||||
mkdir -p build
|
||||
@@ -348,13 +198,24 @@ cmake -DBUILD_TESTS=ON ..
|
||||
make -j $(nproc)
|
||||
```
|
||||
|
||||
### Run the Tests
|
||||
#### Run the tests
|
||||
|
||||
To run the test, execute the program `amdsmitst` that is built from the steps above.
|
||||
Path to the program `amdsmitst`: build/tests/amd_smi_test/
|
||||
Once the tests are [built](#build-the-tests), you can run them by executing the `amdsmitst` program. The executable can
|
||||
be found at `build/tests/amd_smi_test/`.
|
||||
|
||||
### Build the docs
|
||||
|
||||
To build the documentation, follow the instructions at
|
||||
[Building documentation](https://rocm.docs.amd.com/en/latest/contribute/building.html).
|
||||
|
||||
## DISCLAIMER
|
||||
|
||||
The information contained herein is for informational purposes only, and is subject to change without notice. In addition, any stated support is planned and is also subject to change. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein.
|
||||
The information contained herein is for informational purposes only, and is subject to change without notice. In
|
||||
addition, any stated support is planned and is also subject to change. While every precaution has been taken in the
|
||||
preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is
|
||||
under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no
|
||||
representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes
|
||||
no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular
|
||||
purposes, with respect to the operation or use of AMD hardware, software or other products described herein.
|
||||
|
||||
© 2023-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
|
||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -1,2 +0,0 @@
|
||||
```{include} ../CHANGELOG.md
|
||||
```
|
||||
@@ -1,2 +0,0 @@
|
||||
```{include} ../amdsmi_cli/README.md
|
||||
```
|
||||
@@ -1,2 +0,0 @@
|
||||
```{include} ../amdsmi_cli/Release_Notes.md
|
||||
```
|
||||
@@ -1 +0,0 @@
|
||||
test
|
||||
@@ -4,29 +4,57 @@
|
||||
# list see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
import subprocess
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from rocm_docs import ROCmDocs
|
||||
# get version number to print in docs
|
||||
def get_version_info(filepath):
|
||||
with open(filepath, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
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'
|
||||
get_version_minor = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_MINOR\ //p" ../include/amd_smi/amdsmi.h'
|
||||
get_version_release = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_RELEASE\ //p" ../include/amd_smi/amdsmi.h'
|
||||
version_year = subprocess.getoutput(get_version_year)
|
||||
version_major = subprocess.getoutput(get_version_major)
|
||||
version_minor = subprocess.getoutput(get_version_minor)
|
||||
version_release = subprocess.getoutput(get_version_release)
|
||||
name = f"AMD SMI {version_year}.{version_major}.{version_minor}.{version_release}"
|
||||
version_pattern = (
|
||||
r'^#define\s+AMDSMI_LIB_VERSION_YEAR\s+(\d+)\s*$|'
|
||||
r'^#define\s+AMDSMI_LIB_VERSION_MAJOR\s+(\d+)\s*$|'
|
||||
r'^#define\s+AMDSMI_LIB_VERSION_MINOR\s+(\d+)\s*$|'
|
||||
r'^#define\s+AMDSMI_LIB_VERSION_RELEASE\s+(\d+)\s*$'
|
||||
)
|
||||
|
||||
matches = re.findall(version_pattern, content, re.MULTILINE)
|
||||
|
||||
if len(matches) == 4:
|
||||
version_year, version_major, version_minor, version_release = [
|
||||
match for match in matches if any(match)
|
||||
]
|
||||
return version_year[0], version_major[1], version_minor[2], version_release[3]
|
||||
else:
|
||||
raise ValueError("Couldn't find all VERSION numbers.")
|
||||
|
||||
# copy changelog to docs/
|
||||
shutil.copy2("../CHANGELOG.md", "./reference/changelog.md")
|
||||
|
||||
version_year, version_major, version_minor, version_release = get_version_info('../include/amd_smi/amdsmi.h')
|
||||
version_number = f"{version_year}.{version_major}.{version_minor}.{version_release}"
|
||||
|
||||
# project info
|
||||
project = "AMD SMI"
|
||||
author = "Advanced Micro Devices, Inc."
|
||||
copyright = "Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved."
|
||||
version = version_number
|
||||
release = version_number
|
||||
|
||||
html_theme = "rocm_docs_theme"
|
||||
html_theme_options = {"flavor": "rocm"}
|
||||
html_title = f"AMD SMI {version_number} documentation"
|
||||
exclude_patterns = ["rocm-smi-lib"]
|
||||
suppress_warnings = ["etoc.toctree"]
|
||||
external_toc_path = "./sphinx/_toc.yml"
|
||||
|
||||
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"
|
||||
}
|
||||
external_projects_current_project = "amdsmi"
|
||||
extensions = ["rocm_docs", "rocm_docs.doxygen"]
|
||||
|
||||
for sphinx_var in ROCmDocs.SPHINX_VARS:
|
||||
globals()[sphinx_var] = getattr(docs_core, sphinx_var)
|
||||
doxygen_root = "doxygen"
|
||||
doxysphinx_enabled = True
|
||||
doxygen_project = {
|
||||
"name": "AMD SMI C++ API reference",
|
||||
"path": "doxygen/docBin/xml",
|
||||
}
|
||||
|
||||
+117
-22
@@ -1,10 +1,37 @@
|
||||
# Using AMD SMI Command Line Interface tool
|
||||
---
|
||||
myst:
|
||||
html_meta:
|
||||
"description lang=en": "Learn how to use the AMD SMI command line tool."
|
||||
"keywords": "api, smi, lib, system, management, interface, example"
|
||||
---
|
||||
|
||||
**Disclaimer: CLI Tool is provided as an example code to aid the development of telemetry tools. Python or C++ Library is recommended as a reliable data source.**
|
||||
# AMD SMI CLI tool usage
|
||||
|
||||
AMD-SMI reports the version and current platform detected when running the command line interface (CLI) without arguments:
|
||||
This tool is a command line interface (CLI) for manipulating and monitoring the
|
||||
`amdgpu` kernel; it is intended to replace and deprecate the existing `rocm_smi`
|
||||
CLI tool and `gpuv-smi` tool. The AMD SMI CLI tool uses Ctypes to call the
|
||||
`amd_smi_lib` API.
|
||||
|
||||
``` bash
|
||||
When using the CLI tool, you should have at least one AMD GPU and the driver
|
||||
installed.
|
||||
|
||||
```{admonition} Disclaimer
|
||||
The AMD SMI CLI tool is provided as an example code to aid the development of
|
||||
telemetry tools. The [Python](./amdsmi-py-lib) or [C++
|
||||
library](./amdsmi-cpp-lib) is recommended as a robust data source.
|
||||
```
|
||||
|
||||
## Install the CLI Tool and Python library
|
||||
|
||||
Refer to the [installation instructions](../install/install.md).
|
||||
|
||||
## Get started
|
||||
|
||||
The amd-smi command provides system management and monitoring capabilities for
|
||||
AMD hardware. When run without arguments, it reports the version and platform
|
||||
detected:
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi
|
||||
usage: amd-smi [-h] ...
|
||||
|
||||
@@ -26,28 +53,38 @@ AMD-SMI Commands:
|
||||
topology Displays topology information of the devices
|
||||
set Set options for devices
|
||||
reset Reset options for devices
|
||||
monitor Monitor metrics for target devices
|
||||
monitor (dmon) Monitor metrics for target devices
|
||||
xgmi Displays xgmi information of the devices
|
||||
```
|
||||
|
||||
Example commands:
|
||||
|
||||
``` bash
|
||||
```shell-session
|
||||
amd-smi static --gpu 0
|
||||
amd-smi metric
|
||||
amd-smi process --gpu 0 1
|
||||
amd-smi reset --gpureset --gpu all
|
||||
```
|
||||
|
||||
More detailed verison information is available from `amd-smi version`
|
||||
```{note}
|
||||
For command-specific help, use `amd-smi [command] --help` for see more detailed
|
||||
usage information. See [Commands](#cmds).
|
||||
|
||||
Each command will have detailed information via `amd-smi [command] --help`
|
||||
For more detailed version information, use `amd-smi version`.
|
||||
```
|
||||
|
||||
(cmds)=
|
||||
## Commands
|
||||
|
||||
For convenience, here is the help output for each command
|
||||
The following are the help output for each command, providing quick reference
|
||||
details for usage.
|
||||
|
||||
```bash
|
||||
(cmd-list)=
|
||||
### amd-smi list
|
||||
|
||||
Lists GPU information.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi list --help
|
||||
usage: amd-smi list [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]]
|
||||
@@ -84,7 +121,13 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-static)=
|
||||
### amd-smi static
|
||||
|
||||
Gets static information about the specified GPU. See the [sample
|
||||
output](#cli-ex-static) for `amd-smi static`.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi static --help
|
||||
usage: amd-smi static [-h] [-g GPU [GPU ...] | -U CPU [CPU ...]] [-a] [-b] [-V] [-d] [-v]
|
||||
[-c] [-B] [-R] [-r] [-p] [-l] [-P] [-x] [-u] [-s] [-i]
|
||||
@@ -134,7 +177,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-firmware)=
|
||||
### amd-smi firmware
|
||||
|
||||
Gets firmware information about the specified GPU.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi firmware --help
|
||||
usage: amd-smi firmware [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]] [-f]
|
||||
@@ -168,7 +216,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-bad-pages)=
|
||||
### amd-smi bad-pages
|
||||
|
||||
Gets bad page information about the specified GPU.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi bad-pages --help
|
||||
usage: amd-smi bad-pages [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]] [-p]
|
||||
@@ -205,7 +258,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-metric)=
|
||||
### amd-smi metric
|
||||
|
||||
Gets metrics and performance information about the specified GPU.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi metric --help
|
||||
usage: amd-smi metric [-h] [-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]]
|
||||
[-w INTERVAL] [-W TIME] [-i ITERATIONS] [-m] [-u] [-p] [-c] [-t]
|
||||
@@ -295,7 +353,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-process)=
|
||||
### amd-smi process
|
||||
|
||||
Lists general process information running on the specified GPU.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi process --help
|
||||
usage: amd-smi process [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]]
|
||||
@@ -339,7 +402,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-event)=
|
||||
### amd-smi event
|
||||
|
||||
Displays event information for the given GPU.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi event --help
|
||||
usage: amd-smi event [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]]
|
||||
@@ -372,7 +440,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-topology)=
|
||||
### amd-smi topology
|
||||
|
||||
Displays topology information of the specified devices.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi topology --help
|
||||
usage: amd-smi topology [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]] [-a]
|
||||
@@ -412,7 +485,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-set)=
|
||||
### amd-smi set
|
||||
|
||||
Set options for specified devices.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi set --help
|
||||
usage: amd-smi set [-h] (-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]) [-f %]
|
||||
[-l LEVEL] [-P SETPROFILE] [-d SCLKMAX] [-C PARTITION] [-M PARTITION]
|
||||
@@ -482,7 +560,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-reset)=
|
||||
### amd-smi reset
|
||||
|
||||
Reset options for specified devices.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi reset --help
|
||||
usage: amd-smi reset [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
(-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]) [-G] [-c]
|
||||
@@ -527,7 +610,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-monitor)=
|
||||
### amd-smi monitor
|
||||
|
||||
Monitor metrics for target devices.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi monitor --help
|
||||
usage: amd-smi monitor [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]]
|
||||
@@ -577,7 +665,12 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
```bash
|
||||
(cmd-xgmi)=
|
||||
### amd-smi xgmi
|
||||
|
||||
Displays XGMI information of specified devices.
|
||||
|
||||
```shell-session
|
||||
~$ amd-smi xgmi --help
|
||||
usage: amd-smi xgmi [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
|
||||
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]] [-m]
|
||||
@@ -612,9 +705,11 @@ Command Modifiers:
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
```
|
||||
|
||||
(cli-ex-static)=
|
||||
### Example output from amd-smi static
|
||||
|
||||
Here is some example output from the tool:
|
||||
To gain a sense of the AMD SMI CLI's output, the following block is sample
|
||||
output from the CLI tool:
|
||||
|
||||
```bash
|
||||
~$ amd-smi static
|
||||
@@ -0,0 +1,198 @@
|
||||
---
|
||||
myst:
|
||||
html_meta:
|
||||
"description lang=en": "Get started with the AMD SMI C++ library. Basic usage and examples."
|
||||
"keywords": "api, smi, lib, c++, system, management, interface, ROCm"
|
||||
---
|
||||
|
||||
# AMD SMI C++ library usage and examples
|
||||
|
||||
This section presents a brief overview and some basic examples on the AMD SMI
|
||||
library's usage. Whether you are developing applications for performance
|
||||
monitoring, system diagnostics, or resource allocation, the AMD SMI C++ library
|
||||
serves as a valuable tool for leveraging the full potential of AMD hardware in
|
||||
your projects.
|
||||
|
||||
```{note}
|
||||
``hipcc`` and other compilers will not automatically link in the ``libamd_smi``
|
||||
dynamic library. To compile code that uses the AMD SMI library API, ensure the
|
||||
``libamd_smi.so`` can be located by setting the ``LD_LIBRARY_PATH`` environment
|
||||
variable to the directory containing ``librocm_smi64.so`` (usually
|
||||
``/opt/rocm/lib``) or by passing the ``-lamd_smi`` flag to the compiler.
|
||||
```
|
||||
|
||||
```{seealso}
|
||||
Refer to the [C++ library API reference](../reference/amdsmi-cpp-api.md).
|
||||
```
|
||||
|
||||
(device_socket_handle)=
|
||||
## Device and socket handles
|
||||
|
||||
Many functions in the library take a _socket handle_ or _device handle_. A
|
||||
_socket_ refers to a physical hardware socket, abstracted by the library to
|
||||
represent the hardware more effectively to the user. While there is always one
|
||||
unique GPU per socket, an APU may house both a GPU and CPU on the same socket.
|
||||
For MI200 GPUs, multiple GCDs may reside within a single socket
|
||||
|
||||
To identify the sockets in a system, use the `amdsmi_get_socket_handles()`
|
||||
function, which returns a list of socket handles. These handles can then be used
|
||||
with `amdsmi_get_processor_handles()` to query devices within each socket. The
|
||||
device handle is used to differentiate between detected devices; however, it's
|
||||
important to note that a device handle may change after restarting the
|
||||
application, so it should not be considered a persistent identifier across
|
||||
processes.
|
||||
|
||||
The list of socket handles obtained from `amdsmi_get_socket_handles()` can
|
||||
also be used to query the CPUs in each socket by calling
|
||||
`amdsmi_get_processor_handles_by_type()`. This function can then be called again
|
||||
to query the cores within each CPU.
|
||||
|
||||
(cpp_hello_amdsmi)=
|
||||
## Hello AMD SMI
|
||||
|
||||
An application using AMD SMI must call `amdsmi_init()` to initialize the AMI SMI
|
||||
library before all other calls. This call initializes the internal data
|
||||
structures required for subsequent AMD SMI operations. In the call, a flag can
|
||||
be passed to indicate if the application is interested in a specific device
|
||||
type.
|
||||
|
||||
`amdsmi_shut_down()` must be the last call to properly close connection to
|
||||
driver and make sure that any resources held by AMD SMI are released.
|
||||
|
||||
1. A simple "Hello World" type program that displays the temperature of detected
|
||||
devices looks like this:
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
int main() {
|
||||
amdsmi_status_t ret;
|
||||
|
||||
// Init amdsmi for sockets and devices. Here we are only interested in AMD_GPUS.
|
||||
ret = amdsmi_init(AMDSMI_INIT_AMD_GPUS);
|
||||
|
||||
// Get all sockets
|
||||
uint32_t socket_count = 0;
|
||||
|
||||
// Get the socket count available in the system.
|
||||
ret = amdsmi_get_socket_handles(&socket_count, nullptr);
|
||||
|
||||
// Allocate the memory for the sockets
|
||||
std::vector<amdsmi_socket_handle> sockets(socket_count);
|
||||
// Get the socket handles in the system
|
||||
ret = amdsmi_get_socket_handles(&socket_count, &sockets[0]);
|
||||
|
||||
std::cout << "Total Socket: " << socket_count << std::endl;
|
||||
|
||||
// For each socket, get identifier and devices
|
||||
for (uint32_t i=0; i < socket_count; i++) {
|
||||
// Get Socket info
|
||||
char socket_info[128];
|
||||
ret = amdsmi_get_socket_info(sockets[i], 128, socket_info);
|
||||
std::cout << "Socket " << socket_info<< std::endl;
|
||||
|
||||
// Get the device count for the socket.
|
||||
uint32_t device_count = 0;
|
||||
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
|
||||
|
||||
// Allocate the memory for the device handlers on the socket
|
||||
std::vector<amdsmi_processor_handle> processor_handles(device_count);
|
||||
// Get all devices of the socket
|
||||
ret = amdsmi_get_processor_handles(sockets[i],
|
||||
&device_count, &processor_handles[0]);
|
||||
|
||||
// For each device of the socket, get name and temperature.
|
||||
for (uint32_t j=0; j < device_count; j++) {
|
||||
// Get device type. Since the amdsmi is initialized with
|
||||
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMDSMI_PROCESSOR_TYPE_AMD_GPU.
|
||||
processor_type_t processor_type;
|
||||
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
|
||||
if (processor_type != AMDSMI_PROCESSOR_TYPE_AMD_GPU) {
|
||||
std::cout << "Expect AMDSMI_PROCESSOR_TYPE_AMD_GPU device type!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get device name
|
||||
amdsmi_board_info_t board_info;
|
||||
ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info);
|
||||
std::cout << "\tdevice "
|
||||
<< j <<"\n\t\tName:" << board_info.product_name << std::endl;
|
||||
|
||||
// Get temperature
|
||||
int64_t val_i64 = 0;
|
||||
ret = amdsmi_get_temp_metric(processor_handles[j], AMDSMI_TEMPERATURE_TYPE_EDGE,
|
||||
AMDSMI_TEMP_CURRENT, &val_i64);
|
||||
std::cout << "\t\tTemperature: " << val_i64 << "C" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up resources allocated at amdsmi_init. It will invalidate sockets
|
||||
// and devices pointers
|
||||
ret = amdsmi_shut_down();
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
2. A sample program that displays the power of detected CPUs looks like this:
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
amdsmi_status_t ret;
|
||||
uint32_t socket_count = 0;
|
||||
|
||||
// Initialize amdsmi for AMD CPUs
|
||||
ret = amdsmi_init(AMDSMI_INIT_AMD_CPUS);
|
||||
|
||||
ret = amdsmi_get_socket_handles(&socket_count, nullptr);
|
||||
|
||||
// Allocate the memory for the sockets
|
||||
std::vector<amdsmi_socket_handle> sockets(socket_count);
|
||||
|
||||
// Get the sockets of the system
|
||||
ret = amdsmi_get_socket_handles(&socket_count, &sockets[0]);
|
||||
|
||||
std::cout << "Total Socket: " << socket_count << std::endl;
|
||||
|
||||
// For each socket, get cpus
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
uint32_t cpu_count = 0;
|
||||
|
||||
// Set processor type as AMDSMI_PROCESSOR_TYPE_AMD_CPU
|
||||
processor_type_t processor_type = AMDSMI_PROCESSOR_TYPE_AMD_CPU;
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &cpu_count);
|
||||
|
||||
// Allocate the memory for the cpus
|
||||
std::vector<amdsmi_processor_handle> plist(cpu_count);
|
||||
|
||||
// Get the cpus for each socket
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, &plist[0], &cpu_count);
|
||||
|
||||
for (uint32_t index = 0; index < plist.size(); index++) {
|
||||
uint32_t socket_power;
|
||||
std::cout<<"CPU "<<index<<"\t"<< std::endl;
|
||||
std::cout<<"Power (Watts): ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power(plist[index], &socket_power);
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
std::cout<<"Failed to get cpu socket power"<<"["<<index<<"] , Err["<<ret<<"] "<< std::endl;
|
||||
|
||||
if (!ret) {
|
||||
std::cout<<static_cast<double>(socket_power)/1000<<std::endl;
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up resources allocated at amdsmi_init
|
||||
ret = amdsmi_shut_down();
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
myst:
|
||||
html_meta:
|
||||
"description lang=en": "Get started with the AMD SMI Python interface."
|
||||
"keywords": "api, smi, lib, py, system, management, interface, ROCm"
|
||||
---
|
||||
|
||||
# AMD SMI Python interface overview
|
||||
|
||||
The AMD SMI Python interface provides a convenient way to interact with AMD
|
||||
hardware through a simple and accessible [API](../reference/amdsmi-py-api.md).
|
||||
Compatible with Python 3.6 and higher, this library requires the AMD driver to
|
||||
be loaded for initialization -- review the [prerequisites](#install_reqs).
|
||||
|
||||
## Get started
|
||||
|
||||
To get started, the `amdsmi` folder should be copied and placed next to
|
||||
the importing script. Import it as follows:
|
||||
|
||||
```python
|
||||
from amdsmi import *
|
||||
|
||||
try:
|
||||
amdsmi_init()
|
||||
|
||||
# amdsmi calls ...
|
||||
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
finally:
|
||||
try:
|
||||
amdsmi_shut_down()
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
(py_lib_fs)=
|
||||
### Folder structure
|
||||
|
||||
File name | Description
|
||||
----------------------|-------------------------------------------------
|
||||
`__init__.py` | Python package initialization file
|
||||
`amdsmi_interface.py` | Amdsmi library Python interface
|
||||
`amdsmi_wrapper.py` | Python wrapper around amdsmi binary
|
||||
`amdsmi_exception.py` | Amdsmi [exceptions](#py_exceptions) Python file
|
||||
|
||||
(py_usage)=
|
||||
## Usage
|
||||
|
||||
```{note}
|
||||
``hipcc`` and other compilers will not automatically link in the ``libamd_smi``
|
||||
dynamic library. To compile code that uses the AMD SMI library API, ensure the
|
||||
``libamd_smi.so`` can be located by setting the ``LD_LIBRARY_PATH`` environment
|
||||
variable to the directory containing ``librocm_smi64.so`` (usually
|
||||
``/opt/rocm/lib``) or by passing the ``-lamd_smi`` flag to the compiler.
|
||||
```
|
||||
|
||||
```{seealso}
|
||||
Refer to the [Python library API reference](../reference/amdsmi-py-api.md).
|
||||
```
|
||||
|
||||
An application using AMD SMI must call `amdsmi_init()` to initialize the AMI SMI
|
||||
library before all other calls. This call initializes the internal data
|
||||
structures required for subsequent AMD SMI operations. In the call, a flag can
|
||||
be passed to indicate if the application is interested in a specific device
|
||||
type.
|
||||
|
||||
`amdsmi_shut_down()` must be the last call to properly close connection to
|
||||
driver and make sure that any resources held by AMD SMI are released.
|
||||
|
||||
(py_exceptions)=
|
||||
## Exceptions
|
||||
|
||||
All exceptions are in `amdsmi_exception.py` file.
|
||||
|
||||
Exceptions that can be thrown by AMD SMI are:
|
||||
|
||||
* `AmdSmiException`: base amdsmi exception class
|
||||
* `AmdSmiLibraryException`: derives base `AmdSmiException` class and represents errors that can occur in amdsmi-lib.
|
||||
When this exception is thrown, `err_code` and `err_info` are set. `err_code` is an integer that corresponds to errors that can occur
|
||||
in amdsmi-lib and `err_info` is a string that explains the error that occurred.
|
||||
|
||||
For example:
|
||||
|
||||
```python
|
||||
try:
|
||||
num_of_GPUs = len(amdsmi_get_processor_handles())
|
||||
if num_of_GPUs == 0:
|
||||
print("No GPUs on machine")
|
||||
except AmdSmiException as e:
|
||||
print("Error code: {}".format(e.err_code))
|
||||
if e.err_code == amdsmi_wrapper.AMDSMI_STATUS_RETRY:
|
||||
print("Error info: {}".format(e.err_info))
|
||||
```
|
||||
|
||||
* `AmdSmiRetryException` : Derives `AmdSmiLibraryException` class and signals
|
||||
device is busy and call should be retried.
|
||||
* `AmdSmiTimeoutException` : Derives `AmdSmiLibraryException` class and
|
||||
represents that call had timed out.
|
||||
* `AmdSmiParameterException`: Derives base `AmdSmiException` class and
|
||||
represents errors related to invaild parameters passed to functions. When this
|
||||
exception is thrown, `err_msg` is set and it explains what is the actual and
|
||||
expected type of the parameters.
|
||||
* `AmdSmiBdfFormatException`: Derives base `AmdSmiException` class and
|
||||
represents invalid bdf format.
|
||||
@@ -1,254 +0,0 @@
|
||||
.. meta::
|
||||
:description: Using AMD SMI
|
||||
:keywords: AMD, SMI, system, management, interface, ROCm
|
||||
|
||||
********************************
|
||||
Usage Basics for the C Library
|
||||
********************************
|
||||
|
||||
Device/Socket handles
|
||||
----------------------
|
||||
|
||||
Many of the AMD SMI library's functions take a "socket handle" or "device handle." The socket is an abstraction of the hardware's physical socket. This will enable AMD SMI to provide a better representation of the hardware to the user. Although there is always one distinct GPU for a socket, the APU may have both GPU and CPU devices on the same socket. Moreover, for the MI200 series, it may have multiple GCDs.
|
||||
|
||||
To discover the sockets in the system, `amdsmi_get_socket_handles()` is called to get a list of socket 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 handle after restarting the application, so a device handle should not be relied upon to be constant over the process.
|
||||
|
||||
The list of socket handles discovered using `amdsmi_get_socket_handles()`, can also be used to query the CPUs in that socket using amdsmi_get_processor_handles_by_type(), which in turn can then be used to query the cores in that CPU using amdsmi_get_processor_handles_by_type() again.
|
||||
|
||||
|
||||
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 subsequent AMD-SMI calls will use. A flag can be passed in the call if the application is only interested in a specific device type.
|
||||
|
||||
When AMD SMI is no longer used, `amdsmi_shut_down()` should be called. This provides a way to release resources that AMD-SMI may have held.
|
||||
|
||||
1) A simple "Hello World" type program that displays the temperature of detected devices would look like this:
|
||||
|
||||
.. code-block::
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
int main() {
|
||||
amdsmi_status_t ret;
|
||||
|
||||
// Init amdsmi for sockets and devices. Here we are only interested in AMD_GPUS.
|
||||
ret = amdsmi_init(AMDSMI_INIT_AMD_GPUS);
|
||||
|
||||
// Get all sockets
|
||||
uint32_t socket_count = 0;
|
||||
|
||||
// Get the socket count available in the system.
|
||||
ret = amdsmi_get_socket_handles(&socket_count, nullptr);
|
||||
|
||||
// Allocate the memory for the sockets
|
||||
std::vector<amdsmi_socket_handle> sockets(socket_count);
|
||||
// Get the socket handles in the system
|
||||
ret = amdsmi_get_socket_handles(&socket_count, &sockets[0]);
|
||||
|
||||
std::cout << "Total Socket: " << socket_count << std::endl;
|
||||
|
||||
// For each socket, get identifier and devices
|
||||
for (uint32_t i=0; i < socket_count; i++) {
|
||||
// Get Socket info
|
||||
char socket_info[128];
|
||||
ret = amdsmi_get_socket_info(sockets[i], 128, socket_info);
|
||||
std::cout << "Socket " << socket_info<< std::endl;
|
||||
|
||||
// Get the device count for the socket.
|
||||
uint32_t device_count = 0;
|
||||
ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr);
|
||||
|
||||
// Allocate the memory for the device handlers on the socket
|
||||
std::vector<amdsmi_processor_handle> processor_handles(device_count);
|
||||
// Get all devices of the socket
|
||||
ret = amdsmi_get_processor_handles(sockets[i],
|
||||
&device_count, &processor_handles[0]);
|
||||
|
||||
// For each device of the socket, get name and temperature.
|
||||
for (uint32_t j=0; j < device_count; j++) {
|
||||
// Get device type. Since the amdsmi is initialized with
|
||||
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU.
|
||||
processor_type_t processor_type;
|
||||
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
|
||||
if (processor_type != AMD_GPU) {
|
||||
std::cout << "Expect AMD_GPU device type!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get device name
|
||||
amdsmi_board_info_t board_info;
|
||||
ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info);
|
||||
std::cout << "\tdevice "
|
||||
<< j <<"\n\t\tName:" << board_info.product_name << std::endl;
|
||||
|
||||
// Get temperature
|
||||
int64_t val_i64 = 0;
|
||||
ret = amdsmi_get_temp_metric(processor_handles[j], AMDSMI_TEMPERATURE_TYPE_EDGE,
|
||||
AMDSMI_TEMP_CURRENT, &val_i64);
|
||||
std::cout << "\t\tTemperature: " << val_i64 << "C" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up resources allocated at amdsmi_init. It will invalidate sockets
|
||||
// and devices pointers
|
||||
ret = amdsmi_shut_down();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
2) A sample program that displays the power of detected cpus would look like this:
|
||||
|
||||
.. code-block::
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
amdsmi_status_t ret;
|
||||
uint32_t socket_count = 0;
|
||||
|
||||
// Initialize amdsmi for AMD CPUs
|
||||
ret = amdsmi_init(AMDSMI_INIT_AMD_CPUS);
|
||||
|
||||
ret = amdsmi_get_socket_handles(&socket_count, nullptr);
|
||||
|
||||
// Allocate the memory for the sockets
|
||||
std::vector<amdsmi_socket_handle> sockets(socket_count);
|
||||
|
||||
// Get the sockets of the system
|
||||
ret = amdsmi_get_socket_handles(&socket_count, &sockets[0]);
|
||||
|
||||
std::cout << "Total Socket: " << socket_count << std::endl;
|
||||
|
||||
// For each socket, get cpus
|
||||
for (uint32_t i = 0; i < socket_count; i++) {
|
||||
uint32_t cpu_count = 0;
|
||||
|
||||
// Set processor type as AMD_CPU
|
||||
processor_type_t processor_type = AMD_CPU;
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &cpu_count);
|
||||
|
||||
// Allocate the memory for the cpus
|
||||
std::vector<amdsmi_processor_handle> plist(cpu_count);
|
||||
|
||||
// Get the cpus for each socket
|
||||
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, &plist[0], &cpu_count);
|
||||
|
||||
for (uint32_t index = 0; index < plist.size(); index++) {
|
||||
uint32_t socket_power;
|
||||
std::cout<<"CPU "<<index<<"\t"<< std::endl;
|
||||
std::cout<<"Power (Watts): ";
|
||||
|
||||
ret = amdsmi_get_cpu_socket_power(plist[index], &socket_power);
|
||||
if(ret != AMDSMI_STATUS_SUCCESS)
|
||||
std::cout<<"Failed to get cpu socket power"<<"["<<index<<"] , Err["<<ret<<"] "<< std::endl;
|
||||
|
||||
if (!ret) {
|
||||
std::cout<<static_cast<double>(socket_power)/1000<<std::endl;
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up resources allocated at amdsmi_init
|
||||
ret = amdsmi_shut_down();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Building AMD SMI
|
||||
-----------------
|
||||
|
||||
Rebuilding Python wrapper
|
||||
==========================
|
||||
|
||||
Python wrapper (binding) is an auto-generated file `py-interface/amdsmi_wrapper.py`
|
||||
|
||||
The wrapper should be re-generated on each C++ API change by doing the following:
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./update_wrapper.sh
|
||||
|
||||
|
||||
After this command, the file in `py-interface/amdsmi_wrapper.py` will be automatically updated on each compile.
|
||||
|
||||
Note: To re-generate the Python wrapper, you must have **Docker** installed.
|
||||
|
||||
Note: Python_wrapper is NOT automatically re-generated. You must run `./update_wrapper.sh`.
|
||||
|
||||
|
||||
Additional software required for building AMD SMI
|
||||
--------------------------------------------------
|
||||
|
||||
The following components are required to build the library.
|
||||
|
||||
.. Note:: The software versions listed are what was used in development. Earlier versions are not guaranteed to work.
|
||||
|
||||
* CMake (v3.14.0) - `python3 -m pip install cmake`
|
||||
* g++ (5.4.0)
|
||||
|
||||
The following components are required to build the AMD SMI Python package:
|
||||
|
||||
* Python (3.6.8 or above)
|
||||
* virtualenv - `python3 -m pip install virtualenv`
|
||||
|
||||
The following tools are required to build the latest documentation:
|
||||
|
||||
* Doxygen (1.8.11)
|
||||
* Latex (pdfTeX 3.14159265-2.6-1.40.16)
|
||||
|
||||
The source code for AMD SMI is available on Github.
|
||||
|
||||
After the AMD SMI library git repository is cloned to a local Linux machine, the default location for the library and headers is /opt/rocm.
|
||||
|
||||
.. Note:: Before installation, the old ROCm directories must be deleted:
|
||||
|
||||
* /opt/rocm
|
||||
* /opt/rocm-{number}
|
||||
|
||||
Building the library is achieved by following the typical CMake build sequence (run as root user or use 'sudo' before the 'make install' command), specifically:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake ..
|
||||
make -j $(nproc)
|
||||
make install
|
||||
|
||||
|
||||
The built library will appear in the `build` folder.
|
||||
|
||||
In addition to the preceding steps, use the following instructions to build the rpm and deb packages:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make package
|
||||
|
||||
Building tests
|
||||
-------------------
|
||||
|
||||
To verify the build and capability of AMD SMI on your system and see an example of how AMD SMI can be used, you may build and run the tests available in the repo. To build the tests, follow these steps:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DBUILD_TESTS=ON ..
|
||||
make -j $(nproc)
|
||||
|
||||
|
||||
Running tests
|
||||
--------------
|
||||
|
||||
Execute the program `amdsmitst` that is built from the steps above to run the test.
|
||||
|
||||
Path to the program `amdsmitst`: `build/tests/amd_smi_test/`
|
||||
@@ -0,0 +1,82 @@
|
||||
---
|
||||
myst:
|
||||
html_meta:
|
||||
"description lang=en": "AMD SMI documentation and API reference."
|
||||
"keywords": "amdsmi, lib, cli, system, management, interface, amdgpu, admin, sys"
|
||||
---
|
||||
|
||||
# AMD SMI documentation
|
||||
|
||||
The AMD System Management Interface (AMD SMI) library offers a unified tool for
|
||||
managing and monitoring GPUs, particularly in high-performance computing
|
||||
environments. It provides a user-space interface that allows applications to
|
||||
control GPU operations, monitor performance, and retrieve information about the
|
||||
system's drivers and GPUs.
|
||||
|
||||
Find the source code at <https://github.com/ROCm/amdsmi>.
|
||||
|
||||
```{note}
|
||||
AMD SMI is the successor to <https://github.com/ROCm/rocm_smi_lib>.
|
||||
```
|
||||
|
||||
::::{grid} 2
|
||||
:gutter: 3
|
||||
|
||||
:::{grid-item-card} Install
|
||||
* [Library and CLI tool installation](./install/install.md)
|
||||
* [Build from source](./install/build.md)
|
||||
:::
|
||||
|
||||
:::{grid-item-card} How to
|
||||
* [C++ library usage](./how-to/amdsmi-cpp-lib.md)
|
||||
* [Python library usage](./how-to/amdsmi-py-lib.md)
|
||||
* [CLI tool usage](./how-to/amdsmi-cli-tool.md)
|
||||
:::
|
||||
|
||||
:::{grid-item-card} Reference
|
||||
* [C++ API](./reference/amdsmi-cpp-api.md)
|
||||
* [Modules](../doxygen/docBin/html/modules)
|
||||
* [Files](../doxygen/docBin/html/files)
|
||||
* [Globals](../doxygen/docBin/html/globals)
|
||||
* [Data structures](../doxygen/docBin/html/annotated)
|
||||
* [Data fields](../doxygen/docBin/html/functions_data_fields)
|
||||
* [Python API](./reference/amdsmi-py-api.md)
|
||||
:::
|
||||
|
||||
:::{grid-item-card} Tutorials
|
||||
* [AMD SMI examples (GitHub)](https://github.com/ROCm/amdsmi/tree/amd-staging/example)
|
||||
* [ROCm SMI examples (GitHub)](https://github.com/ROCm/rocm_smi_lib/tree/amd-staging/example)
|
||||
:::
|
||||
::::
|
||||
|
||||
To contribute to the documentation, refer to
|
||||
{doc}`Contributing to ROCm <rocm:contribute/contributing>`.
|
||||
|
||||
Find ROCm licensing information on the
|
||||
{doc}`Licensing <rocm:about/license>` page.
|
||||
|
||||
<style>
|
||||
#disclaimer {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="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.
|
||||
|
||||
AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced
|
||||
Micro Devices, Inc. Other product names used in this publication are for
|
||||
identification purposes only and may be trademarks of their respective
|
||||
companies.
|
||||
|
||||
Copyright (c) 2014-2024 Advanced Micro Devices, Inc. All rights reserved.
|
||||
</div>
|
||||
@@ -1,50 +0,0 @@
|
||||
.. meta::
|
||||
:description: AMDSMI documentation and API reference library
|
||||
:keywords: amdsmi, ROCm, API, documentation
|
||||
|
||||
********************************************************************
|
||||
AMD SMI documentation
|
||||
********************************************************************
|
||||
|
||||
The AMD System Management Interface (SMI) Library, or AMD SMI library, is a C library for Linux that provides a user space interface for applications to monitor and control AMD devices.
|
||||
|
||||
You can access the AMD SMI code on the `GitHub repository <https://github.com/ROCm/amdsmi>`_.
|
||||
|
||||
.. Note::
|
||||
|
||||
This project is a successor to `rocm_smi_lib. <https://github.com/RadeonOpenCompute/rocm_smi_lib>`_
|
||||
|
||||
.. grid:: 2
|
||||
:gutter: 3
|
||||
|
||||
.. grid-item-card:: Install
|
||||
|
||||
* :doc:`AMD SMI installation <./install/install>`
|
||||
|
||||
.. grid-item-card:: API reference
|
||||
|
||||
* :doc:`Files <../doxygen/docBin/html/files>`
|
||||
* :doc:`Globals <../doxygen/docBin/html/globals>`
|
||||
* :doc:`Data structures <../doxygen/docBin/html/annotated>`
|
||||
* :doc:`Modules <../doxygen/docBin/html/modules>`
|
||||
* :doc:`Data fields <../doxygen/docBin/html/functions_data_fields>`
|
||||
|
||||
.. grid-item-card:: How to
|
||||
|
||||
* :doc:`Use AMD SMI for C++ library <how-to/using-amdsmi-for-C++>`
|
||||
* :doc:`Use AMD SMI for Python library <how-to/using-amdsmi-for-python>`
|
||||
* :doc:`Use AMD SMI CLI tool <how-to/using-AMD-SMI-CLI-tool>`
|
||||
|
||||
|
||||
.. grid-item-card:: Tutorials
|
||||
|
||||
* `AMD SMI GitHub samples <https://github.com/ROCm/amdsmi/tree/develop/example>`_
|
||||
* `ROCm SMI Github samples <https://github.com/ROCm/rocm_smi_lib/tree/develop/docs>`_
|
||||
|
||||
|
||||
To contribute to the documentation, refer to
|
||||
`Contributing to ROCm <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_.
|
||||
|
||||
You can find licensing information on the
|
||||
`Licensing <https://rocm.docs.amd.com/en/latest/about/license.html>`_ page.
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
myst:
|
||||
html_meta:
|
||||
"description lang=en": "How to build AMD SMI from source."
|
||||
"keywords": "system, management, interface, contribute, contributing, ROCm, develop, testing"
|
||||
---
|
||||
|
||||
# Building AMD SMI
|
||||
|
||||
This section describes the prerequisites and steps to build AMD SMI from source.
|
||||
|
||||
(build_reqs)=
|
||||
## Required software
|
||||
|
||||
To build the AMD SMI library, the following components are required. Note that
|
||||
the software versions specified were used during development; earlier
|
||||
versions are not guaranteed to work.
|
||||
|
||||
* CMake (v3.14.0 or later) -- `python3 -m pip install cmake`
|
||||
* g++ (v5.4.0 or later)
|
||||
|
||||
In order to build the AMD SMI Python package, the following components are
|
||||
required:
|
||||
|
||||
* Python (3.6.8 or later)
|
||||
* prerequisite modules:
|
||||
* python3-wheel
|
||||
* python3-setuptools
|
||||
* virtualenv -- `python3 -m pip install virtualenv`
|
||||
|
||||
## Build steps
|
||||
|
||||
1. Clone the AMD SMI repository to your local Linux machine.
|
||||
|
||||
```shell
|
||||
git clone https://github.com/ROCm/amdsmi.git
|
||||
```
|
||||
|
||||
2. The default installation location for the library and headers is `/opt/rocm`.
|
||||
Before installation, any old ROCm directories should be deleted:
|
||||
|
||||
* `/opt/rocm`
|
||||
* `/opt/rocm-<version_number>`
|
||||
|
||||
3. Build the library by following the typical CMake build sequence (run as root
|
||||
user or use `sudo` before `make install` command); for instance:
|
||||
|
||||
```bash
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake ..
|
||||
make -j $(nproc)
|
||||
make install
|
||||
```
|
||||
|
||||
The built library is located in the `build/` directory. To build the `rpm`
|
||||
and `deb` packages use the following command:
|
||||
|
||||
```bash
|
||||
make package
|
||||
```
|
||||
|
||||
(rebuild_py_wrapper)=
|
||||
## Rebuild the Python wrapper
|
||||
|
||||
The Python wrapper for the AMD SMI library is found in the [auto-generated
|
||||
file](#py_lib_fs) `py-interface/amdsmi_wrapper.py`. It is essential to
|
||||
regenerate this wrapper whenever there are changes to the C++ API. It is not
|
||||
regenerated automatically.
|
||||
|
||||
To regenerate the wrapper, use the following command.
|
||||
|
||||
```shell
|
||||
./update_wrapper.sh
|
||||
```
|
||||
|
||||
After this command, the file in `py-interface/amdsmi_wrapper.py` will be updated
|
||||
on compile.
|
||||
|
||||
```{note}
|
||||
You need Docker installed on your system to regenerate the Python wrapper.
|
||||
```
|
||||
|
||||
(build_tests)=
|
||||
## Build the tests
|
||||
|
||||
To verify the build and capabilities of AMD SMI on your system, as well as to
|
||||
see practical examples of its usage, you can build and run the available [tests
|
||||
in the repository](https://github.com/ROCm/amdsmi/tree/amd-staging/tests).
|
||||
Follow these steps to build the tests:
|
||||
|
||||
```bash
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DBUILD_TESTS=ON ..
|
||||
make -j $(nproc)
|
||||
```
|
||||
|
||||
(run_tests)=
|
||||
### Run the tests
|
||||
|
||||
Once the tests are [built](#build_tests), you can run them by executing the
|
||||
`amdsmitst` program. The executable can be found at `build/tests/amd_smi_test/`.
|
||||
|
||||
(build_docs)=
|
||||
## Build the docs
|
||||
|
||||
To build the documentation, follow the instructions at [Building
|
||||
documentation](https://rocm.docs.amd.com/en/latest/contribute/building.html).
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
---
|
||||
myst:
|
||||
html_meta:
|
||||
"description lang=en": "How to install AMD SMI libraries and CLI tool."
|
||||
"keywords": "system, management, interface, cpu, gpu, hsmp, versions"
|
||||
---
|
||||
|
||||
# AMD SMI library and CLI tool
|
||||
|
||||
This section describes how to install the AMD SMI library, Python interface,
|
||||
and command line tool either as part of the
|
||||
{doc}`ROCm software stack <rocm:what-is-rocm>` -- or manually.
|
||||
|
||||
(install_reqs)=
|
||||
## Requirements
|
||||
The following are required to install and use the AMD SMI libraries and CLI
|
||||
tool.
|
||||
|
||||
* Python 3.6.8+ (64-bit)
|
||||
* `amdgpu` driver must be loaded for [`amdsmi_init()`](#cpp_hello_amdsmi) to
|
||||
work.
|
||||
|
||||
### Supported platforms
|
||||
|
||||
At initial release, the AMD SMI library will support Linux bare metal and Linux
|
||||
virtual machine guest for AMD GPUs. In a future release, the library will be
|
||||
extended to support AMD EPYC™ CPUs.
|
||||
|
||||
AMD SMI library can run on AMD ROCm supported platforms, refer to
|
||||
{doc}`System requirements (Linux) <rocm-install-on-linux:reference/system-requirements>`
|
||||
for more information.
|
||||
<!--https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html-->
|
||||
|
||||
To run the AMD SMI library, the `amdgpu` driver and the `amd_hsmp` driver need
|
||||
to be installed. Optionally, `libdrm` can be installed to query firmware
|
||||
information and hardware IPs.
|
||||
|
||||
(install_amdgpu_rocm)=
|
||||
## Install amdgpu driver and AMD SMI with ROCm
|
||||
|
||||
<!--https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/amdgpu-install.html-->
|
||||
1. Get the `amdgpu-install` installer following the instructions for your
|
||||
Linux distribution at {doc}`rocm-install-on-linux:install/amdgpu-install`.
|
||||
|
||||
See the following example; your desired ROCm release and install URL may be
|
||||
different.
|
||||
|
||||
```shell
|
||||
sudo apt update
|
||||
wget https://repo.radeon.com/amdgpu-install/6.2.2/ubuntu/noble/amdgpu-install_6.2.60202-1_all.deb
|
||||
sudo apt install ./amdgpu-install_6.2.60202-1_all.deb
|
||||
```
|
||||
|
||||
2. Use `amdgpu-install` to install the `amdgpu` driver and ROCm packages with
|
||||
AMD SMI included.
|
||||
|
||||
``` shell
|
||||
sudo amdgpu-install --usecase=rocm
|
||||
```
|
||||
|
||||
The `amdgpu-install --usecase=rocm` option triggers both an `amdgpu` driver
|
||||
update and AMD SMI packages to be installed on your device.
|
||||
|
||||
3. Verify your installation.
|
||||
|
||||
```shell
|
||||
amd-smi --help
|
||||
```
|
||||
|
||||
(install_without_rocm)=
|
||||
## Install AMD SMI without ROCm
|
||||
|
||||
The following are example steps to install the AMD SMI libraries and CLI tool on
|
||||
Ubuntu 22.04.
|
||||
|
||||
1. Install the library.
|
||||
|
||||
```shell
|
||||
sudo apt install amd-smi-lib
|
||||
```
|
||||
|
||||
2. Add the installation directory to your PATH. If installed with ROCm, ignore
|
||||
this step.
|
||||
|
||||
```shell
|
||||
export PATH="${PATH:+${PATH}:}~/opt/rocm/bin"
|
||||
```
|
||||
|
||||
3. Verify your installation.
|
||||
|
||||
```shell
|
||||
amd-smi --help
|
||||
```
|
||||
|
||||
## Optionally enable CLI autocompletion
|
||||
|
||||
The `amd-smi` CLI application supports autocompletion. If `argcomplete` is not
|
||||
installed and enabled already, do so using the following commands.
|
||||
|
||||
```shell
|
||||
python3 -m pip install argcomplete
|
||||
activate-global-python-argcomplete --user
|
||||
# restart shell to enable
|
||||
```
|
||||
|
||||
(install-manual-py-lib)=
|
||||
## Install the Python library for multiple ROCm instances
|
||||
|
||||
If {doc}`multiple ROCm versions are installed
|
||||
<rocm-install-on-linux:install/native-install/multi-version-install>` and you
|
||||
are not using `pyenv`, uninstall previous versions of AMD SMI before installing
|
||||
the desired version from your ROCm instance.
|
||||
|
||||
### Manually install the Python library
|
||||
|
||||
The following are example AMD SMI installation steps on Ubuntu 22.04 without
|
||||
ROCm.
|
||||
|
||||
1. Remove previous AMD SMI installation.
|
||||
|
||||
```shell
|
||||
python3 -m pip list | grep amd
|
||||
python3 -m pip uninstall amdsmi
|
||||
```
|
||||
|
||||
2. Install the AMD SMI Python library from your target ROCm instance.
|
||||
|
||||
```shell
|
||||
apt install amd-smi-lib
|
||||
cd /opt/rocm/share/amd_smi
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install --user .
|
||||
```
|
||||
|
||||
3. You should now have the AMD SMI Python library in your Python path:
|
||||
|
||||
```shell-session
|
||||
~$ 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
|
||||
>>>
|
||||
```
|
||||
@@ -1,147 +0,0 @@
|
||||
.. meta::
|
||||
:description: Install AMD SMI
|
||||
:keywords: install, SMI, AMD, ROCm
|
||||
|
||||
********************************************************************
|
||||
Installation
|
||||
********************************************************************
|
||||
|
||||
AMD System Management Interface (AMD SMI) library
|
||||
-------------------------------------------------
|
||||
|
||||
The AMD System Management Interface Library (AMD SMI library) is a C library for Linux that provides a user space interface for applications to monitor and control AMD devices.
|
||||
|
||||
.. Note::
|
||||
|
||||
This project is a successor to `rocm_smi_lib. <https://github.com/RadeonOpenCompute/rocm_smi_lib>`_
|
||||
|
||||
Supported platforms
|
||||
=====================
|
||||
In its initial release, the AMD SMI library supports Linux bare metal and Linux virtual machine guest for AMD GPUs. In a future release, the library will extend to support AMD EPYC™ CPUs.
|
||||
|
||||
The AMD SMI library can run on AMD ROCm-supported platforms. Refer to `System requirements - Linux <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html>`_ for more information.
|
||||
|
||||
To run the AMD SMI library, the `amdgpu` driver and the `hsmp` driver must be installed. Optionally, `libdrm` can be installed to query firmware information and hardware IPs.
|
||||
|
||||
|
||||
CLI tool and libraries installation
|
||||
------------------------------------
|
||||
|
||||
Requirements
|
||||
=============
|
||||
|
||||
* Python 3.6.8+ 64-bit
|
||||
* amdgpu driver must be loaded for `amdsmi_init()` to pass
|
||||
|
||||
Installation steps
|
||||
-------------------
|
||||
|
||||
1. Install amdgpu using ROCm.
|
||||
|
||||
2. Install amdgpu driver. See the following example. Note that your release and link may differ. The `amdgpu-install --usecase=rocm` triggers both the amdgpu driver update and AMD SMI packages to be installed on your device.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
sudo apt update
|
||||
|
||||
wget https://repo.radeon.com/amdgpu-install/6.0.2/ubuntu/jammy/amdgpu-install_6.0.60002-1_all.deb
|
||||
|
||||
sudo apt install ./amdgpu-install_6.0.60002-1_all.deb
|
||||
|
||||
sudo amdgpu-install --usecase=rocm
|
||||
|
||||
amd-smi --help
|
||||
|
||||
3. Install an example for Ubuntu 22.04 (without ROCm).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
apt install amd-smi-lib
|
||||
|
||||
# if installed with rocm ignore the export
|
||||
|
||||
export PATH="${PATH:+${PATH}:}~/opt/rocm/bin"
|
||||
|
||||
amd-smi --help
|
||||
|
||||
|
||||
Optional autocompletion
|
||||
------------------------
|
||||
|
||||
The `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:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
python3 -m pip install argcomplete
|
||||
|
||||
activate-global-python-argcomplete --user
|
||||
|
||||
# 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 latest version you want directly from your ROCm instance.
|
||||
|
||||
Python library install example for Ubuntu 22.04
|
||||
=================================================
|
||||
|
||||
1. Remove any existing AMD SMI installation:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python3 -m pip list | grep amd
|
||||
|
||||
python3 -m pip uninstall amdsmi
|
||||
|
||||
|
||||
2. Install Python library from your target ROCm instance:
|
||||
|
||||
.. code:: 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 AMD SMI Python library in your Python path:
|
||||
|
||||
|
||||
.. code:: bash
|
||||
|
||||
~$ python3
|
||||
|
||||
Python 3.8.10 (default, May 26 2023, 14:05:08)
|
||||
|
||||
[GCC 9.4.0] on linux
|
||||
|
||||
3. Type "help", "copyright", "credits" or "license" for more information
|
||||
|
||||
.. code:: bash
|
||||
|
||||
import amdsmi
|
||||
|
||||
|
||||
Sphinx documentation
|
||||
=====================
|
||||
|
||||
Run the following commands to build the documentation locally:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd docs
|
||||
|
||||
python3 -m pip install -r sphinx/requirements.txt
|
||||
|
||||
python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
|
||||
|
||||
|
||||
The output is available in `docs/_build/html`.
|
||||
|
||||
For additional details, see `Contribute to ROCm documentation <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_.
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
=======
|
||||
.. meta::
|
||||
:description: Review the AMD SMI license agreement.
|
||||
:keywords: amdsmi
|
||||
|
||||
*******
|
||||
License
|
||||
=======
|
||||
*******
|
||||
|
||||
.. include:: ../LICENSE
|
||||
:literal:
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
```{include} ../py-interface/README.md
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
myst:
|
||||
html_meta:
|
||||
"description lang=en": "Explore the AMD SMI C++ API."
|
||||
"keywords": "api, smi, lib, cpp, header, system, management, interface, ROCm"
|
||||
---
|
||||
|
||||
# AMD SMI C++ API reference
|
||||
|
||||
This section provides comprehensive documentation for the AMD SMI C++ API.
|
||||
Explore these sections to understand the full scope of available
|
||||
functionalities and how to implement them in your applications.
|
||||
|
||||
- {doc}`Modules <../doxygen/docBin/html/modules>`
|
||||
|
||||
- {doc}`Files <../doxygen/docBin/html/files>`
|
||||
|
||||
- {doc}`Globals <../doxygen/docBin/html/globals>`
|
||||
|
||||
- {doc}`Data structures <../doxygen/docBin/html/annotated>`
|
||||
|
||||
+61
-76
@@ -1,73 +1,20 @@
|
||||
# AMD SMI Python Library
|
||||
---
|
||||
myst:
|
||||
html_meta:
|
||||
"description lang=en": "Explore the AMD SMI Python API."
|
||||
"keywords": "api, smi, lib, py, system, management, interface, ROCm"
|
||||
---
|
||||
|
||||
## Requirements
|
||||
# AMD SMI Python API reference
|
||||
|
||||
* Python 3.6+ 64-bit
|
||||
* Driver must be loaded for amdsmi_init() to pass
|
||||
The AMD SMI Python interface provides a convenient way to interact with AMD
|
||||
hardware through a simple and accessible API. Compatible with Python 3.6 and
|
||||
higher, this library requires the AMD driver to be loaded for initialization --
|
||||
review the [prerequisites](#install_reqs).
|
||||
|
||||
## Overview
|
||||
|
||||
### Folder structure
|
||||
|
||||
File Name | Note
|
||||
---|---
|
||||
`__init__.py` | Python package initialization file
|
||||
`amdsmi_interface.py` | Amdsmi library python interface
|
||||
`amdsmi_wrapper.py` | Python wrapper around amdsmi binary
|
||||
`amdsmi_exception.py` | Amdsmi exceptions python file
|
||||
`README.md` | Documentation
|
||||
|
||||
### Usage
|
||||
|
||||
`amdsmi` folder should be copied and placed next to importing script. It should be imported as:
|
||||
|
||||
```python
|
||||
from amdsmi import *
|
||||
|
||||
try:
|
||||
amdsmi_init()
|
||||
|
||||
# amdsmi calls ...
|
||||
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
finally:
|
||||
try:
|
||||
amdsmi_shut_down()
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
To initialize amdsmi lib, amdsmi_init() must be called before all other calls to amdsmi lib.
|
||||
|
||||
To close connection to driver, amdsmi_shut_down() must be the last call.
|
||||
|
||||
### Exceptions
|
||||
|
||||
All exceptions are in `amdsmi_exception.py` file.
|
||||
Exceptions that can be thrown are:
|
||||
|
||||
* `AmdSmiException`: base amdsmi exception class
|
||||
* `AmdSmiLibraryException`: derives base `AmdSmiException` class and represents errors that can occur in amdsmi-lib.
|
||||
When this exception is thrown, `err_code` and `err_info` are set. `err_code` is an integer that corresponds to errors that can occur
|
||||
in amdsmi-lib and `err_info` is a string that explains the error that occurred.
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
num_of_GPUs = len(amdsmi_get_processor_handles())
|
||||
if num_of_GPUs == 0:
|
||||
print("No GPUs on machine")
|
||||
except AmdSmiException as e:
|
||||
print("Error code: {}".format(e.err_code))
|
||||
if e.err_code == amdsmi_wrapper.AMDSMI_STATUS_RETRY:
|
||||
print("Error info: {}".format(e.err_info))
|
||||
```
|
||||
|
||||
* `AmdSmiRetryException` : Derives `AmdSmiLibraryException` class and signals device is busy and call should be retried.
|
||||
* `AmdSmiTimeoutException` : Derives `AmdSmiLibraryException` class and represents that call had timed out.
|
||||
* `AmdSmiParameterException`: Derives base `AmdSmiException` class and represents errors related to invaild parameters passed to functions. When this exception is thrown, err_msg is set and it explains what is the actual and expected type of the parameters.
|
||||
* `AmdSmiBdfFormatException`: Derives base `AmdSmiException` class and represents invalid bdf format.
|
||||
This section provides comprehensive documentation for the AMD SMI Python API.
|
||||
Explore these sections to understand the full scope of available functionalities
|
||||
and how to implement them in your applications.
|
||||
|
||||
## API
|
||||
|
||||
@@ -532,17 +479,17 @@ Input parameters:
|
||||
Output: List of Dictionaries containing cache information following the schema below:
|
||||
Schema:
|
||||
|
||||
```JSON
|
||||
```json
|
||||
{
|
||||
cache_properties:
|
||||
"cache_properties":
|
||||
{
|
||||
"type" : "array",
|
||||
"items" : {"type" : "string"}
|
||||
},
|
||||
cache_size: {"type" : "number"},
|
||||
cache_level: {"type" : "number"},
|
||||
max_num_cu_shared: {"type" : "number"},
|
||||
num_cache_instance: {"type" : "number"}
|
||||
"cache_size": {"type" : "number"},
|
||||
"cache_level": {"type" : "number"},
|
||||
"max_num_cu_shared": {"type" : "number"},
|
||||
"num_cache_instance": {"type" : "number"}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -2102,6 +2049,7 @@ except AmdSmiException as e:
|
||||
```
|
||||
|
||||
### amdsmi_set_gpu_process_isolation
|
||||
|
||||
Description: Enable/disable the system Process Isolation for the given device handle.
|
||||
|
||||
Input parameters:
|
||||
@@ -2132,6 +2080,7 @@ except AmdSmiException as e:
|
||||
```
|
||||
|
||||
### amdsmi_clean_gpu_local_data
|
||||
|
||||
Description: Clear the SRAM data of the given device. This can be called between user logins to prevent information leak.
|
||||
|
||||
Input parameters:
|
||||
@@ -2160,7 +2109,6 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
|
||||
### amdsmi_get_gpu_overdrive_level
|
||||
|
||||
Description: Get the overdrive percent associated with the device with provided
|
||||
@@ -3767,6 +3715,44 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_gpu_accelerator_partition_profile
|
||||
|
||||
**Note: CURRENTLY HARDCODED TO RETURN EMPTY VALUES**
|
||||
|
||||
Description: Get partition information for target device
|
||||
|
||||
Input parameters:
|
||||
|
||||
* `processor_handle` the device handle
|
||||
|
||||
Output: Dictionary with fields:
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`partition_id` | ID of the partition on the GPU provided
|
||||
`partition_profile` | Dict containing partition data (TBD)
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_accelerator_partition_profile` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
devices = amdsmi_get_processor_handles()
|
||||
if len(devices) == 0:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
partition_id = amdsmi_get_gpu_accelerator_partition_profile(device)["partition_id"]
|
||||
print(partition_id)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_xgmi_info
|
||||
|
||||
Description: Returns XGMI information for the GPU.
|
||||
@@ -3839,8 +3825,7 @@ try:
|
||||
else:
|
||||
print(amdsmi_get_gpu_device_uuid(devices[0]))
|
||||
|
||||
nearest_gpus = amdsmi_topology_nearest_t()
|
||||
nearest_gpus = amdsmi_get_link_topology_nearest(devices[0], AmdSmiLinkType(2))
|
||||
nearest_gpus = amdsmi_get_link_topology_nearest(devices[0], AmdSmiLinkType.AMDSMI_LINK_TYPE_PCIE)
|
||||
if (nearest_gpus['count']) == 0:
|
||||
print("No nearest GPUs found on machine")
|
||||
else:
|
||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -1,14 +0,0 @@
|
||||
.. meta::
|
||||
:description: Install AMD SMI
|
||||
:keywords: install, SMI, AMD, ROCm
|
||||
|
||||
******************
|
||||
API reference
|
||||
******************
|
||||
|
||||
This section provides technical descriptions and important information about the different AMD SMI and library components.
|
||||
|
||||
* {doc}`Library <../doxygen/docBin/html/files>`
|
||||
* {doc}`Functions <../doxygen/docBin/html/globals>`
|
||||
* {doc}`Data structures <../doxygen/docBin/html/annotated>`
|
||||
|
||||
@@ -1,49 +1,51 @@
|
||||
defaults:
|
||||
numbered: false
|
||||
root: index
|
||||
subtrees:
|
||||
- entries:
|
||||
- file: what-is-AMDSMI.rst
|
||||
title: What is AMD SMI?
|
||||
|
||||
subtrees:
|
||||
- caption: Install
|
||||
entries:
|
||||
- file: install/install.rst
|
||||
title: AMD SMI installation
|
||||
|
||||
|
||||
- file: install/install.md
|
||||
title: Library and CLI tool installation
|
||||
- file: install/build.md
|
||||
title: Build from source
|
||||
|
||||
- caption: How to
|
||||
entries:
|
||||
- file: how-to/using-amdsmi-for-C++.rst
|
||||
title: Use AMD SMI for C++ library
|
||||
- file: how-to/using-amdsmi-for-python.md
|
||||
title: Use AMD SMI for Python library
|
||||
- file: how-to/using-AMD-SMI-CLI-tool.md
|
||||
title: Use AMD SMI CLI tool
|
||||
|
||||
- caption: API reference
|
||||
- file: how-to/amdsmi-cpp-lib.md
|
||||
title: C++ library usage
|
||||
- file: how-to/amdsmi-py-lib.md
|
||||
title: Python library usage
|
||||
- file: how-to/amdsmi-cli-tool.md
|
||||
title: CLI tool usage
|
||||
|
||||
- caption: Reference
|
||||
entries:
|
||||
- file: reference/amdsmi-cpp-api.md
|
||||
title: C++ API
|
||||
entries:
|
||||
- file: doxygen/docBin/html/modules
|
||||
title: Modules
|
||||
- file: doxygen/docBin/html/files
|
||||
title: Files
|
||||
- file: doxygen/docBin/html/globals
|
||||
title: Globals
|
||||
- file: doxygen/docBin/html/annotated
|
||||
title: Data structures
|
||||
- file: doxygen/docBin/html/modules
|
||||
title: Modules
|
||||
- file: doxygen/docBin/html/functions_data_fields
|
||||
title: Data fields
|
||||
- file: reference/amdsmi-py-api.md
|
||||
title: Python API
|
||||
- file: reference/changelog.md
|
||||
title: Changelog
|
||||
|
||||
|
||||
|
||||
- caption: Tutorials
|
||||
entries:
|
||||
- url: https://github.com/ROCm/amdsmi/tree/amd-staging/example
|
||||
title: AMD SMI GitHub samples
|
||||
- url: https://github.com/ROCm/rocm_smi_lib/tree/amd-staging/docs
|
||||
title: ROCm SMI lib GitHub samples
|
||||
|
||||
- url: https://github.com/ROCm/amdsmi/tree/amd-staging/example
|
||||
title: AMD SMI examples (GitHub)
|
||||
- url: https://github.com/ROCm/rocm_smi_lib/tree/amd-staging/example
|
||||
title: ROCm SMI lib examples (GitHub)
|
||||
|
||||
- caption: About
|
||||
entries:
|
||||
- file: license.md
|
||||
- file: license.md
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
rocm-docs-core[api_reference]==1.4.0
|
||||
rocm-docs-core[api_reference]==1.8.2
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#
|
||||
accessible-pygments==0.0.5
|
||||
# via pydata-sphinx-theme
|
||||
alabaster==0.7.16
|
||||
alabaster==1.0.0
|
||||
# via sphinx
|
||||
babel==2.15.0
|
||||
babel==2.16.0
|
||||
# via
|
||||
# pydata-sphinx-theme
|
||||
# sphinx
|
||||
@@ -16,9 +16,9 @@ beautifulsoup4==4.12.3
|
||||
# via pydata-sphinx-theme
|
||||
breathe==4.35.0
|
||||
# via rocm-docs-core
|
||||
certifi==2024.6.2
|
||||
certifi==2024.8.30
|
||||
# via requests
|
||||
cffi==1.16.0
|
||||
cffi==1.17.1
|
||||
# via
|
||||
# cryptography
|
||||
# pynacl
|
||||
@@ -31,7 +31,7 @@ click==8.1.7
|
||||
# sphinx-external-toc
|
||||
click-log==0.4.0
|
||||
# via doxysphinx
|
||||
cryptography==42.0.8
|
||||
cryptography==43.0.1
|
||||
# via pyjwt
|
||||
deprecated==1.2.14
|
||||
# via pygithub
|
||||
@@ -41,15 +41,15 @@ docutils==0.21.2
|
||||
# myst-parser
|
||||
# pydata-sphinx-theme
|
||||
# sphinx
|
||||
doxysphinx==3.3.8
|
||||
doxysphinx==3.3.10
|
||||
# via rocm-docs-core
|
||||
fastjsonschema==2.19.1
|
||||
fastjsonschema==2.20.0
|
||||
# via rocm-docs-core
|
||||
gitdb==4.0.11
|
||||
# via gitpython
|
||||
gitpython==3.1.43
|
||||
# via rocm-docs-core
|
||||
idna==3.7
|
||||
idna==3.10
|
||||
# via requests
|
||||
imagesize==1.4.1
|
||||
# via sphinx
|
||||
@@ -67,13 +67,13 @@ markdown-it-py==3.0.0
|
||||
# myst-parser
|
||||
markupsafe==2.1.5
|
||||
# via jinja2
|
||||
mdit-py-plugins==0.4.1
|
||||
mdit-py-plugins==0.4.2
|
||||
# via myst-parser
|
||||
mdurl==0.1.2
|
||||
# via markdown-it-py
|
||||
mpire==2.10.2
|
||||
# via doxysphinx
|
||||
myst-parser==3.0.1
|
||||
myst-parser==4.0.0
|
||||
# via rocm-docs-core
|
||||
numpy==1.26.4
|
||||
# via doxysphinx
|
||||
@@ -83,11 +83,11 @@ packaging==24.1
|
||||
# sphinx
|
||||
pycparser==2.22
|
||||
# via cffi
|
||||
pydata-sphinx-theme==0.15.3
|
||||
pydata-sphinx-theme==0.15.4
|
||||
# via
|
||||
# rocm-docs-core
|
||||
# sphinx-book-theme
|
||||
pygithub==2.3.0
|
||||
pygithub==2.4.0
|
||||
# via rocm-docs-core
|
||||
pygments==2.18.0
|
||||
# via
|
||||
@@ -97,13 +97,13 @@ pygments==2.18.0
|
||||
# sphinx
|
||||
pyjson5==1.6.6
|
||||
# via doxysphinx
|
||||
pyjwt[crypto]==2.8.0
|
||||
pyjwt[crypto]==2.9.0
|
||||
# via pygithub
|
||||
pynacl==1.5.0
|
||||
# via pygithub
|
||||
pyparsing==3.1.2
|
||||
pyparsing==3.1.4
|
||||
# via doxysphinx
|
||||
pyyaml==6.0.1
|
||||
pyyaml==6.0.2
|
||||
# via
|
||||
# myst-parser
|
||||
# rocm-docs-core
|
||||
@@ -112,15 +112,15 @@ requests==2.32.3
|
||||
# via
|
||||
# pygithub
|
||||
# sphinx
|
||||
rocm-docs-core[api-reference]==1.4.0
|
||||
rocm-docs-core[api-reference]==1.8.2
|
||||
# via -r requirements.in
|
||||
smmap==5.0.1
|
||||
# via gitdb
|
||||
snowballstemmer==2.2.0
|
||||
# via sphinx
|
||||
soupsieve==2.5
|
||||
soupsieve==2.6
|
||||
# via beautifulsoup4
|
||||
sphinx==7.3.7
|
||||
sphinx==8.0.2
|
||||
# via
|
||||
# breathe
|
||||
# myst-parser
|
||||
@@ -135,33 +135,33 @@ sphinx-book-theme==1.1.3
|
||||
# via rocm-docs-core
|
||||
sphinx-copybutton==0.5.2
|
||||
# via rocm-docs-core
|
||||
sphinx-design==0.6.0
|
||||
sphinx-design==0.6.1
|
||||
# via rocm-docs-core
|
||||
sphinx-external-toc==1.0.1
|
||||
# via rocm-docs-core
|
||||
sphinx-notfound-page==1.0.2
|
||||
sphinx-notfound-page==1.0.4
|
||||
# via rocm-docs-core
|
||||
sphinxcontrib-applehelp==1.0.8
|
||||
sphinxcontrib-applehelp==2.0.0
|
||||
# via sphinx
|
||||
sphinxcontrib-devhelp==1.0.6
|
||||
sphinxcontrib-devhelp==2.0.0
|
||||
# via sphinx
|
||||
sphinxcontrib-htmlhelp==2.0.5
|
||||
sphinxcontrib-htmlhelp==2.1.0
|
||||
# via sphinx
|
||||
sphinxcontrib-jsmath==1.0.1
|
||||
# via sphinx
|
||||
sphinxcontrib-qthelp==1.0.7
|
||||
sphinxcontrib-qthelp==2.0.0
|
||||
# via sphinx
|
||||
sphinxcontrib-serializinghtml==1.1.10
|
||||
sphinxcontrib-serializinghtml==2.0.0
|
||||
# via sphinx
|
||||
tomli==2.0.1
|
||||
tomli==2.0.2
|
||||
# via sphinx
|
||||
tqdm==4.66.4
|
||||
tqdm==4.66.5
|
||||
# via mpire
|
||||
typing-extensions==4.12.2
|
||||
# via
|
||||
# pydata-sphinx-theme
|
||||
# pygithub
|
||||
urllib3==2.2.1
|
||||
urllib3==2.2.3
|
||||
# via
|
||||
# pygithub
|
||||
# requests
|
||||
|
||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Ссылка в новой задаче
Block a user