Table of Contents

Ubuntu - GPU - Specify which GPU should take priority

GPU-intensive applications should be rendered on the more powerful discrete card.

If more than one GPU is install, you can specify which one should be used.


Get the list of GPU drivers

See Check the list of attached graphic drivers

Let's assume you receive this result:

xrandr --listproviders
 
Providers: number : 2
Provider 0: id: 0x7d cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 3 outputs: 4 associated providers: 1 name:Intel
Provider 1: id: 0x56 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 1 associated providers: 1 name:radeon

Change using the name

xrandr --setprovideroffloadsink radeon Intel

Change using the Provider Index

xrandr --setprovideroffloadsink 1 0

Usage

Use a specific card for the applications that need it the most, such as games.

To select the card with Provider 1, prepend DRI_PRIME=1:

DRI_PRIME=1 glxinfo | grep "OpenGL renderer"

returns

OpenGL renderer string: Gallium 0.4 on AMD TURKS

NOTE: Other applications will still use the default first card.

These settings are also lost once the X server restarts. You may want to make a script and auto-run it at the startup of your desktop environment (alternatively, put it in /etc/X11/xinit/xinitrc.d/).

This may reduce your battery life and increase heat though.


References

https://wiki.archlinux.org/index.php/PRIME