Change-Id: I836fc341d2a3567f531ba753463e57cd4b9b6495
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Этот коммит содержится в:
Roopa Malavally
2024-04-15 10:16:39 -07:00
коммит произвёл Maisam Arif
родитель 7d999aa34c
Коммит af225a6deb
14 изменённых файлов: 6610 добавлений и 27 удалений
+1
Просмотреть файл
@@ -0,0 +1 @@
test
+4 -1
Просмотреть файл
@@ -907,8 +907,11 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = ../../README.md \
INPUT = ../reference/index.rst \
../../include/amd_smi/amdsmi.h
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Разница между файлами не показана из-за своего большого размера Загрузить разницу
+255
Просмотреть файл
@@ -0,0 +1,255 @@
.. 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], 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:
* Clang (14.0 or above)
* 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/`
Разница между файлами не показана из-за своего большого размера Загрузить разницу
-2
Просмотреть файл
@@ -1,2 +0,0 @@
```{include} ../README.md
```
+50
Просмотреть файл
@@ -0,0 +1,50 @@
.. 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.
+147
Просмотреть файл
@@ -0,0 +1,147 @@
.. 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>`_.
+14
Просмотреть файл
@@ -0,0 +1,14 @@
.. 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>`
+34
Просмотреть файл
@@ -0,0 +1,34 @@
====================
C++ Tutorials
====================
This chapter contains the ROCm SMI C++ API tutorials.
.. code-block:: c++
#include <stdint.h>
#include "rocm_smi/rocm_smi.h"
int main() {
rsmi_status_t ret;
uint32_t num_devices;
uint16_t dev_id;
// We will skip return code checks for this example, but it
// is recommended to always check this as some calls may not
// apply for some devices or ROCm releases
ret = rsmi_init(0);
ret = rsmi_num_monitor_devices(&num_devices);
for (int i=0; i < num_devices; ++i) {
ret = rsmi_dev_id_get(i, &dev_id);
// dev_id holds the device ID of device i, upon a
// successful call
}
ret = rsmi_shut_down();
return 0;
}
For more examples please check the `C++ example <https://github.com/ROCm/rocm_smi_lib/blob/develop/rocm_smi/example/rocm_smi_example.cc>`_
or `tests. <https://github.com/ROCm/rocm_smi_lib/tree/develop/tests/rocm_smi_test/functional>`_
+13
Просмотреть файл
@@ -0,0 +1,13 @@
.. meta::
:description: ROCm SMI documentation and API reference library
:keywords: SMI, ROCm, API, documentation
****************************************************
ROCm System Management Interface (ROCm SMI) library
****************************************************
The ROCm System Management Interface Library, or ROCm SMI library, is part of the ROCm software stack. It is a C library for Linux that provides a user space interface for applications to monitor and control GPU applications.
ROCm SMI Library still works in the current release, but its documentation is now integrated with AMD SMI. For information specific to ROCm SMI Library, refer to `ROCm SMI Library <https://github.com/ROCm/rocm_smi_lib/>`_
+269
Просмотреть файл
@@ -0,0 +1,269 @@
====================
Python API Reference
====================
This chapter describes the ROCm SMI Python module API.
.. default-domain:: py
.. py:currentmodule:: rocm_smi
Functions
---------
.. autofunction:: rocm_smi.driverInitialized
.. autofunction:: rocm_smi.formatJson
.. autofunction:: rocm_smi.formatCsv
.. autofunction:: rocm_smi.formatMatrixToJSON
.. autofunction:: rocm_smi.getBus
.. autofunction:: rocm_smi.getFanSpeed
.. autofunction:: rocm_smi.getGpuUse
.. autofunction:: rocm_smi.getDRMDeviceId
.. autofunction:: rocm_smi.getSubsystemId
.. autofunction:: rocm_smi.getVendor
.. autofunction:: rocm_smi.getGUID
.. autofunction:: rocm_smi.getTargetGfxVersion
.. autofunction:: rocm_smi.getNodeId
.. autofunction:: rocm_smi.getDeviceName
.. autofunction:: rocm_smi.getRev
.. autofunction:: rocm_smi.getMaxPower
.. autofunction:: rocm_smi.getMemInfo
.. autofunction:: rocm_smi.getProcessName
.. autofunction:: rocm_smi.getPerfLevel
.. autofunction:: rocm_smi.getPid
.. autofunction:: rocm_smi.getPidList
.. autofunction:: rocm_smi.getPower
.. autofunction:: rocm_smi.getRasEnablement
.. autofunction:: rocm_smi.getTemp
.. autofunction:: rocm_smi.findFirstAvailableTemp
.. autofunction:: rocm_smi.getTemperatureLabel
.. autofunction:: rocm_smi.getPowerLabel
.. autofunction:: rocm_smi.getVbiosVersion
.. autofunction:: rocm_smi.getVersion
.. autofunction:: rocm_smi.getComputePartition
.. autofunction:: rocm_smi.getMemoryPartition
.. autofunction:: rocm_smi.print2DArray
.. autofunction:: rocm_smi.printEmptyLine
.. autofunction:: rocm_smi.printErrLog
.. autofunction:: rocm_smi.printInfoLog
.. autofunction:: rocm_smi.printEventList
.. autofunction:: rocm_smi.printLog
.. autofunction:: rocm_smi.printListLog
.. autofunction:: rocm_smi.printLogSpacer
.. autofunction:: rocm_smi.printSysLog
.. autofunction:: rocm_smi.printTableLog
.. autofunction:: rocm_smi.printTableRow
.. autofunction:: rocm_smi.checkIfSecondaryDie
.. autofunction:: rocm_smi.resetClocks
.. autofunction:: rocm_smi.resetFans
.. autofunction:: rocm_smi.resetPowerOverDrive
.. autofunction:: rocm_smi.resetProfile
.. autofunction:: rocm_smi.resetXgmiErr
.. autofunction:: rocm_smi.resetPerfDeterminism
.. autofunction:: rocm_smi.resetComputePartition
.. autofunction:: rocm_smi.resetMemoryPartition
.. autofunction:: rocm_smi.setClockRange
.. autofunction:: rocm_smi.setClockExtremum
.. autofunction:: rocm_smi.setVoltageCurve
.. autofunction:: rocm_smi.setPowerPlayTableLevel
.. autofunction:: rocm_smi.setClockOverDrive
.. autofunction:: rocm_smi.setClocks
.. autofunction:: rocm_smi.setPerfDeterminism
.. autofunction:: rocm_smi.resetGpu
.. autofunction:: rocm_smi.isRasControlAvailable
.. autofunction:: rocm_smi.setRas
.. autofunction:: rocm_smi.setFanSpeed
.. autofunction:: rocm_smi.setPerformanceLevel
.. autofunction:: rocm_smi.setPowerOverDrive
.. autofunction:: rocm_smi.setProfile
.. autofunction:: rocm_smi.setComputePartition
.. autofunction:: rocm_smi.progressbar
.. autofunction:: rocm_smi.showProgressbar
.. autofunction:: rocm_smi.setMemoryPartition
.. autofunction:: rocm_smi.showVersion
.. autofunction:: rocm_smi.showAllConcise
.. autofunction:: rocm_smi.showAllConciseHw
.. autofunction:: rocm_smi.showBus
.. autofunction:: rocm_smi.showClocks
.. autofunction:: rocm_smi.showCurrentClocks
.. autofunction:: rocm_smi.showCurrentFans
.. autofunction:: rocm_smi.showCurrentTemps
.. autofunction:: rocm_smi.showFwInfo
.. autofunction:: rocm_smi.showGpusByPid
.. autofunction:: rocm_smi.getCoarseGrainUtil
.. autofunction:: rocm_smi.showGpuUse
.. autofunction:: rocm_smi.showEnergy
.. autofunction:: rocm_smi.showId
.. autofunction:: rocm_smi.showMaxPower
.. autofunction:: rocm_smi.showMemInfo
.. autofunction:: rocm_smi.showMemUse
.. autofunction:: rocm_smi.showMemVendor
.. autofunction:: rocm_smi.showOverDrive
.. autofunction:: rocm_smi.showPcieBw
.. autofunction:: rocm_smi.showPcieReplayCount
.. autofunction:: rocm_smi.showPerformanceLevel
.. autofunction:: rocm_smi.showPids
.. autofunction:: rocm_smi.showPower
.. autofunction:: rocm_smi.showPowerPlayTable
.. autofunction:: rocm_smi.showProduct
.. autofunction:: rocm_smi.showProfile
.. autofunction:: rocm_smi.showRange
.. autofunction:: rocm_smi.showRasInfo
.. autofunction:: rocm_smi.showRetiredPages
.. autofunction:: rocm_smi.showSerialNumber
.. autofunction:: rocm_smi.showUId
.. autofunction:: rocm_smi.showVbiosVersion
.. autofunction:: rocm_smi.showEvents
.. autofunction:: rocm_smi.showDriverVersion
.. autofunction:: rocm_smi.showVoltage
.. autofunction:: rocm_smi.showVoltageCurve
.. autofunction:: rocm_smi.showXgmiErr
.. autofunction:: rocm_smi.showAccessibleTopology
.. autofunction:: rocm_smi.showWeightTopology
.. autofunction:: rocm_smi.showHopsTopology
.. autofunction:: rocm_smi.showTypeTopology
.. autofunction:: rocm_smi.showNumaTopology
.. autofunction:: rocm_smi.showHwTopology
.. autofunction:: rocm_smi.showNodesBw
.. autofunction:: rocm_smi.showComputePartition
.. autofunction:: rocm_smi.showMemoryPartition
.. autofunction:: rocm_smi.checkAmdGpus
.. autofunction:: rocm_smi.component_str
.. autofunction:: rocm_smi.confirmOutOfSpecWarning
.. autofunction:: rocm_smi.doesDeviceExist
.. autofunction:: rocm_smi.initializeRsmi
.. autofunction:: rocm_smi.isAmdDevice
.. autofunction:: rocm_smi.listDevices
.. autofunction:: rocm_smi.load
.. autofunction:: rocm_smi.padHexValue
.. autofunction:: rocm_smi.profileString
.. autofunction:: rocm_smi.relaunchAsSudo
.. autofunction:: rocm_smi.rsmi_ret_ok
.. autofunction:: rocm_smi.save
+29
Просмотреть файл
@@ -0,0 +1,29 @@
====================
Python Tutorials
====================
This chapter is the rocm_smi Python api tutorials.
.. code-block:: python
import sys
sys.path.append("/opt/rocm/libexec/rocm_smi/")
try:
import rocm_smi
except ImportError:
raise ImportError("Could not import /opt/rocm/libexec/rocm_smi/rocm_smi.py")
class prof_utils:
def __init__(self, mode) -> None:
rocm_smi.initializeRsmi()
def getPower(self, device):
return rocm_smi.getPower(device)
def listDevices(self):
return rocm_smi.listDevices()
def getMemInfo(self, device):
(memUsed, memTotal) = rocm_smi.getMemInfo(device, "vram")
return round(float(memUsed)/float(memTotal) * 100, 2)
+47 -24
Просмотреть файл
@@ -1,26 +1,49 @@
# Anywhere {branch} is used, the branch name will be substituted.
# These comments will also be removed.
defaults:
numbered: False
maxdepth: 6
numbered: false
root: index
subtrees:
- caption: AMD SMI APIs
entries:
- file: doxygen/docBin/html/index
title: C
- file: py-interface_readme_link
title: Python
- caption: CLI Tools
entries:
- file: amdsmi_cli_readme_link
title: Python CLI Tool
- file: amdsmi_release_notes_link
title: Python CLI Release Notes
- caption: Changelog
entries:
- file: amdsmi_changelog_link
title: AMD-SMI Changelog
- caption: About
entries:
- file: license
subtrees:
- entries:
- file: what-is-AMDSMI.rst
title: What is AMD SMI?
- caption: Install
entries:
- file: install/install.rst
title: AMD SMI installation
- 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
entries:
- 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
- caption: Tutorials
entries:
- url: https://github.com/ROCm/amdsmi/tree/develop/example
title: AMD SMI GitHub samples
- url: https://github.com/ROCm/rocm_smi_lib/tree/develop/docs
title: ROCm SMI lib GitHub samples
- caption: About
entries:
- file: license.md