aristocratos / btop

A monitor of resources
Apache License 2.0
20.89k stars 645 forks source link

[REQUEST] Show GPU use #426

Closed sfikas closed 11 months ago

sfikas commented 2 years ago

Is your feature request related to a problem? Please describe. If I need to check the GPU usage status, I must type "nvidia-smi" to do it, which maybe can be described the ps -ef equivalent for GPUs. This is especially useful for computers that do heavy usage of multiple GPUs due to deep learning training and applications.

Describe the solution you'd like I'd love to see GPU status (the info given by nvidia-smi) integrated with btop's great interface.

Describe alternatives you've considered

Additional context

martini1992 commented 2 years ago

Also Intel GPU's, currently using intel_gpu_top. Don't know how feasible this would be.

unfa commented 2 years ago

I simiarly have to use readeontop to check my GPU processing and memory usage.

jldevezas commented 1 year ago

The best I've found so far for NVIDIA is gpustat: https://github.com/wookayin/gpustat Maybe this can give you some inspiration!

jelly commented 1 year ago

It would be neat to show GPU stats so memory usage and temperatures like the current CPU stats. As relying on GPU specific tools is a can of worms, it's probably more worthwhile to use a GL extension to query the memory/gpu usage stats similar to what mangohud probably does. The temperatures should be readable from hwmon

https://github.com/grawity/code/blob/main/desktop/gl-mem.c

That would mean a new dependency on for example libepoxy or libgl for doing GL queries.

orena1 commented 1 year ago

There is also nvtop here: https://github.com/Syllo/nvtop image

which is written in C

ayan-iiitd commented 1 year ago

I am using this at this moment - https://github.com/XuehaiPan/nvitop Works very well for Nvidia GPUs.

Twiggeh commented 1 year ago

:+1:

lukaemon commented 1 year ago

Current features are delightful to use. Would be great to have GPU support. Thanks for your work.

NemyV commented 1 year ago

Would be so awesome to have all the base monitoring in one place i am surprised it has not been added yet. Please add it i love your work!

GrabbenD commented 1 year ago

Apart from Radeontop, is there any utility similar to nvitop for AMD? I really enjoy btop's design and all I'm missing is a sleek utility for my GPU

jere357 commented 1 year ago
romner-set commented 1 year ago

I made a proof-of-concept of how this could work. It's nowhere near PR-ready yet as right now it only supports nvidia cards and shows only a single GPU, but feel free to try it out here: https://github.com/romner-set/btop-gpu

2023-05-14-165910_hyprshot

As I said, it's only a proof-of-concept at this stage. I'm still not sure if the VRAM info should be in the mem panel or together with the utilization as it is right now, and how to handle multiple GPUs (single panel with averages, or one panel for each GPU?). The process list also has to go somewhere, which could be a separate panel or somehow integrated with the CPU one.

Suggestions are welcome.

aristocratos commented 1 year ago

@romner-set That is some really nice work! I like it! 👍🏼

You can see how I implemented the layout for gpu in the code and screenshots on https://github.com/aristocratos/btop4win With the "up" graph in the cpu panel being cpu and the "down" graph gpu.

Having a separate panel for gpu might be preferable to some but will also constrains the available space a bit, and force the minimum terminal size above 80x25 to fit everything. So could be an idea to have a toggle for gpu shown in its own panel or incorporated in the cpu panel (like in btop4win).

Feel free to open a PR (even if it's not ready yet).

romner-set commented 1 year ago

@aristocratos Thanks! I had no idea GPU usage was already implemented in btop4win, that would've made things a whole lot easier.

I've got another idea that also seems like it'd work pretty well even with multi-GPU setups:

Best of both worlds, I think. Before I start working on all that I'll make a new branch on my fork to match the btop4win layout and open a PR when that's in a usable state, shouldn't take too long.

aristocratos commented 1 year ago

@romner-set Yeah, that would work. Considering the gpu panel could have a fixed minimal size (unlike the cpu panel with variable number of cores), it wouldn't be too much issue having multiple panels for multiple gpus sharing space horizontally.

And then if the terminal size goes below a certain size, the gpu panels are hidden and it goes back to the less verbose mode sharing space with the cpu panel.

Could also add an option for the smaller gpu stats in the cpu panel where you select from a list, something like {Auto, Average, GPU1, GPU2, ...}. Where "Auto" would select the gpu with highest current usage, "Average" would calculate an average of all and so on.

// TODO, there's gotta be a more elegant way to do this... out += Mv::to(b_y + 3, b_x) + Theme::c("div_line") + Symbols::div_left+Symbols::h_line [...]

😄 Have been thinking about pulling in fmtlib to make the current string building soup into something more readable. Give it a try if you want to. If works well, I will try to work it in to a bigger overhaul of the codebase some time in the future.

rusmux commented 1 year ago

Are there any updates?

aristocratos commented 1 year ago

@rusmux #529

dm17 commented 12 months ago

Would be epic. I guess plenty of requests for getting GPU data from the nvidia blobs, but my request would be to get it from intel_gpu_top and radeontop. BTOP rocks!

5shekel commented 12 months ago

just here to report

529 is easy to merge and works great for my nvidia gpu.

tip: toggle the gpu view on by typing 5 Screenshot from 2023-11-11 19-40-59

sfikas commented 12 months ago

This is so great !! Congratulations to all that worked on this!

Samoed commented 12 months ago

@sfikas I don't think that you should close this issue, as the implementation has not been released yet. Additionally, I believe that some individuals, myself included, have been using this issue to monitor the progress of the feature.

aristocratos commented 12 months ago

Are still some pending changes, cleanup/fixes, documentation, etc. needed to make this work well for all platforms. (Only enabled on Linux with Nvidia or Amd cards right now, but need to make sure the new shared data structures and so on are handled correctly when GPU support is off.) Will get to it soon.

sfikas commented 12 months ago

@Samoed Sorry about that!

nonetrix commented 9 months ago

Apart from Radeontop, is there any utility similar to nvitop for AMD? I really enjoy btop's design and all I'm missing is a sleek utility for my GPU

Sorry for necro posting, but nvtop despite being called nvtop works fine on AMD now actually. So if you want something in the meantime until GPU support gets added in packages etc. Nvtop will work just fine, just maybe with a little bit of a cursed name considering it's on a AMD GPU now image

nonetrix commented 9 months ago

Apart from Radeontop, is there any utility similar to nvitop for AMD? I really enjoy btop's design and all I'm missing is a sleek utility for my GPU

Sorry for necro posting, but nvtop despite being called nvtop works fine on AMD now actually. So if you want something in the meantime until GPU support gets added in packages etc. Nvtop will work just fine, just maybe with a little bit of a cursed name considering it's on a AMD GPU now

  1. fyi, that image url contains a jwt lol
  2. btop also includes amd (and possibly nvidia?) gpu support as of Add GPU monitoring support #529

I don't understand what you mean by "jwt", but yes it is true that it has GPU support now. However, to my understanding it's not enabled by default yet or packaged for that matter on many distros. I was just bringing up a alternative in the meantime, or more correctly showing that it also works on AMD as well

ErrorNoInternet commented 9 months ago

NVIDIA support works for me on NixOS by overriding the following: image

You could try taking a few things from the nvtop package in nixpkgs to get it to work on AMD.

MROvaiz commented 8 months ago

not able to bring this in nixos for amd gpu. Please show us how to add this!

yurikleb commented 7 months ago

Would this work on a RaspberryPi?

imwints commented 7 months ago

nope, unless you have a nvidia or amd gpu

nonetrix commented 7 months ago

Sucks GPU statistics aren't as standardized as CPU ones, has there been any effort to make them standard? Semi off topic perhaps

dm17 commented 7 months ago

Sucks GPU statistics aren't as standardized as CPU ones, has there been any effort to make them standard? Semi off topic perhaps

I don't consider a comment about the root cause to be off topic... Even if it can't be solved within the same thread.

bryceberger commented 6 months ago

not able to bring this in nixos for amd gpu. Please show us how to add this!

If you're on unstable, you can do btop.override {rocmSupport = true;} for amd gpus. (I think nvidia would need {cudaSupport = true;} instead, but don't have one to verify)

MROvaiz commented 6 months ago

not able to bring this in nixos for amd gpu. Please show us how to add this!

If you're on unstable, you can do btop.override {rocmSupport = true;} for amd gpus. (I think nvidia would need {cudaSupport = true;} instead, but don't have one to verify)

This is how it is shown, is it correct? the graph not there for gpu like cpu? I have AMD 7800 XT GPU image

ErrorNoInternet commented 6 months ago

Press 5 to toggle the GPU box

offeex commented 2 months ago

opening gpu (pressing 6) seems to make btop crash. 5 works fine tho (i have rocm_smi_lib installed). GeForce RTX 3050 Mobile

nonetrix commented 2 months ago

Um, that is for AMD not NVIDIA. You need CUDA likely?

offeex commented 2 months ago

Um, that is for AMD not NVIDIA. You need CUDA likely?

oh well you are right, removing rocm_smi_lib fixed the issue.

I would rather prefer to have my dGPU listed there

nonetrix commented 2 months ago

Some system have NVIDIA and AMD GPU so kinda curious what you would do there though

offeex commented 2 months ago

Some system have NVIDIA and AMD GPU so kinda curious what you would do there though

idk, i have this setup as well (nvidia dgpu, amd igpu)

DrVoidest commented 1 month ago

Has anyone gotten it to work for intel GPUs I also have duel gpu ( nvidia dgpu intel igpu)? Adding {cudaSupport = true;} to my config got my nvida one to show up, just not the intel one.

imwints commented 1 month ago

Intel is not supported