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

[REQUEST] Show GPU use #426

Closed
sfikas opened this issue Sep 22, 2022 · 44 comments · Fixed by #529
Closed

[REQUEST] Show GPU use #426

sfikas opened this issue Sep 22, 2022 · 44 comments · Fixed by #529
Assignees
Labels
enhancement New feature or request

Comments

@sfikas
Copy link

sfikas commented Sep 22, 2022

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

@sfikas sfikas added the enhancement New feature or request label Sep 22, 2022
@martini1992
Copy link

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

@unfa
Copy link

unfa commented Oct 10, 2022

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

@jldevezas
Copy link

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

@jelly
Copy link

jelly commented Dec 8, 2022

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
Copy link

orena1 commented Dec 14, 2022

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

which is written in C

@ayan-iiitd
Copy link

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

@Twiggeh
Copy link

Twiggeh commented Dec 25, 2022

👍

@lukaemon
Copy link

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

@NemyV
Copy link

NemyV commented Mar 26, 2023

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!

@Exponential-Workload
Copy link

i'd be very interested in this, primarily so i can monitor my gpu-having servers without spawning 2 ssh sessions

@GrabbenD
Copy link

GrabbenD commented May 7, 2023

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
Copy link

jere357 commented May 13, 2023

  • for this, muy importante

@romner-set
Copy link
Contributor

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
Copy link
Owner

@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
Copy link
Contributor

romner-set commented May 16, 2023

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

  • Keep the btop4win layout
  • Either make each GPU split the usage graph horizontally or just show average usage, depending on a setting
  • Have each GPU's usage meter, temp graph and maybe some other info on a separate line or two of the CPU side panel, with a setting to show graphs instead of meters for the usage
  • Bind the 5,6,7,8,9,0 keys to open a separate detailed panel for each of the first 6 GPUs, which would look something like what I already made

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
Copy link
Owner

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

rusmux commented Sep 6, 2023

Are there any updates?

@aristocratos
Copy link
Owner

@rusmux #529

@dm17
Copy link

dm17 commented Nov 10, 2023

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
Copy link

5shekel commented Nov 11, 2023

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 sfikas closed this as completed Nov 13, 2023
@sfikas
Copy link
Author

sfikas commented Nov 13, 2023

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

@Samoed
Copy link

Samoed commented Nov 13, 2023

@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 aristocratos reopened this Nov 13, 2023
@aristocratos
Copy link
Owner

aristocratos commented Nov 13, 2023

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
Copy link
Author

sfikas commented Nov 14, 2023

@Samoed Sorry about that!

@nonetrix
Copy link

nonetrix commented Jan 20, 2024

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

@Exponential-Workload
Copy link

Exponential-Workload commented Jan 21, 2024

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

@nonetrix
Copy link

nonetrix commented Jan 21, 2024

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
Copy link

ErrorNoInternet commented Jan 21, 2024

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.

@Exponential-Workload
Copy link

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

works fine on AMD on arch, not sure about nix however.

image

@MROvaiz
Copy link

MROvaiz commented Mar 12, 2024

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

@yurikleb
Copy link

Would this work on a RaspberryPi?

@imwints
Copy link
Contributor

imwints commented Mar 25, 2024

nope, unless you have a nvidia or amd gpu

@nonetrix
Copy link

nonetrix commented Mar 25, 2024

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

@dm17
Copy link

dm17 commented Mar 25, 2024

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
Copy link

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
Copy link

MROvaiz commented May 10, 2024

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
Copy link

Press 5 to toggle the GPU box

@offeex
Copy link

offeex commented Aug 12, 2024

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

@nonetrix
Copy link

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

@offeex
Copy link

offeex commented Aug 12, 2024

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
Copy link

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

@offeex
Copy link

offeex commented Aug 17, 2024

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
Copy link

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
Copy link
Contributor

imwints commented Sep 11, 2024

Intel is not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.