Switching between integrated and dedicated GPUs on a Linux desktop

My old computer is dying so I’m building a new one. A good portion of what I use a computer for would run fine on an iGPU, but for some things (Blender, gaming, etc.) a dGPU is needed.

Given the cost of electricity and that summers here are hot, I was hoping I could “turn-off” the dGPU to save some power and cut back on heat production when it’s not needed.

What I’m thinking is my computer would boot using the iGPU. When I want the dGPU I can activate it and switch monitor input (either an HDMI switch or use the input selector on the monitor). Then when I’m done, switch back to the iGPU.

Specs:
CPU: probably AMD Ryzen 9700X or 9900X
RAM: at least 16GB, aiming for 32GB (RAM prices are painful)
GPU: undecided, waiting for a sale or a used one nearby
OS: Linux

My plan is to buy and build the computer with only an iGPU right now, then soon-ish add the dGPU. I’m still deciding whether AMD or Nvidia would be best for me. I’m pretty sure the method of switching GPUs will vary by dGPU manufacturer as the drivers aren’t the same.

Since I don’t have the hardware, and I don’t even know what GPU manufacturer I will use, I’m mainly asking to get a better idea of how this will work so I can better plan what hardware makes sense for me before I buy something I regret later.

  1. What would be the best way to do this?

  2. This seems to be typical for laptops, but I will have a desktop. Is this process the same for both laptops and desktops?

  3. Any recommendations on what programs/settings would be useful or anywhere I can read more about this kind of thing?

  4. How would I switch between the GPUs inside Linux?

Thank you for any and all help!

The best way to do is on modern Linux desktop is not through physical HDMI switches, but through prime render offloading combined with PCI-express runtime power Management (RTD3) .
This means instead physically activating and deactivating the card, you just plug in your monitor directly into the motherboard to use the IGPU . The OS and desktop environment run fully on the iGPU. The dGPU sits on PCIE bus suspended in a very, very low power state and will only turn on when you launch any that would need dGPU. This how me and buddy did it for his desktop two years ago but thing change, so this might not easy way anymore but it was I did it

The below is just from a quick google search, I couldn’t find anything for intel GPUs tho sorry
How to Switch GPUs Inside Linux (The Simple Way)
For AMD dGPUs (Simplest Setup):AMD’s open-source amdgpu driver handles runtime power management automatically on modern kernels.To launch a program on the dGPU, prepend the command in your terminal or application shortcut with DRI_PRIME=1. Example: DRI_PRIME=1 blenderFor Steam games, right-click the game > Properties > Launch Options and add: DRI_PRIME=1 %command%.

For NVIDIA dGPUs (Requires Configuration):You must explicitly enable dynamic power management for the proprietary driver. Crucially, desktop D3cold power management requires an RTX 20-series (Turing architecture) or newer GPU.You must create a configuration file (e.g., /etc/modprobe.d/nvidia-power-management.conf) containing: options nvidia NVreg_DynamicPowerManagement=0x02. To launch a program, use the prime-run wrapper script, or set the variables manually: __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia blender.

hopefully this helps or someone else knows a better way

3 Likes

AFAIK, you will have to manually switch the monitor cables from dGPU to MB and vice versa. Or use an HDMI switch. I bet that gets old quick.

Plus what was said to actually enable the power savings for the dGPU.

1 Like

Thank you both for the information!

@Kaz777 Your reply contained the right info to kickstart some in-depth searching and make better sense of what I find. So basically how this works is the program that is run with PRIME is using the dGPU and the program’s GUI is passed to the iGPU which handles the display?

For your buddy’s computer, were you using X11 or Wayland? Also AMD or Nvidia? If you can’t remember, no problem.

I haven’t been able to find anything online about this so far. Can you provide any more information or where you got that? In case I need to tweak it, I’d like to see the docs/tutorial.

Thank you very much!

He was using Wayland because X11 requires a bit more hacking with then Wayland does.

Here you are my good person

Here are sources i used but I am assuming ai and google can help you find more

2 Likes

Awesome! Thank you so much!

… I guess I know what I’m reading tonight :wink:

Sorry, I barely know anything about this but I will share one little thing I do know in case it’s of any use; You can make a desktop shortcut to a game or other program and adjust its settings to make it launch with the dedicated GPU. I’ve seen this work on a laptop with Bazzite & KDE Plasma which has a low-power AMD GPU/APU and an Nvidia graphics chip.

Good luck setting this up and please let us know how it goes as this is an interesting idea I wouldn’t mind trying one day.

1 Like

That does help me! Thanks! Switching works, but the card doesn’t go D3cold yet. It’s not used just not cold.

And @BugInTheMug if you want ease of use, go with an AMD GPU. I have one of those last time, and drivers a lot less of a hassle. I you want to do AI stuff, you need ROCm, so that’s a Radeon 7600 or newer (check the compatibility matrix). But those that do ROCm are still rare used and not that cheap :frowning: And that’s why I have Nvidia now.

I think Ryzen X CPUs don’t have iGPUs? That’s required. If you get a G, check PCIe lanes, mine only has PCIe 3.0 and not a lot of them, but I’m still ion AM4. I plug the monitor into the motherboard video out, have GPU set to “auto” in the BIOS (having it set to iGPU or dGPU didn’t allow for switching), and use the iGPU most of the time. This also works with multiple monitors.

For Nvidia, I just went with Bazzite for gaming, and on my daily OS I have it installed in a CUDA-only manner. Use the nvidia repos to get latest drivers, the distro packages can be a bit ugh. I switched myself over to X from Wayland because of installing distro packaged drivers… And you need nvidia-open! This explains it.

As for the GPU switching, on Bazzite it’s done automatically and flawlessly for me. I once installed mint on a laptop, and that automatically added a gpu switcher to the tray with Nvidia logo and all, worked out of the box (but that was older laptop hardware).

I really like this setup, and it’s worth a bit of hassle if needed, the system uses a lot less electricity and runs cooler. If you’re like me and want to minimize power use, the 3050 or 4060 are really cool and efficient choices. 7600 and 9060 were my AMD choices, but those need more power (but are also more performant). If money were no object, I’d just get a 9060 and be done with it.

There is a way doing scripts. Create Toggle Scripts..