14

I'm using

Kubuntu 19.10
Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
NVIDIA UNIX x86_64 Kernel Module  435.21

and since Kubuntu has dropped bumblebee I was looking for another possibility to use nvidia driver per application. Thus, I came to the "PRIME Render Offload" issue, but I do not really understand how it works, even though I've read through NVIDIA Accelerated Linux Graphics Driver README and Installation Guide.

When I choose prime-select intel I can work exclusively using my intel on-chip graphics, whereas using prime-select nvidia I will be able to use exclusively nvidia GPU, while I have to reboot when selecting respectively. When I choose prime-select on-demand, I can call nvidia-smi, and it will show up as ...

    Wed Nov 13 15:35:06 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 435.21       Driver Version: 435.21       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce 940MX       Off  | 00000000:02:00.0 Off |                  N/A |
| N/A   36C    P8    N/A /  N/A |      0MiB /  2004MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

but, I cannot verify, if I can really "use" the nvidia GPU, e.g. when calling glxinfo or glxgears I got the info that it does not use nvidia GPU. I also tried what is given in the NVIDIA Readme above, e.g. __NV_PRIME_RENDER_OFFLOAD=1 glxgears, but I cannot prove that the nvidia GPU is used. I fear that the prime-select on-demand option is not really working, or - what is definitely an option - I do not really understand how it works.

Thus, please, could anyone be so kind to help me here and de-mystify this?

Zanna
  • 72,312
George
  • 243
  • 1
  • 2
  • 5

2 Answers2

8

This is a confusing new 'option' that isn't described and generally of no use to most users. The bug report that lead to this being added stated -

"Per current NV and intel GPU driver, if we load nvidia.ko only, we can do display on intel GPU and leave the NV to deep learning for a graphic workstation."

Report here - https://bugs.launchpad.net/ubuntu/+source/nvidia-prime/+bug/1824282

Bug filed about how poorly this was implemented here -

https://bugs.launchpad.net/ubuntu/+source/nvidia-settings/+bug/1851416

doug
  • 17,212
7

In ubuntu 19.10 xorg needs some patches that are only available for 18.04 and 19.04 here You can read all information here

first you need to remove intel drivers to use software based rendering (modeseting aka llvmpipe renderer). Install latest drivers from this ppa and finally, compile/install patched xorg.

The easiest solution today is upgrade to ubuntu 20.04 and install nvidia drivers

sudo ubuntu-drivers install

I explicitly configure the iGPU and dGPU devices in xorg.conf.d (BusID could be different in other systems):

$ sudo cat /etc/X11/xorg.conf.d/20-intel.conf 
    Section "Device"
      Identifier  "Intel Graphics"
      Driver      "intel"
      Option      "AccelMethod"    "sna"
    EndSection

$ sudo cat /etc/X11/xorg.conf.d/90-nvidia.conf Section "ServerLayout" Identifier "layout" Screen 0 "iGPU" Option "AllowNVIDIAGPUScreens" EndSection

Section "Device"
  Identifier "iGPU"
  Driver "modesetting"
  BusID          "PCI:0:2:0"  
EndSection

Section "Screen"
  Identifier "iGPU"
  Device "iGPU"
EndSection

Section "Device"
  Identifier "dGPU"
  Driver "nvidia"
  BusID          "PCI:3:0:0"  
EndSection

... reboot and get prime working:

$ offload-glx glxinfo | grep "OpenGL renderer"
OpenGL renderer string: GeForce 940M/PCIe/SSE2

$ glxinfo | grep "OpenGL renderer" OpenGL renderer string: Mesa Intel(R) HD Graphics 5500 (BDW GT2)

offload_glx comes from mate-prime-select and is an alias of this: __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears

So install nvidia drivers, and configure xorg.