Skip to content

Commit

Permalink
Remove lib/rocm_smi_lib and add instructions for obtaining it to README
Browse files Browse the repository at this point in the history
  • Loading branch information
romner-set committed Jun 16, 2023
1 parent d8ebbe1 commit 746f716
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ bin
btop
.*/

# Optional libraries
lib/rocm_smi_lib


#do not ignore .github directory
!.github
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ Also needs a UTF8 locale and a font that covers:
Append `ARCH=<architecture>` 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.
Expand Down
1 change: 0 additions & 1 deletion lib/rocm_smi_lib
Submodule rocm_smi_lib deleted from f8882d
18 changes: 17 additions & 1 deletion src/linux/btop_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ tab-size = 4
#include <net/if.h>
#include <arpa/inet.h> // for inet_ntop()
#include <dlfcn.h>
#include <rocm_smi/rocm_smi.h>


#if !(defined(STATIC_BUILD) && defined(__GLIBC__))
Expand Down Expand Up @@ -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)();
Expand Down

0 comments on commit 746f716

Please sign in to comment.