i am trying to install nvidia driver with cuda
and I was a little confused which one is better way
i found a way here
and when i run this command sudo dnf -y module install nvidia-driver:latest-dkms
the nvidia driver was installed and after reboot it
i figure out from nvidia-smi output that the whole gnome shell and xorg and all app is running on nvidia
and when i installed akmod-nvidia and xorg-x11-drv-nvidia-cuda only apps are rununing on Nvidia when I run these commands __GLX_VENDOR_LIBRARY_NAME=nvidia __NV_PRIME_RENDER_OFFLOAD=1
Which way is more optimal?
please give me an explanation about these two ways
and how can i install cuda for the second way
That is not the recommended way to install nvidia drivers and cuda on fedora.
If one looks into the gnome-software app there is an option to enable 3rd party repos, one of which is the rpmfusion-nonfree-nvidia-driver repo.
The rpmfusion repo contains all the nvidia and cuda packages needed for fedora and they are specifically tweaked and packaged to work with fedora.
My suggestion is simple:
remove everything you may have installed with the instructions from nvidia.
disable the module that was installed in that process with sudo dnf module disable nvidia-driver
install the packages from rpmfusion only with sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda
Following the completion of step 3 wait at least 5 minutes while the system compiles and installs the nvidia modules in the background, then reboot.
Confirm the nvidia drivers were properly loaded with lsmod | grep nvidia which should show several lines of output.
Now it all should just work for you.
BTW, the cuda driver installed in this way is at version 12.2 as we speak.