If you want to select a specific GPU for the entire session, then selecting it with Prime, logging out and then logging back in will suffice.
However, if you really want to choose which GPU to use for each application, then you must use the
DRI_PRIME environment variable for such specific application(s) instead of using the system-wide Prime setting.
Ideally, it's recommended to use the Prime program in order to preset the integrated GPU (graphics processing unit) as the default (system-wide) one, i.e. it's recommended to set the integrated Intel graphics card as the default one, because it saves power, helps keeping your computer operating at a lower temperature et cetera. Then when you decide to run that very demanding 3D appplication, you use
DRI_PRIME to tell the system that it must use your Nvidia GPU to run such specific application.
As explained e.g. here and here, once you've used Prime to "tell" the system that your integrated Intel GPU is the default one to be used system-wide, you tell your Nvidia GPU to run the specific application by running the command:
specific-application is e.g. a 3D modelling application or a 3D game or any other program that requires a GPU with more powerful graphics processing capabilities. If e.g. you want your Nvidia GPU to process the graphics of the Inkscape application, just run:
In order to run Blender using your Nvidia GPU instead of the integrated Intel GPU, just run:
Suppose that you want Blender to always use your Nvidia GPU instead of the integrated Intel GPU. In such case, you may use a text editor (such as GEdit, Nano, Mousepad, Leafpad etc.) in order to edit Blender's
sudo gedit /usr/share/applications/blender.desktop
...and then replace this:
Exec=DRI_PRIME=1 /usr/bin/blender %u
...then just save the file, exit the text editor and start Blender by clicking on its icon at the Applications menu. Each one of those application icons at the Applications menu are one
.desktop file, so if you modify e.g.
blender.desktop you're pretty much modifying the Blender application shortcut at your Applications menu so when you click on such shortcut it runs Blender with
DRI_PRIME set as
1 (i.e. use the Nvidia GPU to run Blender).
In case you don't know which is the current default GPU, run this command:
glxinfo | grep "OpenGL renderer"
And in order to see which GPU is activated when you set
DRI_PRIME=1, run this command:
DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
If your integrated Intel GPU is already set as the default (system-wide) GPU, then the first command (
glxinfo | grep "OpenGL renderer") will inform you that Intel is the GPU ran by
glxinfo by default, and the second command (
DRI_PRIME=1 glxinfo | grep "OpenGL renderer") will inform you that Nvidia is the GPU ran by
DRI_PRIME=1 glxinfo (i.e. Nvidia is not the default / system-wide GPU, but
DRI_PRIME=1 successfully set Nvidia as the active GPU for that specific process initiated by
DRI_PRIME=1 glxinfo | grep "OpenGL renderer").