13

If I'm using my GPU for CUDA computations and I want to use my CPU to manage the display, is there a way to get Xorg to use the CPU and the motherboard's HDMI slot instead of the GPU and its HDMI slot? Right now I'm maxing out the computational power of my GPU and Unity is really slow but my CPU is idling.

  • you can let xrandr show you a list of outputs availible with xrandr --current if you then identify the HDMI output of your mainboard you could set that as primary

    if you use a APU with dedicated GPU you would need a switching method most likely try looking up hybrid solutions like bumblebee

    – WooJoo Jan 08 '17 at 16:22
  • I think prime-select intel should do the trick. After that you have to logout/login. – Thomas Jan 08 '17 at 16:58
  • 1
    I do not think this is a laptop so not sure bumblebee is relevent is sounds like @john standford is describing a desktop. Does your cpu and motherboard support pcie passthrough to a vm and run unity on the host with the integrated. – ianorlin Jan 08 '17 at 20:54
  • Correct, it's a desktop, so the prime-select idea didn't work. I tried it and I had to start back up in recovery mode to put it back how it was. I'm not sure if my motherboard supports PCIE passthrough to a VM, but it's an ASUS Z170 Sabretooth S. – John Stanford Jan 08 '17 at 23:33
  • 3
    I'm looking for an answer to this question as well. In my case this is a server where GPUs are dedicated to computation, graphics is irrelevant (only necessary for the console). I don't want the Xorg processes taking GPU memory, they should just run on the CPU. – David Parks Jul 10 '18 at 00:03
  • 1
    In the old days when GPU are not that much supported, it is possible to setup Xorg to use framebuffer which is all CPU rendered. If you can remove all GPU drivers from Xorg and install only the framebuffer driver. That may be something to try. – Bernard Wei Jul 13 '18 at 18:05
  • 1
    I need the Nvidia GPU drivers installed. The server I have has 2x 1080 GPUs that we use for applications. Currently, Xorg is using ~1GB of memory on one of the two GPUs. There is no integrated graphics card on the server. – David Parks Jul 16 '18 at 20:29
  • Related question: How to configure igpu for xserver and nvidia gpu for cuda?. For a temporary workaround you could also temporarily close the X server and work from the virtual terminal. – user202729 Apr 25 '25 at 01:34

2 Answers2

4

This answer: Use integrated graphics for display and NVIDIA GPU for CUDA on Ubuntu 14.04 appears relevant for you.

In summary setting up /etc/X11/xorg.conf as follows:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
    Screen 1 "nvidia"
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

Read the entire post for more details.


Reply to comments

According Asus Canada specs:

Integrated Graphics Processor- Intel® HD Graphics support Multi-VGA output support : HDMI/DVI-D/RGB/DisplayPort ports - Supports HDMI with max. resolution 4096 x 2160 @ 24 Hz / 2560 x 1600 @ 60 Hz - Supports DVI-D with max. resolution 1920 x 1200 @ 60 Hz - Supports RGB with max. resolution 1920 x 1200 @ 60 Hz - Supports DisplayPort with max. resolution 4096 x 2304 @ 60 Hz Maximum shared memory of 512 MB Supports Intel® InTru™ 3D, Quick Sync Video, Clear Video HD Technology, Insider™ Supports up to 3 displays simultaneously DP 1.2 Multi-Stream Transport compliant, supports DP 1.2 monitor daisy chain up to 3 displays

I suggest temporarily taking out your two nVidia cards, plugging a monitor into the on-board HDMI port and booting with a Live USB to runs tests with Ubuntu.

It is important to know your CPU. Discover this using:

cat /proc/cpuinfo | grep 'model name'

and report back.

  • We're looking for CPU though, no graphics card, there is no integrated graphics card in my case. Unfortunately, the link isn't loading at the moment. I'll try looking later. The GPU in my case should be dedicated entirely to distributed scientific compute purposes. – David Parks Jul 16 '18 at 17:41
  • 1
    Most CPUs have integrated GPUs. What CPU do you have? – WinEunuuchs2Unix Jul 16 '18 at 19:52
  • Reading other comments I see you have a build it yourself motherboard and you can through a Skylake inside. I have an i7-6700HQ and the HD 530 graphics are so fast I leave the nVidia GTX 970M turned off. – WinEunuuchs2Unix Jul 16 '18 at 20:01
  • This server doesn't have an integrated GPU (lspci | grep VGA only shows 2 Nvidia 1080's). It's a (typically) headless server that shouldn't have the ~1GB memory allocated for X windows (we do use the full 10GB of GPU memory for applications). – David Parks Jul 16 '18 at 20:10
  • 1
    @DavidParks I did some more research and updated my answer. It's important to know your CPU model though. – WinEunuuchs2Unix Jul 17 '18 at 02:22
  • Doesn't work in my case. Session fails to start and I'm sent back to the login screen. Have an i7-7700k CPU, Ubuntu 16.04. – levesque Oct 19 '18 at 17:29
  • A bit late but might help somebody. @levesque if you get stuck in the "Login Loop" you need to access the edited file to reset it. You can do this by circumventing the GUI of Ubuntu. At the Login screen hit Ctrl + Alt + F3. Then do sudo -i, followed by cd /etc/X11. Here you need to use a non-GUI editor, e.g., nano xorg.conf. From there you can reset the appropriate lines in the conf file. Then hit Ctrl+O to save it and Ctrl+X to exit Nano. Then do Ctrl+Alt+F7 to exit the terminal back to the Login screen. From here you need to reboot the computer. Now you should be able to login again. :) – Stromael Apr 29 '19 at 09:36
0

You can use modesetting driver.

Warning

Running a misconfigured X server may freeze the computer in such a way that Ctrl+Alt+F3 no longer switches to virtual terminal.

You have a few options:

  • Boot into recovery mode or USB etc.
  • If you have a sshd running on the computer, you may try to ssh into it using a different machine, delete the incorrect configuration file, and reboot.
  • I use the following. Open virtual terminal 4, type while sleep 120; do chvt 4; done &. That way, if something goes wrong, just wait for 2 minutes and you'll get back to virtual terminal 4.

Also useful to know: Hold down Alt, press SysRq, then press Enter (or any unrecognized key) will print out a help menu, which says you can press b to reboot (as long as Alt remains held).

Use modesetting driver

The documentation can be found at man modesetting.

Caveat: On my machine, sometimes the screen randomly freezes with

[~]$ sudo dmesg
[ 6048.632746] [drm:nv_drm_atomic_commit [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00004700] Flip event timeout on head 1

and I don't know why. Still, it mostly works… I think.

For safety measure, you may want to turn off all but one monitor, if you have multiple.

Steps

Make sure xserver-xorg-video-modesetting package is installed.

Create a new file /etc/X11/xorg.conf.d/10-software-driver.conf with the content

Section "Device"
    Identifier "randomname"
    Driver     "modesetting"
    Option     "AccelMethod" "none"
EndSection

Then restart the X server. In a virtual terminal:

sudo service gdm restart

You may want to ps -f -p $(pgrep gdm). If you see gdm-x-session then X server is probably correctly configured, if you see gdm-wayland-session then probably not.

If X server is correctly started, you may want to check that the GPU is indeed not used by

nvidia-smi

If No running processes found is seen, it is working.

Troubleshooting

The log for X server can be found from journalctl. The following conveniently shows the log of the last start of X server:

journalctl -b | tac | sed '/X Server/,$d' | tac | less

It can also be found in /var/log/Xorg.*.log or ~/.local/share/xorg/Xorg.*.log.

Use fbdev driver (failed attempt)

There are some guide to use fbdev instead. So far I have tried this, but it doesn't work. First install package xserver-xorg-video-fbdev. Then in /etc/X11/xorg.conf.d/10-software-driver.conf put

Section "Device"
    Identifier "randomname"
    Driver     "fbdev"
    Option     "fbdev" "/dev/fb0"
    BusId      "pci:71:00:0"
EndSection

Supposedly the BusId is obtained by

[~]$ lspci | grep VGA
47:00.0 VGA compatible controller: NVIDIA Corporation TU117GLM [Quadro T1000 Mobile] (rev a1)

and convert 0x47 to decimal = 71.

Also on my machine head -c10000000 /dev/urandom > /dev/fb0 in a virtual terminal does fill the screen with random content. Still, it doesn't work.

I already fixed the following issues

  • after seeing (EE) no screens found(EE) and (EE) No devices detected., I add the BusId correctly
  • because I get (EE) open /dev/fb0: Permission denied, I read man Xorg.wrap, and modify /etc/X11/Xwrapper.config to add needs_root_rights=yes; and also add the relevant users to video group

It still doesn't work with error messages (EE) FBDEV(0): FBIOPUTCMAP: Device or resource busy which I don't know how to fix.

Other drivers (failed attempt)

I tried vesa or nouveau, but some error happens and X chooses to use nvidia driver anyway.

  • Reportedly some other user https://askubuntu.com/questions/1266456/xorg-fbdev-driver-etc-x11-xorg-conf-dosent-work-in-ubuntu-18-04 report fbdev work in a previous version but not newer version. – user202729 Apr 28 '25 at 10:55