Nvidia Optimus app from the terminal

I feel stupid asking this question, but I can’t find answers on the Internet so here goes:

I’ve a laptop with NVIDIA Optimus and Fedora 32, I’ve installed the NVIDIA drivers from RPMFusion, I know that I can right click to start any app with the NVIDIA dirver, but my question is, how can I start an app from the terminal with the NVIDIA driver?

Hi @urameshikei, you can read the RPMFusion documentation for Optimus system that you can find here
Basically you set in the terminal __NV_PRIME_RENDER_OFFLOAD=1 before your command (if your application uses vulkan) or __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia if use GLX.
Example for vulkan:
__NV_PRIME_RENDER_OFFLOAD=1 vkcube
Example for GLX:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor

Have a good day :slight_smile:

1 Like

Thank you very much, I had read that documentation but I had tough that that commands were for configuring permanently the use of NVIDIA instead of just for one app. Maybe its because English is not my first language that I got confused, but again thank you

@urameshikei don’t worry, we are here to help for this reasons :slight_smile:

To clarify, __NV_PRIME_RENDER_OFFLOAD and __GLX_VENDOR_LIBRARY_NAME are 2 environmental variables that tell the system to use the nvidia with a specific library. But if you use those as i mentioned in the examples, then they are only for the current execution of the command/app, you need to specify those variables every time you want to use the descrete (nvidia) card.

If my post resolved your issue, please mark that as a solution so the thread can be closed.

Have a good day !!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.