nvidia prime-run

Hello,

I was just curious to know if, in OpenSUSE, there exists something like “prime-run” as in ArchLinux.
It is quite easy a tool to choose which GPU you want to use when starting an application. (e.g.: # prime-run steam to start steam and use the nvidia card)

https://wiki.archlinux.org/index.php/PRIME#PRIME_GPU_offloading

](https://wiki.archlinux.org/index.php/PRIME#PRIME_GPU_offloading)

Hi
On my dual amd gpu setup I use switcheroo-control for the GNOME DE, or DRI_PRIME=1 from the command line. There is suse-prime, but you need to log out/in SDB:NVIDIA SUSE Prime - openSUSE Wiki

Thanks for the answer; does switcheroo-control work also on KDE?
And how can I use DRI_PRIME=1, just write it in a console and put the name of the application I want to start? (e.g. DRI_PRIME=1 steam)

Hi
I don’t think it works in Plasma… you could modify the default desktop file from /usr/share/applications and copy it to ~/.local/share/applications and call it in the exec line (and rename the name entry).

For those who could be interested, it is possible to use in Tumbleweed (I did not test it yet in Leap) the same method as in Archlinux.

  1. Install the nvidia drivers. (if you do not install them, you can use DRI_PRIME=1 nameoftheapplication to run the nouveau driver for the application in question)
  2. Reboot
  3. Login, open a terminal and then$su
    $prime-select intel
    (I do not know whether this is necessary but it cannot hurt)
    4.Logout and login again
  4. Open a terminal and make the following script (copied from Archlinux https://www.archlinux.org/packages/extra/any/nvidia-prime/ )$ su
    $ nano prime-run
#!/bin/bash 
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"

(and save it)
$ cp prime-run /bin
$ cd /bin
$ chmod 755 prime-run
$ exit

  1. And now as a user: $ prime-run nameoftheapplication
  2. You can also test if it works with: $ prime-run glxinfo | grep “OpenGL renderer” and you should have something like this: OpenGL renderer string: GeForce GTX 950M/PCIe/SSE2

Hi
I do the same here, but use an alias instead :wink:


xrandr --listproviders | grep NVIDIA
Provider 1: id: 0x535; cap: 0x2 (Sink Output); crtcs: 4; outputs: 3; associated providers: 1; name: NVIDIA-G1
Provider 2: id: 0x2d5; cap: 0x2 (Sink Output); crtcs: 4; outputs: 3; associated providers: 1; name: NVIDIA-G0

alias pro0='__NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia '
alias pro1='__NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G1 __GLX_VENDOR_LIBRARY_NAME=nvidia '

pro0 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: GeForce GT 710/PCIe/SSE2

pro1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: GeForce GT 710/PCIe/SSE2

More info at: Chapter 35. PRIME Render Offload

Just tested in Leap 15.2 and it also works

T’hank you so much! For newer drivers, the proper is now to use prime-select boot offload or prime-select offload (non-persistent).

Should we add this to the wiki?

Ok, I added it: SDB:NVIDIA SUSE Prime - openSUSE Wiki

1 Like

This solves another problem on laptops. A few times over the last year I have booted to a black screen with a blinking cursor and a mouse, instead of SDDM after an update. The solution was to change to a console and run “sudo prime-select boot intel” (offload would probably have worked as well). I’ve added it to the end of my personal update script now, after zypper dup.

I am glad it helped

Happy to say that since version 0.8.15, the package suse-prime will provide the prime-run script by default :grinning:

1 Like