Ubuntu – NVIDIA card for CUDA and Intel integrated card for display on Ubuntu 16.04 (Dell xps 9560)


I am using Ubuntu 16.04, on a dell XPS 9560 a laptop which is highly compatible with linux. This laptop provides two graphic cards:

  • NVIDIA GeForce GTX 1050
  • Intel HD Graphics 630

I wanted to use NVIDIA card only for CUDA, since it only have 4GB of RAM and the Intel Card for the graphical user interface.


  • If it works the nvidia card is no longer visible. So if I call nvidia-smi the video card is disabled.
  • If do not works I get a black screen.

Best Answer

The solution is based on this GitHub gist

Information on my system:

  • Dell XPS 9560
  • I have already installed the CUDA 9.2 and Nvidia display driver 396.37
  • Ubuntu kernel is 4.15.0-24-generic
  • I am using gd3

Step 1

Modify the GRUB configuration by editing this file:

sudo vim /etc/default/grub

And change:



GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_rev_override=1"

Finally update GRUB using this command:

sudo update-grub

If you want you can use the tool grub-customizer by adding the text highlighted in blue:

GRUB editor screen - text added to line beginning linux

Restart your computer - very important!!

Step 2

Create a service that will select the Intel GPU when the computer turns off, to this end create a new file:

sudo vim /etc/init.d/intel-gpu

With this content:

# /etc/init.d/intel-gpu

# Provides:          intel-gpu
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Selects the intel GPU over the NVIDIA

case "$1" in 
        /usr/bin/prime-select intel
        echo "Usage: /etc/init.d/intel-gpu start|stop"
        exit 1

exit 0

Add executable rights:

sudo chmod +x /etc/init.d/intel-gpu

And register the new service:

sudo update-rc.d intel-gpu defaults

Step 3

Now we have ensured that when we start the computer the lightdm, gdm3, etc will use the Intel GPU since we have been enabled this GPU last time that we turned off the computer. Now we have to enable the NVIDIA GPU when we log into our account. However we need root access to do this and we don't want to prompt a window asking for a password each time we log in. To overcome this problem, we will create a command alias into the sudo configuration file.

First of all open the sudo configuration file using the following command:

sudo visudo

Then append this content to the end of the file:

User_Alias ADMINS = <your_user>
Cmnd_Alias PRIME_SELECT = /usr/bin/prime-select

where <your_user> is your user name.

This allows us to call prime-select without having to introduce a password.

Step 4

Add an autostart script to change the graphics card to NVIDIA once the lighdm has already started using the Intel's GPU. To this end append this command create a new file like this:

vim ~/.config/autostart/nvidia-gpu.desktop

And add this content:

[Desktop Entry]
Exec=sudo prime-select nvidia

Restart you computer

Now you can use all the memory in your NVIDIA GPU. You can verify that by calling the command `nvidia-smi:

nvidia-smi output