summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorromner <roman@skotnica.com>2023-07-14 02:39:44 +0200
committerromner <roman@skotnica.com>2023-07-14 02:39:44 +0200
commit85fb28cee6e6953ce5aed4725ce82bf65a7e5ade (patch)
treed0027cb2ea5f82b604b14a1252e454ebdb4a9d41
parent3fad8a6fdec3b3efb5d4d407d969cec5e62ffa7a (diff)
Fix RSMI_STATIC=true and add GPU section to README.md
-rw-r--r--Makefile2
-rw-r--r--README.md29
-rw-r--r--src/linux/btop_collect.cpp3
3 files changed, 28 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index d3f7aff..281e48c 100644
--- a/Makefile
+++ b/Makefile
@@ -315,7 +315,7 @@ rocm_smi:
@ar -crs rocm_smi/librocm_smi64.a $$(find rocm_smi -name '*.o') $(SURPRESS) || { printf "\033[1;91mFailed to pack ROCm SMI into static library, continuing build without statically linking ROCm SMI\033[37m...\033[0m\n"; exit 0; }
@printf "\033[1;92m100$(P)\033[10D\033[5C-> \033[1;37mrocm_smi/librocm_smi64.a \033[100D\033[38C\033[1;93m(\033[1;97m$$(du -ah rocm_smi/librocm_smi64.a | cut -f1)iB\033[1;93m)\033[0m\n"
@printf "\033[1;92mROCm SMI build complete in \033[92m(\033[97m$$($(DATE_CMD) -d @$$(expr $$(date +%s 2>/dev/null || echo "0") - $(TIMESTAMP) 2>/dev/null) -u +%Mm:%Ss 2>/dev/null | sed 's/^00m://' || echo "unknown")\033[92m)\033[0m\n"
- @$(eval override LDFLAGS += lib/rocm_smi_lib/build/rocm_smi/librocm_smi64.a -DRSMI_STATIC)
+ @$(eval override LDFLAGS += lib/rocm_smi_lib/build/rocm_smi/librocm_smi64.a -DRSMI_STATIC) # TODO: this seems to execute every time, no matter if the compilation failed or succeeded
@$(eval override CXXFLAGS += -DRSMI_STATIC)
else
rocm_smi:
diff --git a/README.md b/README.md
index eec69d6..2b2dfd4 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,7 @@
* [Compilation Linux](#compilation-linux)
* [Compilation macOS](#compilation-macos-osx)
* [Compilation FreeBSD](#compilation-freebsd)
+* [GPU compatibility](#gpu-compatibility)
* [Installing the snap](#installing-the-snap)
* [Configurability](#configurability)
* [License](#license)
@@ -342,11 +343,7 @@ Also needs a UTF8 locale and a font that covers:
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
- ```
+ See [GPU compatibility](#gpu-compatibility) for details.
Use `ADDFLAGS` variable for appending flags to both compiler and linker.
@@ -578,6 +575,28 @@ Also needs a UTF8 locale and a font that covers:
gmake help
```
+## GPU compatibility
+
+ Btop++ supports NVIDIA and AMD GPUs out of the box on Linux, provided you have the correct drivers and libraries.
+
+ Compatibility with Intel GPUs using generic DRM calls is planned, as is compatibility for FreeBSD and macOS.
+
+ * **NVIDIA**
+
+ You must use an official NVIDIA driver, both the closed-source and [open-source](https://github.com/NVIDIA/open-gpu-kernel-modules) ones have been verified to work.
+
+ In addition to that you must also have the `nvidia-ml` dynamic library installed, which should be included with the driver package of your distribution.
+
+ * **AMD**
+
+ AMDGPU data is queried using the [ROCm SMI](https://github.com/RadeonOpenCompute/rocm_smi_lib) library, which may or may not be packaged for your distribution. If your distribution doesn't provide a package, btop++ is statically linked to ROCm SMI with the `RSMI_STATIC=true` make flag.
+
+ This flag expects the ROCm SMI source code in `lib/rocm_smi_lib`, and compilation will fail if it's not there. The latest tested version is 5.6.x, which can be obtained with the following command:
+
+ ```bash
+ git clone https://github.com/RadeonOpenCompute/rocm_smi_lib.git --depth 1 -b rocm-5.6.x lib/rocm_smi_lib
+ ```
+
## Installing the snap
[![btop](https://snapcraft.io/btop/badge.svg)](https://snapcraft.io/btop)
diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp
index 26b576c..eb76f64 100644
--- a/src/linux/btop_collect.cpp
+++ b/src/linux/btop_collect.cpp
@@ -30,6 +30,9 @@ tab-size = 4
#include <arpa/inet.h> // for inet_ntop()
#include <dlfcn.h>
+#if defined(RSMI_STATIC)
+ #include <rocm_smi/rocm_smi.h>
+#endif
#if !(defined(STATIC_BUILD) && defined(__GLIBC__))
#include <pwd.h>