[2.0.8 Linux x64] not using dedicated GPU - ubuntu 24.04

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
badgerg
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue Oct 22, 2024 5:56 pm
Contact:

[2.0.8 Linux x64] not using dedicated GPU - ubuntu 24.04

Post by badgerg »

This is an FYI for other Linux users who have both integrated (intel) and dedicated (nvidia) graphics.

I noticed that factorio didn't seem to be using my dedicated graphics. The nvidia-smi utility didn't show the factorio process and the game was running slower than expected. My PRIME profile is set to "Nvidia (Performance Mode)" so I think this should pick up the dedicated GPU automatically.

Code: Select all

$ nvidia-smi
Tue Oct 22 18:47:42 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.107.02             Driver Version: 550.107.02     CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 2060 ...    Off |   00000000:01:00.0 Off |                  N/A |
| N/A   60C    P8              3W /   65W |       7MiB /   6144MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      4632      G   /usr/bin/gnome-shell                            1MiB |
+-----------------------------------------------------------------------------------------+
Setting the following environment as follows fixes this:

Code: Select all

$ cd /opt/games/factorio/bin
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia ./factorio

Code: Select all

$ nvidia-smi
Tue Oct 22 19:04:17 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.107.02             Driver Version: 550.107.02     CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 2060 ...    Off |   00000000:01:00.0 Off |                  N/A |
| N/A   58C    P0             23W /   65W |    3632MiB /   6144MiB |     32%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      4632      G   /usr/bin/gnome-shell                            1MiB |
|    0   N/A  N/A     14235      G   ./factorio                                   3624MiB |
+-----------------------------------------------------------------------------------------+

Blue87
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Oct 02, 2024 5:01 pm
Contact:

Re: [2.0.8 Linux x64] not using dedicated GPU - ubuntu 24.04

Post by Blue87 »

I am on Linux 24.04.1 and appear to have the same issue.

Blue87
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Oct 02, 2024 5:01 pm
Contact:

Re: [2.0.8 Linux x64] not using dedicated GPU - ubuntu 24.04

Post by Blue87 »

Checking "Software & Updates" -> "Additional Drivers" showed I was using a manually installed driver for an RTX 3060.

Installing graphics driver `nvidia-driver-550` and rebooting fixed my issue.

Factorio runs smoothly and `nvidia-smi` shows /bin/x64/factorio.

Gorthunk
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 23, 2024 2:40 am
Contact:

Re: [2.0.8 Linux x64] not using dedicated GPU - ubuntu 24.04

Post by Gorthunk »

I'm also having this issue... but my CPU and GPU are both AMD.

After further testing it's pretty clear that Factorio is for some reason ignoring the dedicated GPU. Setting DRI_PRIME=1 (either when running from terminal or within Steam launch options), disabling secure boot, selecting "run with dedicated GPU," none of the standard solutions I see to resolve general Linux GPU problems seem to help Factorio utilize the GPU. Other games on Steam don't seem to have this problem, though I'm pretty sure the other games I've tested are all running through Proton and/or with Vulkan shaders.

Alright I resolved it. I had to set DRI_PRIME=0 in the launch options.

User avatar
Senacharim
Burner Inserter
Burner Inserter
Posts: 11
Joined: Mon Dec 01, 2014 4:58 am
Contact:

Re: [2.0.8 Linux x64] not using dedicated GPU - ubuntu 24.04

Post by Senacharim »

Having same issue. (Well, similar, nasty screen tearing, which shouldn't happen if vsync is enabled.)

Update to 'nvidia-driver-550' -- no go.

Added 'DRI_PRIME=0 in the launch options.' -- no go.

Started to experimentally sanity check by methodically disable-enable the various graphics options.

Disabled full-screen, and in windowed mode my screen tearing issue was gone!

Re-enabled full-screen, and screen tearing still gone!

Not sure why that fixed it, but after exit and re-launch, the screen tearing issue seems resolved.

Hope this helps somebody.

Edit: NM, issues persists unless I'm in windowed mode. :-(

Gorthunk
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 23, 2024 2:40 am
Contact:

Re: [2.0.8 Linux x64] not using dedicated GPU - ubuntu 24.04

Post by Gorthunk »

Senacharim wrote:
Sat Oct 26, 2024 4:27 am
Added 'DRI_PRIME=0 in the launch options.' -- no go.
Did you try "DRI_PRIME=1" ? That's the standard solution I saw for this problem. I don't know why my case required me to set it to 0, since DRI_PRIME=0 should be the default.

I'm on an AMD card and you're on an NVIDIA card(?), which might be the difference.

User avatar
Senacharim
Burner Inserter
Burner Inserter
Posts: 11
Joined: Mon Dec 01, 2014 4:58 am
Contact:

Re: [2.0.8 Linux x64] not using dedicated GPU - ubuntu 24.04

Post by Senacharim »

Did you try "DRI_PRIME=1" ? That's the standard solution I saw for this problem. I don't know why my case required me to set it to 0, since DRI_PRIME=0 should be the default.

I'm on an AMD card and you're on an NVIDIA card(?), which might be the difference.
(Now on Factorio 2.0.12)
Tried it, no change in graphical woes. Thank you though.

Post Reply

Return to “Technical Help”