如何使用 2 个带有集成显卡和 Nvidia 的显示器来运行 cuda?

如何使用 2 个带有集成显卡和 Nvidia 的显示器来运行 cuda?

最近几天,我花了大部分时间尝试在我的 PC 上设置 cuda。我有一台 MSI GE63VR,配备 Geforce 1070,我希望用它来通过 cuda 进行机器学习计算。我的 PC 有双启动 ubuntu 18.04 和 windows 10。

我通常的“工作环境”包括我的笔记本电脑和一块额外的屏幕。我想使用英特尔集成显卡在我的两个屏幕上显示,并使用我的 nvidia 卡来运行 cuda。

经过几个小时的麻烦,我终于在笔记本电脑上安装了 cuda 和可用的 nvidia 驱动程序。为了不使用 nvidia 进行显示,我按照本教程说明修改了 xorg.conf 文件(位于 /etc/X11):https://gist.github.com/wangruohui/bc7b9f424e3d5deb0c0b8bba990b1bc5

我的 xorg.conf 包括:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "intel"
    VendorName     "Intel Corporation"
    BusID          "PCI:0:2:0
EndSection

按照教程中的建议操作。这在我的笔记本电脑屏幕上运行良好(我可以使用 nvidia-smi,并且 1070 不用于显示),但我无法使用我的额外屏幕。当我插入 hdmi 电缆时什么都没有出现。您知道如何修改 xorg.conf 才能使用我的额外屏幕吗?

我已经在另一台不是我设置的笔记本电脑上使用了英特尔集成显卡进行多屏显示,并使用 nvidia 进行 cuda。在这种情况下,nvidia xserver 配置的主要配置文件是英特尔显卡,但您仍然可以使用 nvidia-smi 并使用 cuda。要实现这一点,必须添加:

PATH=$PATH:/usr/local/cuda-9.1/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.1/lib64

到他的 .profile 我在我的 MSI 上尝试过,但我无法使用 nvidia-smi,并收到错误:

NVIDIA-SMI 失败,因为它无法与 NVIDIA 驱动程序通信。总而言之,我希望能够使用我的英特尔显卡在笔记本电脑屏幕和额外的显示器上进行显示。我的理解是,有两种方法可以实现这一点:-使用 nvidia 作为主要设备,但修改 xorg.conf 以便能够使用 2 个显示器和英特尔显卡。-使用英特尔作为主要设备,但做“一些事情”以便仍然能够调用 nvidia-smi 并使用 cuda。

对于上述任何一种解决方案,任何帮助都将不胜感激。

编辑:自从我发布这篇文章以来,我发现我的 HDMI 端口在我的 nvidia 上。我更改了我的 Xorg.conf,以强制模式设置 xorg 驱动程序加载,而不是我的 GTX1070 的 nvidia 驱动程序。当我执行 xrandr 时,我可以看到我的 HDMI 已连接,但当我这样做时xrandr --output HDMI-1-1 --mode 1920x1080,我收到错误:xrandr: Configure crtc 4 failed

这是我的新 Xorg.conf:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "intel"
    VendorName     "Intel Corporation"
    BusID          "PCI:0:2:0
EndSection

Section "Device"
    Identifier     "nvidia"
    Driver         "modesetting"
    BusID          "PCI:0:1:0"
EndSection

这是的输出xrandr --listproviders

Providers: number : 2
Provider 0: id: 0x89 cap: 0x9, Source Output, Sink Offload crtcs: 4 outputs: 2 associated providers: 1 name:Intel
Provider 1: id: 0x45 cap: 0x2, Sink Output crtcs: 4 outputs: 2 associated providers: 1 name:modesetting

最后,这是 lspci 的输出:

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 05)
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31)
00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA Controller [AHCI mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1)
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #5 (rev f1)
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #7 (rev f1)
00:1c.7 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #8 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
00:1f.3 Audio device: Intel Corporation CM238 HD Audio Controller (rev 31)
00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)
01:00.0 VGA compatible controller: NVIDIA Corporation GP104M [GeForce GTX 1070 Mobile] (rev a1)
02:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)
03:00.0 USB controller: ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5250 PCI Express Card Reader (rev 01)
05:00.0 Ethernet controller: Qualcomm Atheros Killer E2500 Gigabit Ethernet Controller (rev 10)

答案1

同时,您发现 HDMI 端口仅物理连接到 nVidia 适配器,因此您必须选择:

  • 使用 CUDA 并仅使用内部显示器
  • 使用连接到 HDMI 端口的外部显示器并失去 CUDA 功能。

由于您有一台笔记本电脑,因此添加额外的卡是不可能的。

笔记:根据您的笔记本电脑手动的您还有一个 Mini Display Port,但根据 MSI 论坛,它也连接到 nVidia,所以这也不是一个选项。

相关内容