Running an application on Nvidia card

Hi guys,

Spent 2 days trying to figure out how to launch an application which uses my Nvidia graphics card but not able to figure it out. I have installed the nvidia drivers and nvidia-prime and am able to run cuda samples successfully. But I am not sure how i can run say blender or freecad using the nvidia graphics.

Many of the tutorials mention prime-run but i cannot find that executable anywhere. I have followed the tutorial on prime render offload and installed the X server from the mentioned PPA. It mentions about glamoregl in the /var/log/Xorg.0.log which is not present in my case. Not sure how to install that as well.

I installed the latest nvidia drivers from the run file using command
sudo ./NVIDIA-Linux-x86_64-430.09.run --dkms --no-opengl-files

The following command gives output

__NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)

Not sure what I am missing. Any help would be appreciated.

Setup details:
Lenovo Y540
Ubuntu 18.04
5.3.0-53-generic #47~18.04.1-Ubuntu
core i7 9750
Nvidia 1660Ti 6GB

also the sudo nvidia-settings gives the following output.
ERROR: Unable to load info from any available system

lsmod | grep nvidia
nvidia_drm             49152  1
nvidia_modeset       1105920  1 nvidia_drm
nvidia              18489344  4 nvidia_modeset
drm_kms_helper        180224  2 nvidia_drm,i915
drm                   491520  18 drm_kms_helper,nvidia_drm,i915
ipmi_msghandler       102400  2 ipmi_devintf,nvidia
i2c_nvidia_gpu         16384  0

nvidia-smi 
Sun May 24 19:26:44 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.09       Driver Version: 430.09       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 GTX 166...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   46C    P8     3W /  N/A |      1MiB /  5944MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Attached output of sudo nvidia-bug-report.sh and renamed extension to .log
nvidia-bug-report.log (222.7 KB)

  • nomodeset kills the intel card so an Optimus system doesn’t work
  • the 430 driver doesn’t support render offload
  • don’t use the .run installer, especially not on an Optimus notebook
  • just install the 440 driver from repo
  • latest xorg server doesn’t need patches for offloading, it’s included
    Either revert anything you did or do a clean reinstall, then upgrade to the latest hwe and check if you got xorg 1.20.8

I did a clean install of ubuntu 18.04 and installed 440 driver.
Now how do i set X to use iGPU and launch specific applications with dGPU? Will nvidia-prime work?
Can you share the xorg.conf configuration to be used?nvidia-bug-report.log (252.8 KB)

EDIT: Got it working with the following xorg.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"
EndSection

and getting correct output now.

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep "OpenGL render"
OpenGL renderer string: GeForce GTX 1660 Ti/PCIe/SSE2

When I run __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia firefox it does not show firefox in the output of nvidia-smi

Output of nvidia-smi is still

Sun May 24 22:45:07 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82       Driver Version: 440.82       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 GTX 166...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   43C    P8     3W /  N/A |     17MiB /  5944MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      2460      G   /usr/lib/xorg/Xorg                            15MiB |
+-----------------------------------------------------------------------------+

Please create a new nvidia-bug-report.log with the current config.

here you go

nvidia-bug-report.log (269.6 KB)

It seems to be an issue with firefox only. when i run glxgears it seems to be working fine

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82       Driver Version: 440.82       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 GTX 166...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   43C    P8     5W /  N/A |     22MiB /  5944MiB |     14%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     13577      G   /usr/lib/xorg/Xorg                            17MiB |
|    0     16207      G   glxgears                                       2MiB |
+-----------------------------------------------------------------------------+

Yes, there is/was a problem with browsers and offloading, IIRC, Chrome already fixed that, Firefox obviously not. Config is fine otherwise.