Laptop with Dual GPU Setup Guide
NVIDIA PRIME Render Offload
The official way from NVIDIA
Append these environment variables before running the program
Steam
Wrapper script
Arch Linux provides a package called nvidia-prime
that helps you set the environment variables above when you run a program, to use it simply execute the following:
Installation of the Wrapper script
You can use prime-run
now.
GNOME
As of GNOME 3.38 and later, you can select “Run with Discrete Graphics” from the context menu when you right-click on an application.
Optimus Manager (legacy)
Clever tool for easy switching between a laptop’s integrated GPU and the discrete one.
Modern laptops have two graphics cards, especially if we talk about gaming laptops. iGPU - integrated GPU, longer battery life, and lower performance. dGPU - discrete GPU, higher performance, but it would drain more battery, highly recommended for gaming, rendering, video encoding, NVENC among other demanding tasks.
Windows automatically switches between the iGPU and dGPU depending on the usage. Here is a guide on how to set up the same for CachyOS, especially if you plan to use it for gaming or streaming, 3D development, etc.
Tested on a laptop with an Intel CPU and a NVIDIA GPU, but since release 1.4 Optimus Manager also has support for AMD CPUs.
Preparing iGPU and dGPU for the Linux Kernel
Let’s start by configuring mkinitcpio which loads various kernel modules.
Intel iGPU
Add the following modules i915 intel_agp nvidia
to the MODULES section in /etc/mkinitcpio.conf
, make sure you don’t insert the same module multiple times:
The
intel_agp
module may cause issues with hibernation on some systems, see https://bbs.archlinux.org/viewtopic.php?id=262043. Try omitting the module if you encounter issues.
AMD iGPU
with AMDGPU driver
Add the following modules amdgpu nvidia
to the MODULES section in /etc/mkinitcpio.conf
, make sure you don’t insert the same module multiple times:
with radeon driver
Add the following modules radeon nvidia
to the MODULES section in /etc/mkinitcpio.conf
, make sure you don’t insert the same module multiple times:
Enable “Direct Rendering Manager” (DRM KMS)
To enable DRM we need to add the necessary kernel parameter in the bootloader, each bootloader has a different way to do that.
Using GRUB
Add nvidia-drm.modeset=1
to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub
, it’ll look something like this:
Now you must use these two commands to save the modification into all the installed kernels and update GRUB.
Using systemd-boot
(under development)
Installing Optimus Manager
Installing optimus-manager & Optimus-manager-qt (a system tray for optimus-manager)
The last step, we need to enable and start the service for Optimus manager
You can now reboot, after rebooting, you will have a fully working Optimus Manager, which you can find the icon on the bottom right corner of the taskbar.
Congrats! You are now done with the setup.
Optional configuration
Fully power down the GPU when not in use
PCI-Express Runtime D3 (RTD3) Power Management
Add these rules into /etc/udev/rules.d/80-nvidia-pm.rules
The top three
ACTION=="add"
rules are not needed when running Linux kernel5.5
and newer, see https://download.nvidia.com/XFree86/Linux-x86_64/530.30.02/README/dynamicpowermanagement.html.
Next add the following text to /etc/modprobe.d/nvidia.conf
To apply these changes right now:
Now you need to edit optimus-manager’s configuration file to enable (RTD3) Power Management by adding dynamic_power_management=fine
to /etc/optimus-manager/optimus-manager.conf
Using nvidia-persistenced
Enable nvidia-persistenced.service to avoid the kernel tearing down the device state whenever the NVIDIA device resources are no longer in use.
And finally, reboot your system. Your laptop’s hybrid mode should now work as it does on Windows!