当桌面使用 intel 显卡时,使用 nvidia for cuda

当桌面使用 intel 显卡时,使用 nvidia for cuda

我正在运行带有 nvidia 驱动程序的 Pop!_OS 19.04。当我从 gnome 菜单启动到“NVIDIA Graphics”时,一切正常。

$ nvidia-smi 
Mon Sep  9 17:06:06 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 435.21       Driver Version: 435.21       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 105...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   49C    P0    N/A /  N/A |    681MiB /  4040MiB |      3%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1614      G   /usr/lib/xorg/Xorg                            72MiB |
|    0      2293      G   /usr/lib/xorg/Xorg                           150MiB |
|    0      2438      G   /usr/bin/gnome-shell                         385MiB |
+-----------------------------------------------------------------------------+

但我还想在启动“Intel Graphics”时使用 nvidia(用于 cuda)。但随后它说:

$ nvidia-smi 
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

我另外安装了nvidia-headless-no-dkms-435,但这并没有解决问题。我可以在使用英特尔显卡时同时切换到 nvidia 显卡并获得 nvidia headless/cuda 吗?

答案1

这是可能的,感谢askubuntu上的这个天才家伙:https://askubuntu.com/questions/1158036/avoid-using-nvidia-card-for-xorg-with-plasma

解决方案是将 /usr/share/X11/xorg.conf.d/11-nvidia-prime.conf 替换为

# DO NOT EDIT. AUTOMATICALLY GENERATED BY gpu-manager

Section "OutputClass"
    Identifier "Nvidia Prime"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "IgnoreDisplayDevices" "CRT"
    # Option "PrimaryGPU" "Yes"   <<< commented out
    ModulePath "/x86_64-linux-gnu/nvidia/xorg"
EndSection

相关内容