aristocratos / btop

A monitor of resources
Apache License 2.0
20.86k stars 644 forks source link

[REQUEST] Avoid waking up Nvidia discrete GPUs #738

Open UltimateBoomer opened 9 months ago

UltimateBoomer commented 9 months ago

Is your feature request related to a problem? Please describe. On laptops with Nvidia discrete GPUs that has been set up to enter d3cold power state when idle, running btop will cause the discrete GPU to wake up, and also make btop show a blank screen a few seconds.

Describe the solution you'd like Btop should check if the GPU is in an idle power state before polling its stats. I think this should be possible by reading /sys/class/drm/card*/device/power_state, which will provide the power state of the GPU without waking it up. If the GPU is not in d0, then the GPU monitoring bar should show that the GPU is sleeping.

Describe alternatives you've considered Btop has the functionality to hide GPU stats with the "show GPU info" option, but this doesn't actually disable GPU monitoring and thus leads to the same issue. The only way to work around this issue I found is to compile btop without GPU monitoring.

Additional context I tested this on a laptop with Intel i7-11800H and Nvidia RTX 3060.

LnLcFlx commented 9 months ago

I'd like this feature very much!

Also, if "show gpu info" is off, the gpu goes back to sleep after btop is startet. So apparently it only accesses the gpu once at the beginning. And after the gpu is back to sleep, closing btop has a similar delay to starting btop starts when it wakes up the gpu.

rigel314 commented 4 months ago

I have the same problem with the AMD discrete GPU on my laptop. My current workaround is to have a custom wrapper around the (amd gpu specific) librocm_smi64.so library which lies to btop and tells it there's only one GPU. This wakes up the dGPU briefly, but then it goes back to sleep shortly, while btop continues to run.