Fix RSMI_STATIC=true and add GPU section to README.md

This commit is contained in:
romner 2023-07-14 02:39:44 +02:00
parent 3fad8a6fde
commit 85fb28cee6
3 changed files with 28 additions and 6 deletions

View file

@ -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:

View file

@ -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)

View file

@ -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>