I have an Intel onboard GPU and NVIDIA GPU. I am running Ubuntu 18.04.
How do I configure a dual GPU setup so that Intel onboard iGPU will drive the monitor, leaving NVIDIA GPU exclusively for Machine Learning CUDA work?
I have an Intel onboard GPU and NVIDIA GPU. I am running Ubuntu 18.04.
How do I configure a dual GPU setup so that Intel onboard iGPU will drive the monitor, leaving NVIDIA GPU exclusively for Machine Learning CUDA work?
I first installed NVIDIA drivers and CUDA packages following this guide. Except, after a reboot I ended up with
/usr/lib/xorg/Xorg
showing up in the output ofnvidia-smi
. This wasn't good, since I needed to have all of NVIDIA GPU RAM available to my work.After some research I found a solution that solved my problem:
I created
/etc/X11/xorg.conf
with the following content:(if you try to do the same, make sure to check where your GPU is. Mine was on
00:02.0
which translates toPCI:0:2:0
)After rebooting, xorg and other programs no longer appeared in the output of
nvidia-smi
. And I was able to use pytorch with CUDA-10.0.Note, that I still have all the NVIDIA drivers installed, but they don't interfere.
update: for Ubuntu 20.04 some extra changes are needed for this to work. You will find the full details here.
Let me share my recipe which helped me on Razer Blade 15 laptop with Arch Linux and Gnome desktop environment.
Initially I started Gnome with Wayland session which at that time was incompatible with NVIDIA driver, so naturally I had integrated graphics adapter for display and NVIDIA GPU for deep learning. But after recent update GDM session started to fallback to Xorg with NVIDIA GPU as primary GPU. The problem was that:
I ran
nvidia-smi
after startup. I expected to seeNo running processes found
, but I saw a list ofXorg
processes that used my NVIDIA GPU. That means Gnome Display Manager used Xorg session with NVIDIA GPU as primary GPU.I examined
/var/log/Xorg.0.log
:(**)
means that the setting had been read from config file! I found out that the config file was/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf
. I changed the config file to set Intel integrated graphics adapter as primary GPU:As I don't have the reputation to comment I share here results related to the answer of Maksym Ganenko: I tried the solution on my ubuntu 18.04 where I run gdm3 with kde-plasma or ubuntu. The file you mentioned
/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf
is on my system called/usr/share/X11/xorg.conf.d/11-nvidia-prime.conf
, probably because I had nvidia-prime installed for some time. The problem with editing this file is the fact that on my installation /usr/bin/gpu-manager is generating this file when starting a new xsession and so all edits are lost. As described here avoid using nvidia card for Xorg with plasma following the advice given here gpu-manager overwrites xorg.conf the solution is to protect the generated file against changes by means ofCould be a chmod 444 would do the same thing, but I simply used the solution proposed in gpu-manager overwrites xorg.conf.
I would like to add another way in which I am currently preventing Nvidia card from handling my display. I am simply booting to gnome by selecting Wayland instead of Xorg. Since Nvidia does not support Wayland, after logging in, nvidia-smi shows no process running.
However, I can still use Nvidia for stuff like Tensorflow.