3

I was wondering how can I set my system up so that I can use my nvidia dgpu on difficult tasks and amd igpu for simple tasks. I have managed to make it work on Manjaro, using prime-run, but I can't figure it out on Ubuntu, as I am require to use Ubuntu.

CPU: AMD Ryzen 7: 4800HS GPU: Nvidia GeForce RTX 2060 with Max-Q

lspci | grep VGA output:

01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060] (rev a1) 05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c6)

As far as I know, the best option is prime render offload, but what are the steps to make it work on a fresh Ubuntu 20.04 system? I would really appreciate a step-by-step answer.

lspci -k | grep -EA3 'VGA|3D|Display' output:

01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060] (rev a1)
         Subsystem: ASUSTeK Computer Inc. Device 1e11
         Kernel driver in use: nvidia
         Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
-- 
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c6)
         Subsystem: ASUSTeK Computer Inc. Renoir
         Kernel modules: amdgpu 
05:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Device 1637

I am wondering because glxinfo | grep OpenGL gives:

OpenGL vendor string: VMware, Inc. OpenGL renderer string: llvmpipe (LLVM 9.0.1, 128 bits) OpenGL core profile version string: 3.3 (Core Profile) Mesa 20.0.4 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.1 Mesa 20.0.4 OpenGL shading language version string: 1.40 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.0.4 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

So there is nothings about nvidia.

I have tried different solutions for a week already and nothing worked for me when I used Ubuntu.

I can provide any other information if required.

Thanks in advance!

4
  • I fixed it for you. It looks like amdgpu is not loaded. Did you try to install drivers? It is better not to. Generally AMD+Nvidia doesn't work well with Prime.
    – Pilot6
    Jun 20, 2020 at 11:38
  • @Pilot6 I tried to install Nvidia proprietary driver, but it was already installed, I did not do anything with amdgpu. When I installed the system, I clicked install third party software, so I think that’s where the drivers came from. If prime is not a good option, what would you suggest me to do? Thanks!
    – Bobbie
    Jun 20, 2020 at 11:45
  • I have no idea. There are some questions regarding prime and amd. I didn't see any solutions.
    – Pilot6
    Jun 20, 2020 at 11:47
  • Look at my complete answer below.
    – Oli
    Sep 11, 2020 at 15:34

2 Answers 2

3

First you need to install kernel >=5.8 unless Renoir architecture will not work : you will find this here https://wiki.ubuntu.com/Kernel/MainlineBuilds or easy graphical use from ppa : https://github.com/bkw777/mainline.

Install this 5.8.* kernel first and nvidia driver second.

Second you need Nvidia 450 driver as describe below.

On a clean installation (with no xorg.conf and other options given on others places to xorg) do :

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update sudo
sudo apt dist-upgrade
sudo apt install nvidia-driver-450

After reboot you will be able to launch programs on the Nvidia card with the prefix __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia

__ means _ _ without space.

For example try

$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | egrep "(OpenGL vendor|OpenGL renderer|OpenGL version)"

You should get something like this but with your graphical card (I have geforce 1660) :

$ OpenGL vendor string: NVIDIA Corporation
$ OpenGL renderer string: GeForce GTX 1660 Ti/PCIe/SSE2
$ OpenGL version string: 4.6.0 NVIDIA 450.66

Ans without the prefix, your integrated GPU will be used

$ glxinfo | egrep "(OpenGL vendor|OpenGL renderer|OpenGL version)"
$ OpenGL vendor string: X.Org
$ OpenGL renderer string: AMD RENOIR (DRM 3.38.0, 5.8.8-050808-generic, LLVM 10.0.0)
$ OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.0.8

I don't know how to get the "On-Demand" work but only manually launch.

More information here :

https://us.download.nvidia.com/XFree86/Linux-x86_64/450.57/README/primerenderoffload.html

EDIT : the "On-Demand" is only manuel launch on demand from the eGPU. In linux there is no automatic as in windows.

7
  • Thank you! Does "on a clean installation" imply that I shall click "install third party drivers" during installation or not?
    – Bobbie
    Sep 12, 2020 at 11:25
  • Yes you can install third party drivers : they will help you to boot and after nvidia will be update in 450. "Clean" means that you have no particular xorg modifications for example in /etc/X11/. If you did some modifications you need a clean installation. You can try with your installation and if something is wrong then do a fresh installation. I wrote about my computer here in french : doc.kubuntu-fr.org/asus-a17-tuf766iu If my post solved your problem please mark it as accept. If not I can help you again.
    – Oli
    Sep 12, 2020 at 11:30
  • In your first post OpenGL vendor string: VMware is because your kernel don't support Renoir architecture. After 5.5 kernel update you will get something with AMD Renoir.
    – Oli
    Sep 12, 2020 at 11:41
  • Okay, makes sense, thanks a lot! I will try it in the nearest future when I will be reinstalling the OS.
    – Bobbie
    Sep 12, 2020 at 17:18
  • OK. In my last message I would said "After 5.8 kernel update " (and not 5.5). You can try without reinstalling first. And see what happens...
    – Oli
    Sep 12, 2020 at 17:29
0

I have an AMD iGPU and a NVIDIA eGPU. I manually created a xorg.conf and placed it in /etc/X11 to get both to work together and enable prime offloading.

For prime-offloading the relevant part of xorg.conf is -

Section "ServerLayout"
    Identifier     "layout"
    Option         "AllowNVIDIAGPUScreens"
EndSection

Reboot or restart for the new config to be used by X11.

Then use this __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia [program] to launch [program] on the Nvidia card.

I've created an alias for this in .bashrc so that I don't have to remember it all the time.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .