prime-run command not found

Asked by Bapi Dey

I installed nvidia 440 driver with nvidia-prime. My display is connected with igpu so I want to use GPU offload. https://wiki.archlinux.org/index.php/PRIME#PRIME_GPU_offloading
On this doc I can found, prime -run application to run that on dgpu. But in kubuntu 20.04 no such command found in the terminal.
I also want to refer to https://askubuntu.com/questions/1272989/no-compatible-gpu-found-but-nvidia-prime-is-here.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu nvidia-prime Edit question
Assignee:
No assignee Edit question
Solved by:
Daniel Letzeisen
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

That guide is for Arch. Arch isn't Ubuntu.

This should help
https://www.linuxbabe.com/desktop-linux/switch-intel-nvidia-graphics-card-ubuntu/amp

Revision history for this message
Daniel Letzeisen (dtl131) said :
#2

Look at output of:
prime-select query

If it tells you that you're using intel, try to switch to nvidia:
sudo prime-select nvidia

And then you can verify with
prime-select query
glxinfo -B

Revision history for this message
Best Daniel Letzeisen (dtl131) said :
#3

Okay, I think I see what you are trying to do. You will need Nvidia driver >= 450.xx to use on-demand smoothly.
(NOTE: Make sure your GPU is supported by 450.xx driver BEFORE doing this:
http://us.download.nvidia.com/XFree86/Linux-x86_64/450.66/README/supportedchips.html )

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-driver-450 nvidia-prime
(Reboot)

Now try changing to "on-demand" mode. (I'm not sure, but this may require another reboot or log out):
sudo prime-select on-demand

Verification (first command should show Intel and second command Nvidia):
glxinfo -B
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo -B

If all goes well, you can run programs on the Nvidia GPU by by setting the variables as in the previous command. Or, if you don't want to type all that every time, you can do as the Arch Linux script does and make a new command. Note that this long command is all one line:
alias prime_run=__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia

To make the alias permanent, add it to the end of ~/.bashrc file

Revision history for this message
Bapi Dey (kubuntubapi) said :
#4

Thanks Daniel Letzeisen, that solved my question.

Revision history for this message
Bapi Dey (kubuntubapi) said :
#5

I made ~/.bashrc file. I am useing kubuntu. Is there any way to add them ( env vars ) in launch icon, Because it's easy.

Revision history for this message
Daniel Letzeisen (dtl131) said :
#6

KDE desktop shortcuts should have an 'Application' tab , with a 'Command' field. Try putting prime-run before the command.
Also, would it be possible for you to copy/paste output of:
glxinfo -B
prime-run glxinfo -B

I want to make sure the procedure worked, because I don't have a "PRIME" laptop where I can test it myself.

Revision history for this message
Olivier V (forum-viennet) said :
#7

Hi,

You are right with the of the Nvidia GPU wich is done with "NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia"

But "sudo prime-select on-demand" does nothing

Try nvidia-settings. I get the code below with "PRIME: is it supported? no"

So there is no On-Demand Prime but only manualy use of the eGpu.
Do you have a solution for this ?

meloli@Asus-A17:~$ nvidia-settings

(nvidia-settings:17697): GLib-GObject-CRITICAL **: 15:32:04.355: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

ERROR: nvidia-settings could not find the registry key file. This file should have been installed along with this driver at /usr/share/nvidia/nvidia-application-profiles-key-documentation. The
       application profiles will continue to work, but values cannot be prepopulated or validated, and will not be listed in the help text. Please see the README for possible values and
       descriptions.

** Message: 15:32:04.419: PRIME: No offloading required. Abort
** Message: 15:32:04.419: PRIME: is it supported? no

Revision history for this message
Daniel Letzeisen (dtl131) said :
#8

@Olivier: What is the output of:
prime-select query

If "prime-select query" returns "on-demand" and the Nvidia GPU is used when you run with those variables (or prime-run alias), then on-demand is working correctly. Maybe I'm wrong, but it sounds like you are asking about seamless/automatic load-based switching, which is only available on Windows at the moment.

Sorry, I don't have an Nvidia laptop, so I don't know how nvidia-settings works with regard to detecting Prime Profiles.

Revision history for this message
Olivier V (forum-viennet) said :
#9

meloli@Asus-A17:~$ prime-select query
on-demand

meloli@Asus-A17:~$ nvidia-smi
| 0 GeForce GTX 166... Off | 00000000:01:00.0 Off | N/A |
| N/A 37C P8 1W / N/A

But the nvidia GPU is never used used automatic : I always have only 1W consumption.

I only have nvidia GPU working (and consumption about 10W) when using the prefix : __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia

So nothing "on demand" but only manual switching.
It seems that eamless/automatic switching was available in 435 driver.

In nvidia-settings I don't have a PRIME Profiles as you can see on this doc : https://doc.ubuntu-fr.org/_media/nvidia-prime-profiles.jpg
Here you can see another example with 435 driver and "On Demand" mode : https://www.reddit.com/r/Ubuntu/comments/deh01n/nvidia_on_demand/
You can see the three mode. For me "On Demand" should be automatic... as in windows and in 435 version.

Nothing like this in the 450 driver.