Ubuntu – NVIDIA GPU1 AMD GPU2. Cant get both drivers to work together on ubuntu 16.04

16.04amd-graphicsdriversgraphicsnvidia

I am trying to set up ubuntu 16.04 to use an amd gpu and a Nvidia gpu at the same time. The amd gpu is a R9 390x and Nvidia a 1070 GTX.

I have been able to install each driver seperatly with one card in at a time without a problem but getting them to work together has been a big problem.

I wish to use the nvidia for display and crypto mining while the amd card just for mining.

I have tried using the instructions from this link :
NVIDIA card for CUDA and AMD card for display on Ubuntu 16.04
But it is using the cards the other way round (AMD for display) and even after following the instructions (but installing the AMD card first and NVIDIA last), I am logged out after trying to log in once I've installed the second/NVIDIA GPU.

Ideally a guide on how to install the AMD driver and then the NVIDIA driver on 16.04 and still have use of both cards (Nvidia as display) is what I need.

It works fine on windows 10 but I haven't had any luck getting them both to work at the same time on Ubuntu even on previous distributions.

Any help would be appreciated!

Best Answer

  1. Assuming no drivers installed and no GPUs installed in computer
  2. Add AMD GPU to computer, launch Ubuntu
  3. Install amdgpu-pro driver
  4. Install nvidia driver (for example via sudo apt install nvidia-384)
  5. Shutdown computer
  6. Add NVidia card to computer, launch Ubuntu
  7. Switch to console mode via Ctrl+Alt+F1
  8. sudo nvidia-xconfig
  9. sudo nano /etc/X11/xorg.conf
  10. Comment or delete all lines except Monitor, Device and Screen sections (edit under root). Example result:
Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
  1. lspci | egrep -h "VGA|3D controller" - remember identifiers at the beginning of each line:
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Hawaii XT [Radeon R9 290X] (rev 80)
02:00.0 VGA compatible controller: NVIDIA Corporation GK110 [GeForce GTX TITAN] (rev a1)
  1. sudo nano /etc/X11/xorg.conf and use these identifiers:
Section "Monitor"
    ... no changes ...
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusId          "PCI:2@0:0:0" # Add this line (identifier 2 taken from lspci output on the previous step)
EndSection

# Add similar section for AMD card:
Section "Device"
    Identifier     "Device1"
    Driver         "amdgpu"
    BusId          "PCI:1@0:0:0" # Identifier 1 taken from lspci output
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"     # This identifier should be from the GPU device connected to display (you need NVidia, so it is Device0) 
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
  1. Shutdown
  2. Connect display to NVidia card
  3. Launch Ubuntu - everything should work

If it doesn’t work - please provide output of lspci | egrep -h "VGA|3D controller", your /etc/X11/xorg.conf and /var/log/Xorg.0.log.

P.S. somebody please guide me how to properly "post" this answer for these similar questions: