Run pre-commit's whitespace related hooks on projects/rocm-smi-lib (#2117)
* Run pre-commit's whitespace related hooks on projects/rocm-smi-lib In order for pre-commit to be useful, everything needs to meet a common baseline. Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org> * Added Changelog Spaces for formatting Signed-off-by: Maisam Arif <Maisam.Arif@amd.com> --------- Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Maisam Arif <Maisam.Arif@amd.com> Co-authored-by: Maisam Arif <Maisam.Arif@amd.com>
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Contributing to ROCm SMI #
|
||||
|
||||
We welcome contributions to ROCm SMI.
|
||||
We welcome contributions to ROCm SMI.
|
||||
Please follow these details to help ensure your contributions will be successfully accepted.
|
||||
|
||||
## Issue Discussion ##
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
name: ROCm CI Caller
|
||||
on:
|
||||
pull_request:
|
||||
branches: [amd-staging, release/rocm-rel-*, amd-mainline]
|
||||
types: [opened, reopened, synchronize]
|
||||
push:
|
||||
branches: [amd-mainline]
|
||||
workflow_dispatch:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
call-workflow:
|
||||
if: github.event_name != 'issue_comment' ||(github.event_name == 'issue_comment' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '!verify') || startsWith(github.event.comment.body, '!verify release') || startsWith(github.event.comment.body, '!verify retest')))
|
||||
name: ROCm CI Caller
|
||||
on:
|
||||
pull_request:
|
||||
branches: [amd-staging, release/rocm-rel-*, amd-mainline]
|
||||
types: [opened, reopened, synchronize]
|
||||
push:
|
||||
branches: [amd-mainline]
|
||||
workflow_dispatch:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
call-workflow:
|
||||
if: github.event_name != 'issue_comment' ||(github.event_name == 'issue_comment' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '!verify') || startsWith(github.event.comment.body, '!verify release') || startsWith(github.event.comment.body, '!verify retest')))
|
||||
uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline
|
||||
secrets: inherit
|
||||
with:
|
||||
input_sha: ${{github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.sha) || (github.event_name == 'issue_comment' && github.event.issue.pull_request.head.sha) || github.sha}}
|
||||
input_pr_num: ${{github.event_name == 'pull_request' && github.event.pull_request.number || (github.event_name == 'issue_comment' && github.event.issue.number) || 0}}
|
||||
input_pr_url: ${{github.event_name == 'pull_request' && github.event.pull_request.html_url || (github.event_name == 'issue_comment' && github.event.issue.pull_request.html_url) || ''}}
|
||||
input_pr_title: ${{github.event_name == 'pull_request' && github.event.pull_request.title || (github.event_name == 'issue_comment' && github.event.issue.pull_request.title) || ''}}
|
||||
repository_name: ${{ github.repository }}
|
||||
base_ref: ${{github.event_name == 'pull_request' && github.event.pull_request.base.ref || (github.event_name == 'issue_comment' && github.event.issue.pull_request.base.ref) || github.ref}}
|
||||
trigger_event_type: ${{ github.event_name }}
|
||||
comment_text: ${{ github.event_name == 'issue_comment' && github.event.comment.body || '' }}
|
||||
secrets: inherit
|
||||
with:
|
||||
input_sha: ${{github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.sha) || (github.event_name == 'issue_comment' && github.event.issue.pull_request.head.sha) || github.sha}}
|
||||
input_pr_num: ${{github.event_name == 'pull_request' && github.event.pull_request.number || (github.event_name == 'issue_comment' && github.event.issue.number) || 0}}
|
||||
input_pr_url: ${{github.event_name == 'pull_request' && github.event.pull_request.html_url || (github.event_name == 'issue_comment' && github.event.issue.pull_request.html_url) || ''}}
|
||||
input_pr_title: ${{github.event_name == 'pull_request' && github.event.pull_request.title || (github.event_name == 'issue_comment' && github.event.issue.pull_request.title) || ''}}
|
||||
repository_name: ${{ github.repository }}
|
||||
base_ref: ${{github.event_name == 'pull_request' && github.event.pull_request.base.ref || (github.event_name == 'issue_comment' && github.event.issue.pull_request.base.ref) || github.ref}}
|
||||
trigger_event_type: ${{ github.event_name }}
|
||||
comment_text: ${{ github.event_name == 'issue_comment' && github.event.comment.body || '' }}
|
||||
|
||||
@@ -25,28 +25,28 @@ Many of the functions in the library take a "device index". The device index is
|
||||
Hello ROCm SMI
|
||||
================
|
||||
|
||||
The only required ROCm-SMI call for any program that wants to use ROCm-SMI is the ``rsmi_init()`` call. This call initializes some internal data structures that will be used by subsequent ROCm-SMI calls.
|
||||
The only required ROCm-SMI call for any program that wants to use ROCm-SMI is the ``rsmi_init()`` call. This call initializes some internal data structures that will be used by subsequent ROCm-SMI calls.
|
||||
|
||||
When ROCm-SMI is no longer being used, ``rsmi_shut_down()`` should be called. This provides a way to do any releasing of resources that ROCm-SMI may have held. In many cases, this may have no effect, but may be necessary in future versions of the library.
|
||||
|
||||
A simple "Hello World" type program that displays the device ID of detected devices would look like this:
|
||||
|
||||
.. 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
|
||||
|
||||
@@ -30,7 +30,7 @@ The SMI will report two "versions": the ``ROCM-SMI`` version and the ``ROCM-SMI-
|
||||
- ``ROCM-SMI`` version is the CLI/tool version number with commit ID appended after + sign.
|
||||
|
||||
- ``ROCM-SMI-LIB`` version is the library package version number.
|
||||
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
ROCM-SMI version: 2.0.0+8e78352
|
||||
@@ -219,7 +219,7 @@ Detailed option descriptions
|
||||
============================
|
||||
|
||||
--setextremum <[min or max] [sclk or mclk] [value in MHz to set to]>
|
||||
Provided ASIC support, users can now set a maximum or minimum sclk or mclk value through our Python CLI tool (`rocm-smi --setextremum max sclk 1500`). See example below.
|
||||
Provided ASIC support, users can now set a maximum or minimum sclk or mclk value through our Python CLI tool (`rocm-smi --setextremum max sclk 1500`). See example below.
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
@@ -287,7 +287,7 @@ Detailed option descriptions
|
||||
|
||||
--setoverdrive, --setmemoverdrive <#>
|
||||
.. warning::
|
||||
|
||||
|
||||
DEPRECATED IN NEWER KERNEL VERSIONS. Use ``--setslevel`` or ``--setmlevel`` instead.
|
||||
|
||||
This sets the percentage above maximum for the max Performance Level.
|
||||
|
||||
@@ -39,12 +39,12 @@ For more information, refer to `<https://github.com/ROCm/rocm_smi_lib>`__.
|
||||
|
||||
* :doc:`Use C++ in ROCm SMI <how-to/use-cpp>`
|
||||
* :doc:`Use Python in ROCm SMI <how-to/use-python>`
|
||||
|
||||
|
||||
.. grid-item-card:: Tutorials
|
||||
|
||||
.. grid-item-card:: Tutorials
|
||||
|
||||
* :doc:`C++ <tutorials/cpp_tutorials>`
|
||||
* :doc:`Python <tutorials/python_tutorials>`
|
||||
* :doc:`Python <tutorials/python_tutorials>`
|
||||
|
||||
|
||||
To contribute to the documentation, refer to `Contributing to ROCm <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_.
|
||||
|
||||
@@ -10,12 +10,12 @@ subtrees:
|
||||
entries:
|
||||
- file: install/install
|
||||
title: ROCm SMI installation
|
||||
|
||||
- caption: How to
|
||||
|
||||
- caption: How to
|
||||
entries:
|
||||
- file: how-to/use-cpp
|
||||
- file: how-to/use-python
|
||||
|
||||
|
||||
- caption: API Reference
|
||||
entries:
|
||||
- file: doxygen/html/files
|
||||
@@ -28,15 +28,15 @@ subtrees:
|
||||
title: Modules
|
||||
- file: reference/python_api
|
||||
title: Python API
|
||||
|
||||
|
||||
|
||||
|
||||
- caption: Tutorials
|
||||
entries:
|
||||
- file: tutorials/cpp_tutorials
|
||||
title: C++
|
||||
title: C++
|
||||
- file: tutorials/python_tutorials
|
||||
title: Python
|
||||
|
||||
title: Python
|
||||
|
||||
- caption: About
|
||||
entries:
|
||||
- file: license
|
||||
|
||||
@@ -11,7 +11,7 @@ from enum import Enum
|
||||
import os
|
||||
|
||||
# Use ROCm installation path if running from standard installation
|
||||
# With File Reorg rsmiBindings.py and rsmiBindingsInit.py will be installed in
|
||||
# With File Reorg rsmiBindings.py and rsmiBindingsInit.py will be installed in
|
||||
# /opt/rocm/libexec/rocm_smi. relative path changed accordingly.
|
||||
# if ROCM_SMI_LIB_PATH is set, we can load 'librocm_smi64.so' from that location
|
||||
#
|
||||
|
||||
@@ -6309,7 +6309,7 @@ rsmi_event_notification_get(int timeout_ms,
|
||||
|
||||
sscanf(message, "%" PRId64 " -%d @%" PRIu32 "(%" PRIu32 ") %x->%x %x:%x %d\n", &ns, &pid, &start, &size, &from, &to, &prefetch_loc, &preferred_loc, &migrate_trigger);
|
||||
std::stringstream final_message;
|
||||
final_message << "nd: " << std::to_string(ns).c_str()
|
||||
final_message << "nd: " << std::to_string(ns).c_str()
|
||||
<< " pid: " << std::to_string(pid).c_str()
|
||||
<< " start: 0x" << std::hex << start
|
||||
<< " size: 0x" << std::hex << size
|
||||
@@ -6335,7 +6335,7 @@ rsmi_event_notification_get(int timeout_ms,
|
||||
|
||||
sscanf(message, "%" PRId64 " -%d @%" PRIu32 "(%" PRIu32 ") %x->%x %d %d\n", &ns, &pid, &start, &size, &from, &to, &migrate_trigger, &error_code);
|
||||
std::stringstream final_message;
|
||||
final_message << "nd: " << std::to_string(ns).c_str()
|
||||
final_message << "nd: " << std::to_string(ns).c_str()
|
||||
<< " pid: " << std::to_string(pid).c_str()
|
||||
<< " start: 0x" << std::hex << start
|
||||
<< " size: 0x" << std::hex << size
|
||||
|
||||
@@ -1854,7 +1854,7 @@ AMGpuMetricsPublicLatestTupl_t GpuMetricsBase_v18_t::copy_internal_to_external_m
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= start =======";
|
||||
LOG_TRACE(ss);
|
||||
|
||||
auto copy_data_from_internal_metrics_tbl = [&]()
|
||||
auto copy_data_from_internal_metrics_tbl = [&]()
|
||||
{
|
||||
AMGpuMetricsPublicLatest_t metrics_public_init{};
|
||||
|
||||
@@ -2051,7 +2051,7 @@ AMGpuMetricsPublicLatestTupl_t GpuMetricsBase_v18_t::copy_internal_to_external_m
|
||||
<< " |";
|
||||
LOG_TRACE(ss);
|
||||
|
||||
return std::make_tuple(status_code, copy_data_from_internal_metrics_tbl);
|
||||
return std::make_tuple(status_code, copy_data_from_internal_metrics_tbl);
|
||||
};
|
||||
|
||||
AMGpuMetricsPublicLatestTupl_t GpuMetricsBase_v17_t::copy_internal_to_external_metrics()
|
||||
|
||||
+4
-4
@@ -93,7 +93,7 @@ void TestMeasureApiExecutionTime::Run(void) {
|
||||
constexpr float kFAN_SPEED_ELAPSED_MICROSEC_BASE = (1000);
|
||||
/**
|
||||
* gpu_metrics can only refresh every 1000 microseconds (1 millisecs) due to FW
|
||||
*
|
||||
*
|
||||
* We have additional processing time (each read() -> fread() ~ costs 900 microseconds).
|
||||
* We need to read 2x:
|
||||
* 1) reading metric's header to check support (~900 microseconds)
|
||||
@@ -103,17 +103,17 @@ void TestMeasureApiExecutionTime::Run(void) {
|
||||
* 5) Pass to public structure (~100 microseconds)
|
||||
* ---------------------------
|
||||
* ~2100 worst case
|
||||
*
|
||||
*
|
||||
* Note: performance of fread/mmap/read
|
||||
* https://github.com/nurettn/c-read-vs-mmap-vs-fread
|
||||
*
|
||||
*
|
||||
* Possible improvments ideas:
|
||||
* a) Initize "N/A" / Max UINT only for non-backwards comptable public struct
|
||||
* or arrays
|
||||
* b) Directly put data into public structure - this skips other copy/fill
|
||||
* procedures
|
||||
* c) Expirement with other file reading options
|
||||
**/
|
||||
**/
|
||||
constexpr float kMETRICS_ELAPSED_MICROSEC_BASE = (2100);
|
||||
bool skip = false;
|
||||
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ void TestPerfLevelReadWrite::Run(void) {
|
||||
ret = rsmi_dev_perf_level_set(dv_ind,
|
||||
static_cast<rsmi_dev_perf_level_t>(pfl_i));
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED || ret == RSMI_STATUS_UNEXPECTED_DATA) {
|
||||
std::cout << "\t**" << GetPerfLevelStr(static_cast<rsmi_dev_perf_level_t>(pfl_i))
|
||||
std::cout << "\t**" << GetPerfLevelStr(static_cast<rsmi_dev_perf_level_t>(pfl_i))
|
||||
<< " returned RSMI_STATUS_NOT_SUPPORTED" << std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
Reference in New Issue
Block a user