我正在使用 Ubuntu 14.04LTS,配备英特尔 CPU + 集成显卡,以及 GTX650 GPU。我在 SO 上问了这个问题,但他们说这与主题无关。
我想使用我的 GPU 来调试 CUDA 代码,为此我需要将显示更改为仅集成。这是我当前尝试调试时收到的错误:
"All cuda devices are used for display and cannot be used while debugging"
我进入 BIOS 并将主显示器切换为 iGPU(集成的 HD4600)。GPU 端口不再显示任何内容(就显示而言),我将显示器插入主板。只有一台显示器可以工作。通常我的显示器如下:
|[Monitor 1, VGA]| |[Monitor 2, DVI]|
在该配置下,使用 iGPU,显示器 1 上不显示任何内容(它是黑色的,但计算机知道它在那里 - 绿灯亮起,我的所有窗口都打开了)。让它工作的唯一方法是将显示器 2 换成 VGA,将显示器 1 换成 DVI。
如果我进入lspci | grep VGA
终端,我会得到以下信息:
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 GK107 [GeForce GTX 650] (rev a1)
跑步xrandr
让我:
Screen 0: minimum 8 x 8, current 3360 x 1050, maximum 16384 x 16384
DVI-D-0 disconnected primary (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
VGA1 connected 1680x1050+0+0 474mm x 296mm
1680x1050 60.0*+
1600x1000 60.0 +
1280x1024 75.0 72.0 60.0
1440x900 75.0 59.9
1152x864 75.0
1024x768 75.1 70.1 60.0
800x600 72.2 75.0 60.3
640x480 75.0 72.8 66.7 60.0
720x400 70.1
DP1 disconnected
HDMI1 disconnected
HDMI2 connected 1680x1050+1680+0 474mm x 296mm
1680x1050 60.0*+
1600x1000 60.0 +
1280x1024 75.0 72.0 60.0
1440x900 75.0 59.9
1152x864 75.0
1024x768 75.1 70.1 60.0
800x600 72.2 75.0 60.3
640x480 75.0 72.8 66.7 60.0
720x400 70.1
HDMI3 disconnected
VIRTUAL1 disconnected
它不是 HDMI 连接,我不知道它为什么会认为它是。有了 GPU,它就知道它是 DVI。无论如何......
这是xorg.conf
(如果我改变它,它只会覆盖它):
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
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
这是我的10-monitors.conf
文件/usr/share/X11/xorg.conf.d/
:
GNU nano 2.2.6 File: /usr/share/X11/xorg.conf.d/10-monitors.conf
Section "Monitor"
Identifier "VGA1"
EndSection
Section "Monitor"
Identifier "HDMI2"
EndSection
Section "Device"
Identifier "intel0"
Driver "intel"
BusID "PCI:0@0:2:0"
EndSection
Section "Device"
Identifier "intel1"
Driver "intel"
BusID "PCI:0@0:2:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "intel0"
Monitor "VGA1"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1680x1050" "1920x1080"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "intel1"
Monitor "HDMI2"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1680x1050" "1920x1080"
EndSubSection
EndSection
这仍然不允许调试我的 CUDA 代码。如果我运行 lsof /dev/nvidia*,我会得到:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
compiz 1659 cinnamon mem CHR 195,255 11805 /dev/nvidiactl
compiz 1659 cinnamon mem CHR 195,0 11806 /dev/nvidia0
compiz 1659 cinnamon 11u CHR 195,255 0t0 11805 /dev/nvidiactl
compiz 1659 cinnamon 12u CHR 195,0 0t0 11806 /dev/nvidia0
compiz 1659 cinnamon 13u CHR 195,0 0t0 11806 /dev/nvidia0
compiz 1659 cinnamon 14u CHR 195,0 0t0 11806 /dev/nvidia0
所以我猜 Compiz(X 服务器?)仍在使用它。我该如何阻止它使用它?
答案1
我已经成功设置了双显示器,一个连接到我的专用 ATI GPU,另一个连接到 i7-2600K iGPU。
为了做到这一点,我跑了
xrandr --setprovideroutputsource 1 0
它曾经运行得完美无缺,但现在仍被认为是实验性的,并且从那时起经过了几次内核升级,YMMV。
答案2
这专门用于配置 xorg 从集成 gpu 工作:
重要的是要知道 xrandr 无法在它看不到的任何图形显示上工作,这是由 xorg 配置设置的。https://unix.stackexchange.com/questions/146842/regenerate-xorg-conf-with-current-settings
Xorg -configure
或“您可以指定使用哪个显示器Xorg :1 -configure
“这将创建文件 /root/xorg.conf.new,然后您可以将其复制到 /etc/X11/xorg.conf:cp /root/xorg.conf.new /etc/X11/xorg.conf
”https://fedoraproject.org/wiki/How_to_create_xorg.conf”