Laptop turn off/on dedicated GPU

I would like to manually turn off/on the dedicated GPU on the laptop.
I found a way to turn it off, now I would like to turn it on again without a reboot. Is it possible?
The board is a Nvidia GTX 1650 Max-Q GDDR5 4GB.
Driver: nvidia 455.45.01-7.

Details:
My laptop has a light showing the GPU usage (white when the dedicated NVIDIA GPU is turned off, orange when is turned on).
With Windows the power management between Intel and NVIDIA is working fine.
In Linux there are two scenarios:

  1. Everything is working ok-ish. The dGPU is in P8 consuming 2W, if used it goes to P0 (35W-40W).
  2. Some update broke something (like today). The dGPU is stuck to 9-10W minimum (P0) even if not used and jumps to 35W-40W if used.

Since I am working with a laptop (and the battery is a big limiting factor) I would like the third option: manually and completely turn off/on the NVIDIA GPU (OFF=0W, ON=2W-40W).
I discovered that the following commands turn off the dGPU:
➜ ~ sudo nvidia-smi drain -m 1 -p 0000:02.00.0
Successfully set GPU 00000000:02:00.0 drain state to: draining.
➜ ~ sudo nvidia-smi drain -r -p 0000:02.00.0
GPU 00000000:02:00.0 successfully removed.

But then nvidia-smi is returning:
Failed to initialize NVML: Unknown Error.

Is there a way to turn it on again without a reboot?

You could switch to render offload + automatic power management:
https://download.nvidia.com/XFree86/Linux-x86_64/460.27.04/README/dynamicpowermanagement.html
https://download.nvidia.com/XFree86/Linux-x86_64/460.27.04/README/primerenderoffload.html

1 Like

Thanks!
I wasn’t aware about Dynamic Power Management.
It seems to be working. By default the GPU is off and when I run nvidia-smi is turned on for a couple of seconds and then off again. The power consumption, and the small led indicator, seems to confirm that the GPU is really turned off.

Regarding Prime I already looked at that and my config was working fine until recently. Probably an update broke something (not related to the Dynamic Power Management) and now I am not able to get it working.
But at least I can turn the GPU off automatically :)

1 Like

If I should look at the prime config, please run nvidia-bug-report.sh as root and attach the resulting nvidia-bug-report.log.gz file to your post.

Not necessary I rechecked everything based on the chapter 35 and figured out that during some tests I forgot to restore the right Nvidia PCI IDs in the xorg config under /usr/share.

dGPU turned off during normal operation. With the command __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia blender the Nvidia GPU become active until the application is closed then, after a couple of seconds, it becomes inactive.

Thank you again, now it’s all perfect.

1 Like