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!

Pilot6
  • 92,041
Bobbie
  • 35

2 Answers2

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.

Oli
  • 186
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.

gautam
  • 1