NVIDIA Exec: The coolest utility for Optimus laptops.

GitHub - pedro00dk/nvidia-exec: GPU switching without log out for Nvidia Optimus laptops under Linux
GPU switching without log out for Nvidia Optimus laptops under Linux - pedro00dk/nvidia-exec

Anyone who's ever bought a gaming laptop can agree with me on this one. These things absolutely suck at anything requiring the battery. The power hungry dedicated GPU is a large contributor to that. I need 5+ hours of continuous battery life while actually doing stuff - simply because of high school work.

My Lenovo Ideapad Gaming 3 (i5 11th gen + GTX1650 version) can barely do 2 hours on Windows - while IDLE! In my years of Linux-ing, I've tried literally everything to reduce my idle & active power consumption when on battery. Different distributions and software configurations usually had little impact, until I've come to a sweet spot. Arch with Hyprland using NVIDIA exec.

By default, Hyprland (and Wayland for that matter) run light applications on the integrated GPU, while stuff that needs GLX, EGL and other GL's gets a first class seat on the dedicated GPU. This is great, except the fact that the dedicated GPU is still active even when nothing is on it. NVIDIA exec addresses this issue by completely shutting down the dedicated GPU until an app manually requests it. That's usually done with a wrapper command like nvx start <command>.

NVX (NVidia eXec) fires up the GPU, loads NVIDIA related modules and runs the command with the dedicated GPU. Once that program exits and there are no other nvx sessions active, the GPU is shut down - completely - saving as much as 4W when idle. Sure, 4W might not seem like much, but when the system already idles at 9W with the GPU active, the relatively large leap to 5W idle is pretty impressive. Especially on a 45Wh battery degraded to 40Wh.

Kudos to the person who originally came up with the idea and the FOSS community for maintaining it even to this day. Y'all have a special spot in my heart. Be sure to check it out if you're someone who also has an Optimus laptop (iGPU + NVIDIA dedicated GPU) on Linux. The install instructions are intended for Arch (AUR), but install on other distributions is fairly trivial.