How do I set one GPU for display and the other two GPUs for CUDA computing?

Hi, I’ve installed three GPUs on a machine running Ubuntu 16.04; and I’ve installed NVIDIA proprietary driver 375.39.

So now I have GPU 0 (TitanX); GPU 1 (GTX1050); GPU 2 (TitanX). By default, it select GPU 0 for display. How can I set GPU 1 for display instead? I want to use GPU 0 and GPU 2 for CUDA computing.

I think you have to set some options in /etc/X11/xorg.conf help you? Hopes the links is appropriate.
do a find (Option “MultiGPU” “string”)
do a find (Option “SLI” “string”)

Run lspci and find out your GPU PCI slot.

Then create /etc/X11/xorg.conf.d/nvidia.conf with this content:

Section "Device"
        Identifier      "Videocard0"
        BusID           "PCI:1:0:0" # This must be what your lspci command gave you
        Driver          "nvidia"
        VendorName      "NVIDIA"

Then connect your monitor to this GPU and reboot your PC or press Ctrl + Alt + Backspace (not enabled on all distros).

Thank you, both sunbearc22 and birdie for providing help! birdie’s method works for me, except that for Linux 16.04, I should create the file in another directory: /usr/share/X11/xorg.conf.d/nvidia.conf

You can use either. /usr/share/X11/xorg.conf.d is for system software to install pieces of configuration data, and /etc/X11/xorg.conf and /etc/X11/xorg.conf.d/ are for the system administrator’s configuration files.

If you put your configuration files in /usr/share/X11/xorg.conf.d, you run the risk of them being overwritten by the package manager. Although the risk of that is probably small. :)

There’s a list of places the server looks for configuration files in the xorg.conf(5) man page.

Thank you Moderator! I see what you mean. However, Ubuntu 16.04 don’t have xorg.conf nor xorg.conf.d/ under the directory /etc/X11. Shall I mkdir /etc/X11/xorg.conf.d, and create the file /etc/X11/xorg.conf.d/nvidia.conf ?

You can just create /etc/X11/xorg.conf or mkdir /etc/X11/xorg.conf.d and put something inside of there. It doesn’t really matter either way.

I have the same issue as the original poster, but the solution given here does not work for me. I am running Linux Mint 18.3 which is based on Ubuntu 16.04. My Nvidia driver version is 384.130. I have two GTX1080’s (GPU0,GPU1) and one GT620 (GPU2) installed in an Asus X299 motherboard. I want to use the GT620 for display and the GTX1080’s for CUDA computing. I tried adding the BusID line for the GT620 (in decimal and hex) to both /etc/X11/xorg.conf and /usr/share/X11/xorg.conf.d/nvidia.conf. BIOS ignores the change and Linux Mint will not start at all. Nothing ever comes out of GPU2. Has something changed in the past year and a half that would require a different solution?
nvidia-bug-report.log.gz (213 KB)

This is still the correct way to make use of a specific gpu.
Please run as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post of yours will reveal a paperclip icon.

Using this xorg.conf should work in your case

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"

Section "Files"

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:179:0:0"
    Option         "AllowEmptyInitialConfiguration"

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24

Thank you for the quick response. I tried your xorg.conf and got the same behavior - hang during startup, GPU2 silent, everything coming out GPU0. Is there anything else I can try?

Then you would have to create an nvidia-bug-report.log while it is hanging to see what is going on. If the console is inaccessible, use ssh.

Is there a way that I can use my 2nd GPU for display while having coolbits enabled on my 1st GPU for fan control? In order to enable manual fan control I need to explicitly enable coolbits on X11/xorg.conf for my 1st GPU but doing that will make Linux use it for display instead of my 2nd GPU.