Hybrid graphics
Laptops with Intel + NVIDIA (muxless Optimus) draw the screen with the Intel GPU. The NVIDIA GPU should be fully off until a game or a CUDA job wants it. That saves several watts and keeps the laptop cool.
Driver
nvidia-open-dkms nvidia-utils nvidia-prime (plus intel-media-driver vulkan-intel for the Intel side).
Runtime power management
files/nvidia-power.conf in the playbook → /etc/modprobe.d/
options nvidia NVreg_DynamicPowerManagement=0x02 NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmpfiles/80-nvidia-pm.rules in the playbook → /etc/udev/rules.d/: the GPU's power control
was stuck at on, and this rule sets it to auto so it can suspend.
Enable nvidia-suspend, nvidia-resume and nvidia-hibernate. Do not enable nvidia-persistenced:
it keeps the GPU awake.
Use NVIDIA only on purpose
- No global NVIDIA environment variables (
__GLX_VENDOR_LIBRARY_NAME,LIBVA_DRIVER_NAME=nvidia, …). They wake the GPU for every app. - Run one program on NVIDIA with
prime-run <program>.
Check
cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status # → suspended
glxinfo -B | grep renderer # → Intel
prime-run glxinfo -B | grep renderer # → NVIDIAThe desktop's stats popup shows the GPU as "asleep" while it is suspended.
Before and after
Two new files, nothing global:
+options nvidia NVreg_DynamicPowerManagement=0x02 NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp+ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000|0x040300", TEST=="power/control", ATTR{power/control}="auto"
+ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000|0x040300", TEST=="power/control", ATTR{power/control}="on"Result: runtime_status reads suspended at idle, the desktop's renderer is the Intel GPU, and
prime-run glxinfo -B reports the NVIDIA GPU.