Skip to content

Instantly share code, notes, and snippets.

@SwaySZ
Last active January 6, 2022 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SwaySZ/b17c7e8c4d343a64917ca44c98be871f to your computer and use it in GitHub Desktop.
Save SwaySZ/b17c7e8c4d343a64917ca44c98be871f to your computer and use it in GitHub Desktop.
Use Intel GPU for display & Nvidia GPU for CUDA computation

A very straightforward way is to set the BIOS to use your onboard device (i.e., Intel graphics) if possible. Your Nvidia card will be powered but 100% idle. Tested on Intel UHD graphics 630 on Ubuntu 20.04.3, and the Nvidia driver is the latest 495.46.

  1. CAUTION: connect your monitor to the onboard port rather than the Nvidia card.
  2. If you have fuzzy desktop, then try to uninstall intel driver by sudo apt purge xserver-xorg-video-intel.
  3. Install the Nvidia driver with the official .run file with the option "--no-opengl-files". (No need to use this option. If you did, you would miss some libs like optix.)
  4. For the problem "unable to load nvidia-drm", you may blacklist nvidia, e.g., by using prime-select intel. Check the blacklist under /lib/modprobe.d/.
  5. Using modprobe to load kernel modules.
  6. Using rmmod to unload a kernel module.
  7. Using lsmod to see what kernel modules have been loaded.

The file xorg.conf at /etc/X11/ may read as:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0:2:0" 
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment