Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to select which GPU vendors to enable #984

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/btop_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ namespace Config {
{"rsmi_measure_pcie_speeds",
"#* Measure PCIe throughput on AMD cards, may impact performance on certain cards."},
{"gpu_mirror_graph", "#* Horizontally mirror the GPU graph."},
{"shown_gpus", "#* Set which GPU vendors to show. Available values are \"nvidia amd intel\""},
{"custom_gpu_name0", "#* Custom gpu0 model name, empty string to disable."},
{"custom_gpu_name1", "#* Custom gpu1 model name, empty string to disable."},
{"custom_gpu_name2", "#* Custom gpu2 model name, empty string to disable."},
Expand Down Expand Up @@ -252,7 +253,8 @@ namespace Config {
{"custom_gpu_name3", ""},
{"custom_gpu_name4", ""},
{"custom_gpu_name5", ""},
{"show_gpu_info", "Auto"}
{"show_gpu_info", "Auto"},
{"shown_gpus", "nvidia amd intel"}
#endif
};
std::unordered_map<std::string_view, string> stringsTmp;
Expand Down
5 changes: 5 additions & 0 deletions src/btop_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ namespace Menu {
"Horizontally mirror the GPU graph.",
"",
"True or False."},
{"shown_gpus",
"Manually set which gpu vendors to show.",
"",
"Available values are \"nvidia amd intel\".",
"Separate values with whitespace."},
{"custom_gpu_name0",
"Custom gpu0 model name in gpu stats box.",
"",
Expand Down
10 changes: 7 additions & 3 deletions src/linux/btop_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,13 @@ namespace Shared {

//? Init for namespace Gpu
#ifdef GPU_SUPPORT
Gpu::Nvml::init();
Gpu::Rsmi::init();
Gpu::Intel::init();
auto shown_gpus = Config::getS("shown_gpus");
if (s_contains(shown_gpus, "nvidia"))
Gpu::Nvml::init();
if (s_contains(shown_gpus, "amd"))
Gpu::Rsmi::init();
if (s_contains(shown_gpus, "intel"))
Gpu::Intel::init();
if (not Gpu::gpu_names.empty()) {
for (auto const& [key, _] : Gpu::gpus[0].gpu_percent)
Cpu::available_fields.push_back(key);
Expand Down
Loading