Skip to content

Instantly share code, notes, and snippets.

@pyaf
Last active February 24, 2019 11:11
Show Gist options
  • Save pyaf/27952fda5bbc2e0594f5e52416b3b7bb to your computer and use it in GitHub Desktop.
Save pyaf/27952fda5bbc2e0594f5e52416b3b7bb to your computer and use it in GitHub Desktop.
Using only integrated graphics for display and Nvidia GPU for CUDA on Ubuntu 18.04.2

Steps to follow:

  1. Install suitable driver for your Nvidia GPU. Don't worry if nvidia-smi isn't working.
  2. Note the output of lspci | egrep 'VGA|3D', mine gives the following:
00:02.0 VGA compatible controller: Intel Corporation Device 3e92
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1f02 (rev a1)
  1. Edit your /etc/X11/xorg.conf as follows
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
#    Screen 1 "nvidia"
EndSection

Section "Device"
    Identifier "intel"
    Driver "intel"
    BusID "PCI:0@0:2:0"
    Option "AccelMethod" "SNA"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1@0:0:0"
    Option "ConstrainCursor" "off"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "on"
    Option "IgnoreDisplayDevices" "CRT"
EndSection

Replace BusID according to your output of the lspci | egrep 'VGA|3D' command.

  1. Do not play with nvidia-settings let it be checked with Nvidia checkbox.

  2. Reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment