How to configure Steam to use your discrete GPU when running games

This post will walk you through the configuration of Steam to use your discrete GPU when running games. First, I will give the detail of the libraries to install if you have an Nvidia video card. We will eventually run a game on Steam and check that it runs on your discrete GPU.

Install drivers

Start by installing bumblebee. This package includes optirun. If you prefix any program with optirun, it will use your discrete GPU if necessary.

Install the drivers for your GPU. Also install 32-bit drivers since most Steam games are 32-bit.

If you have an Nvidia video card, the proprietary Nvidia drivers nvidia and lib32-nvidia-utils work well.

Steam

Install

Install steam and ttf-liberation packages.

ttf-liberation is the font used by Steam.

If you are running Arch Linux, you may have to enable the multilib repository by appending those lines to /etc/pacman.conf.

[multilib]
Include = /etc/pacman.d/mirrorlist

Configure

Reboot your system.

Install the game you want to play. Find it in the left drawer: Right click → Properties → Set Launch Options. Fill the field with this command.

LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 optirun %command%

Play!

Run nvidia-smi command to monitor your GPU activity.

$ watch -n 1 nvidia-smi

Then run your game through Steam.

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.57                 Driver Version: 410.57                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce MX150       On   | 00000000:01:00.0 Off |                  N/A |
| N/A   49C    P0    N/A /  N/A |    196MiB /  2002MiB |     88%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     12734      G   /usr/lib/Xorg                                 35MiB |
|    0     12736      G   ...ocketleague/Binaries/Linux/RocketLeague   159MiB |
+-----------------------------------------------------------------------------+

The game pop up in the process list, confirming the use of the discrete GPU.

comments powered by Disqus