Optimus : applications and GPU's choice

Hello,
I use Fedora 39, with wayland on a LENOVO laptop with 2 integrated GPUs (AMD and Nvidia 3070).

By default, the system boots on the AMD GPU.
I’d like some applications to use the NVIDIA GPU.
For example, I’m currently testing LLM models with the OLLAMA application. However, it uses the AMD GPU by default.
the same with the “glxspheres64” test (cf image)

How do I get it to work on my NVIDIA GPU?
is it possible to specify a GPU for an application (like on windows)? I haven’t found the option in nvidia-settiings

or do I have to boot the system on the NVIDIA GPU?

INXI :
  Host: legion Kernel: 6.5.12-300.fc39.x86_64 arch: x86_64 bits: 64
    Desktop: GNOME v: 45.1 Distro: Fedora release 39 (Thirty Nine)
Graphics:
  Device-1: NVIDIA GA104M [GeForce RTX 3070 Mobile / Max-Q] driver: nvidia
    v: 535.129.03
  Device-2: AMD Cezanne [Radeon Vega Series / Radeon Mobile Series]
    driver: amdgpu v: kernel
  Device-3: Chicony [] driver: uvcvideo type: USB
  Display: wayland server: X.Org v: 23.2.2 with: Xwayland v: 23.2.2
    compositor: gnome-shell driver: X: loaded: amdgpu,nvidia
    unloaded: fbdev,modesetting,nouveau,vesa dri: radeonsi
    gpu: amdgpu,nvidia,nvidia-nvswitch resolution: 1: 1920x1080~60Hz
    2: 1920x1080~60Hz
  API: OpenGL v: 4.6 vendor: amd mesa v: 23.2.1 renderer: AMD Radeon
    Graphics (renoir LLVM 16.0.6 DRM 3.54 6.5.12-300.fc39.x86_64)

xorg-x11-drv-nvidia-kmodsrc-535.129.03-2.fc39.x86_64
xorg-x11-drv-nvidia-cuda-libs-535.129.03-2.fc39.x86_64
xorg-x11-drv-nvidia-libs-535.129.03-2.fc39.x86_64
nvidia-settings-535.129.03-1.fc39.x86_64
xorg-x11-drv-nvidia-power-535.129.03-2.fc39.x86_64
xorg-x11-drv-nvidia-535.129.03-2.fc39.x86_64
akmod-nvidia-535.129.03-1.fc39.x86_64
kmod-nvidia-6.5.10-300.fc39.x86_64-535.129.03-1.fc39.x86_64
kmod-nvidia-6.5.11-300.fc39.x86_64-535.129.03-1.fc39.x86_64
nvidia-gpu-firmware-20231111-1.fc39.noarch
kmod-nvidia-6.5.12-300.fc39.x86_64-535.129.03-1.fc39.x86_64<div data-theme-slick="1">

“glxspheres64” test

(nvidia GPU on the left, AMD GPU on the rifht)

Thanls in advance for your help.

Regards

From what you show, using the nvidia gpu for specific apps is very easy.

When opening the app with the icon simply right click then select to run the app using the dedicated GPU. A left click will open the app with the default iGPU.

thanks for your reply

ollama or glxspheres64 are executed via CLI.
they ont appears in gnome’s application menu.

I’m going to find out how to add a script to the GNome applications menu.and test your method.

Thanks for your feedback

i fave created a desktop file in /usr/share/application.
glxspere64 is well executed with nvidia GPU
but it fails with ollama

ollama does not yet seem to be designed to handle this type of configuration.

You can add your own deskfile to ~/.local/share/applications folder.
That way you do not need to change /usr that is managed by Fedora.

tjanks for the tips

i have solved my problem.

after installing this package (and dependancies), everything is OK

xorg-x11-drv-nvidia-cuda.x86_64