I have installed Nvidia proprietary driver on Ubuntu 19.10.
In the Prime Profiles section, there are three options:
* NVIDIA (Performance Mode)
* NVIDIA On-Demand
* Intel (Power Saving Mode)

First and last options are quite obvious, But I don't know how the second option works. How it detects which application needs NVIDIA driver and which doesn't?

  • 1
    On Ubuntu 20.04 with nvidia-driver-440, choosing "NVIDIA On-Demand" gives me a right-click option in the GNOME launcher to "Launch using Dedicated Graphics Card". Checking the nvidia-settings tool after launching applications through this option confirms that they will use the dedicated graphics. Jul 22, 2020 at 18:02

4 Answers 4


Ok I finally figured it out. As this moment, it appears that NVIDIA can do offload rendering for OpenGL and Vulkan apps.
In order to enable this offload rendering, you have to put the Prime profile on "On-Demand", then for Vulkan offloading you have to put this variable inside your /etc/environment file:

For OpenGL apps, you have to put these variables:

After a restart, it will start render offloading.

In order to check which graphic card is being used, you can enter the following command in terminal:
glxinfo | grep vendor

  • 12
    Worth noting: As with any environment variables, you can temporarily set them when running a particular application. E.g. if you want to offload glxgears to your NVIDIA hardware, do __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears -info (-info should let you check that it is in fact rendering on your NVIDIA hardware) Oct 14, 2020 at 17:21
  • That's like the single most helpful comment I found on the whole askubuntu.com since I first logged in here. Cheers, have a great 2021 dude!
    – Artur
    Dec 29, 2020 at 20:11
  • I can confirm that this works for Kubuntu 20.04 (under X11) with Intel Haswell and Nvidia GTX 860M. Thanks! Jan 4, 2021 at 11:26

From: Part I. Installation and Configuration Instructions

Chapter 35. PRIME Render Offload

PRIME render offload is the ability to have an X screen rendered by one GPU, but choose certain applications within that X screen to be rendered on a different GPU. This is particularly useful in combination with dynamic power management to leave an NVIDIA GPU powered off, except when it is needed to render select performance-sensitive applications.

The GPU rendering the majority of the X screen is known as the "sink", and the GPU to which certain application rendering is "offloaded" is known as the "source". The render offload source produces content that is presented on the render offload sink. The NVIDIA driver can function as a PRIME render offload source, to offload rendering of GLX+OpenGL or Vulkan, presenting to an X screen driven by the xf86-video-modesetting X driver.

X Server Requirements

NVIDIA's PRIME render offload support requires the following git commits in the X.Org X server:

  • 7f962c70 - xsync: Add resource inside of SyncCreate, export SyncCreate

  • 37a36a6b - GLX: Add a per-client vendor mapping

  • 8b67ec7c - GLX: Use the sending client for looking up XID's

  • 56c0a71f - GLX: Add a function to change a clients vendor list

  • b4231d69 - GLX: Set GlxServerExports::{major,minor}Version

As of this writing, these commits are only in the master branch of the X.Org X server, and not yet in any official X.Org X server release.


as extension to Md Narimani answer: i can confirm this is actually working for me on kubuntu 19.10 with nvidia driver version 440

some background info can be found at Chapter 34. PRIME Render Offload

you can set the 'on-demand' option also in the GUI: Nvidia X Server Settings - PRIME Profiles: NVIDIA On-Demand
enter image description here then restart.

then you can start your application with the environment variables also directly from commandline - so you can switch GPUs as needed:

stefan@stefan-Zen:~$ glxheads :0
Name: :0
  Display:     0x556081a45d40
  Window:      0x7000002
  Context:     0x556081a64a70
  GL_VERSION:  3.0 Mesa 19.2.8
  GL_VENDOR:   Intel Open Source Technology Center
  GL_RENDERER: Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2) 
stefan@stefan-Zen:~$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxheads :0
Name: :0
  Display:     0x55f6dd9097a0
  Window:      0x7000002
  Context:     0x55f6dd944878
  GL_VERSION:  4.6.0 NVIDIA 440.64
  GL_VENDOR:   NVIDIA Corporation


based on the answers of @md-narimani and @dominick-pastore there are actually shell scripts shipped ready for this purpose as part of the nvidia-prime-applet package.

And you can just place them before any command you would normally use.

nvidia-optimus-offload-glx glxheads :0
nvidia-optimus-offload-vulkan vkcube

But this will only work if the nvidia kernel driver is loaded correctly, and Xorg has CORRECTLY generated the Nvidia screens, you can test this by:

cat /var/log/Xorg.0.log | grep -i NVIDIA
# it should output a bunch of lines with "NVIDIA(G0)"

If the screens are not detecting correctly then create /etc/X11/xorg.conf.d/nvidia.conf and fill it with contents from the instructions at Chapter 34. PRIME Render Offload as mentioned by @stefan-krüger.

You must log in to answer this question.

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