diff --git a/projects/rocm-smi-lib/.github/CONTRIBUTING.md b/projects/rocm-smi-lib/.github/CONTRIBUTING.md index 0fe73608ca..0522998f40 100644 --- a/projects/rocm-smi-lib/.github/CONTRIBUTING.md +++ b/projects/rocm-smi-lib/.github/CONTRIBUTING.md @@ -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 ## diff --git a/projects/rocm-smi-lib/.github/workflows/rocm_ci_caller.yml b/projects/rocm-smi-lib/.github/workflows/rocm_ci_caller.yml index 9643cdf732..acb9de54a8 100644 --- a/projects/rocm-smi-lib/.github/workflows/rocm_ci_caller.yml +++ b/projects/rocm-smi-lib/.github/workflows/rocm_ci_caller.yml @@ -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 || '' }} diff --git a/projects/rocm-smi-lib/docs/how-to/use-cpp.rst b/projects/rocm-smi-lib/docs/how-to/use-cpp.rst index 1ebfe7b5cd..59e4195ef3 100644 --- a/projects/rocm-smi-lib/docs/how-to/use-cpp.rst +++ b/projects/rocm-smi-lib/docs/how-to/use-cpp.rst @@ -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 #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 diff --git a/projects/rocm-smi-lib/docs/how-to/use-python.rst b/projects/rocm-smi-lib/docs/how-to/use-python.rst index f0ebd32493..c02004ad69 100644 --- a/projects/rocm-smi-lib/docs/how-to/use-python.rst +++ b/projects/rocm-smi-lib/docs/how-to/use-python.rst @@ -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. diff --git a/projects/rocm-smi-lib/docs/index.rst b/projects/rocm-smi-lib/docs/index.rst index a92c802e3a..2fa5107fdc 100644 --- a/projects/rocm-smi-lib/docs/index.rst +++ b/projects/rocm-smi-lib/docs/index.rst @@ -39,12 +39,12 @@ For more information, refer to ``__. * :doc:`Use C++ in ROCm SMI ` * :doc:`Use Python in ROCm SMI ` - - .. grid-item-card:: Tutorials + + .. grid-item-card:: Tutorials * :doc:`C++ ` - * :doc:`Python ` + * :doc:`Python ` To contribute to the documentation, refer to `Contributing to ROCm `_. diff --git a/projects/rocm-smi-lib/docs/sphinx/_toc.yml.in b/projects/rocm-smi-lib/docs/sphinx/_toc.yml.in index 804d949b14..74e14ada32 100644 --- a/projects/rocm-smi-lib/docs/sphinx/_toc.yml.in +++ b/projects/rocm-smi-lib/docs/sphinx/_toc.yml.in @@ -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 diff --git a/projects/rocm-smi-lib/python_smi_tools/rsmiBindingsInit.py.in b/projects/rocm-smi-lib/python_smi_tools/rsmiBindingsInit.py.in index 7c75c4af87..aeeed6f4dc 100644 --- a/projects/rocm-smi-lib/python_smi_tools/rsmiBindingsInit.py.in +++ b/projects/rocm-smi-lib/python_smi_tools/rsmiBindingsInit.py.in @@ -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 # diff --git a/projects/rocm-smi-lib/src/rocm_smi.cc b/projects/rocm-smi-lib/src/rocm_smi.cc index 561798ade0..e7e2151bec 100644 --- a/projects/rocm-smi-lib/src/rocm_smi.cc +++ b/projects/rocm-smi-lib/src/rocm_smi.cc @@ -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 diff --git a/projects/rocm-smi-lib/src/rocm_smi_gpu_metrics.cc b/projects/rocm-smi-lib/src/rocm_smi_gpu_metrics.cc index 0722f898df..4e381e2982 100644 --- a/projects/rocm-smi-lib/src/rocm_smi_gpu_metrics.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_gpu_metrics.cc @@ -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() diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/measure_api_execution_time.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/measure_api_execution_time.cc index df61259d92..b77923b0ac 100644 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/measure_api_execution_time.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/measure_api_execution_time.cc @@ -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; diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_level_read_write.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_level_read_write.cc index 85fae7462e..da02be79ef 100644 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_level_read_write.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/perf_level_read_write.cc @@ -128,7 +128,7 @@ void TestPerfLevelReadWrite::Run(void) { ret = rsmi_dev_perf_level_set(dv_ind, static_cast(pfl_i)); if (ret == RSMI_STATUS_NOT_SUPPORTED || ret == RSMI_STATUS_UNEXPECTED_DATA) { - std::cout << "\t**" << GetPerfLevelStr(static_cast(pfl_i)) + std::cout << "\t**" << GetPerfLevelStr(static_cast(pfl_i)) << " returned RSMI_STATUS_NOT_SUPPORTED" << std::endl; } else { CHK_ERR_ASRT(ret)