Explicitly choosing which GPU to use

Basically I have a system with several dedicated NVIDIA graphics cards (not integraded-dedicated GPU setup for laptops), and I want to be able to tell Unreal which one to use on an per-launch basis. That means that I don’t want to change NVIDIA settings each time I want an app to run on a different GPU, and I definitely don’t want to go to BIOS. Is there any way to do this? I’ve seen games on other engines having an ability to choose GPU in their in-game settings, but none of them were running on any version of UE.

Turns out, there is a console variable for that — r.GraphicsAdapter, set in Engine.ini or DefaultEngine.ini when in editor.

It would be nice if there were a way to specify the GPU to use at launch via the command line. Is that possible?

Hmm I’ve only seen -preferintel and -prefernvidia as command-line options (To switch between integrated and dedicated). But I haven’t gone deep into the code.

It would be quite handy to have a way to set this at runtime via command-line arguments or environment variable without having to edit an INI file for scripting purposes, especially in Linux.

EDIT: looks like adding r.GraphicsAdapter=2 to CarlaUE4/Saved/Config/LinuxNoEditor/Engine.ini has no impact, CARLA (UE4 powered) is still running on GPU 0 on my Ubuntu 16.04 machine

EDIT 2: Other users are reporting the r.GraphicsAdapter setting not working, tried it in ConsoleVariables.ini as well.

I figured out how to select a specific gpu in UE5!!

CleanShot 2022-04-26 at 00.31.15


This is working only on a mac if I’m not mistaken :frowning:
Does anyone have luck on win? I have 2 nvidias - old and new and I am not able to use the new one, since it is not the primary system GPU.

1 Like