diff --git a/.gitignore b/.gitignore index 25ee477..8e986b0 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,9 @@ bin btop .*/ +# Optional libraries +lib/rocm_smi_lib + #do not ignore .github directory !.github diff --git a/.gitmodules b/.gitmodules index b5f6d79..4382b56 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "lib/fmt"] path = lib/fmt url = https://github.com/fmtlib/fmt -[submodule "lib/rocm_smi_lib"] - path = lib/rocm_smi_lib - url = https://github.com/RadeonOpenCompute/rocm_smi_lib diff --git a/README.md b/README.md index 5c56eea..eec69d6 100644 --- a/README.md +++ b/README.md @@ -341,6 +341,13 @@ Also needs a UTF8 locale and a font that covers: Append `ARCH=` to manually set the target architecture. If omitted the makefile uses the machine triple (output of `-dumpmachine` compiler parameter) to detect the target system. + Append `RSMI_STATIC=true` to statically link the ROCm SMI library used for querying AMDGPU data. + For this to work, the `lib/rocm_smi_lib` directory must contain the RSMI source code, which can obtained using the following command: + + ```bash + git clone https://github.com/RadeonOpenCompute/rocm_smi_lib.git lib/rocm_smi_lib + ``` + Use `ADDFLAGS` variable for appending flags to both compiler and linker. For example: `ADDFLAGS=-march=native` might give a performance boost if compiling only for your own system. diff --git a/lib/rocm_smi_lib b/lib/rocm_smi_lib deleted file mode 160000 index f8882d7..0000000 --- a/lib/rocm_smi_lib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f8882d74d8749e2ad788184d624167cc326d4c2c diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index 754414d..6692923 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -29,7 +29,6 @@ tab-size = 4 #include #include // for inet_ntop() #include -#include #if !(defined(STATIC_BUILD) && defined(__GLIBC__)) @@ -155,6 +154,23 @@ namespace Gpu { //? AMD data collection namespace Rsmi { #if !defined(RSMI_STATIC) + //? RSMI defines, structs & typedefs + #define RSMI_MAX_NUM_FREQUENCIES 32 + #define RSMI_STATUS_SUCCESS 0 + #define RSMI_MEM_TYPE_VRAM 0 + #define RSMI_TEMP_CURRENT 0 + #define RSMI_TEMP_TYPE_EDGE 0 + #define RSMI_CLK_TYPE_MEM 4 + #define RSMI_CLK_TYPE_SYS 0 + #define RSMI_TEMP_MAX 1 + + typedef int rsmi_status_t, + rsmi_temperature_metric_t, + rsmi_clk_type_t, + rsmi_memory_type_t; + + struct rsmi_frequencies_t {uint32_t num_supported, current, frequency[RSMI_MAX_NUM_FREQUENCIES];}; + //? Function pointers rsmi_status_t (*rsmi_init)(uint64_t); rsmi_status_t (*rsmi_shut_down)();