(I am aware that questions about doing this specific task have already been answered numerous time here. However there doesn't seem to have much information for this specific version of Ubuntu, and having myself tried multiple methods unsuccessfully, I think creating an entry here is necessary.)
Description
I would like to use my desktop computer's NVIDIA GPU to debug and run some CUDA programs. Since software preemption is a little deceiving, I decided I'd switch display to my unused Intel iGPU and use the NVIDIA card exclusively for the CUDA computations.
I'd like to know what would be the most efficient way to do so with my current Ubuntu and CUDA version.
I'd also like if possible to switch the display the easiest way back to NVIDIA when I'm done.
Attempted methods
- Switching profiles using NVIDIA PRIME from NVIDIA X server settings isn't possible as the entry isn't available
- Using
prime-select intel
crashed Ubuntu on next boot, had to chroot into it and launchprime-select nvidia
to fix*
* Attempted with a slightly older NVIDIA driver version.
Additional information
lspci | egrep 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2)
cat /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 455.45.01
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection
Section "Files"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection
- Ubuntu version: 20.04
- Kernel Version: 5.4.0-57-generic
- NVIDIA Driver version: 455.45.01
- CUDA version: 11.1
- NVIDIA GPU: GTX 750Ti
- Intel iGPU: Intel 4600HD