Hi.
It is not recommended that you install the driver from the CUDA installer. First you try to uninstall that failed installation. I’m not sure, but I think you should run:
sudo sh cuda_11.2.2_460.32.02_linux.run --uninstall
Then without restarting the machine you add the following PPA and install the driver:
Instructions on how to add the PPA in section (Adding this PPA to your system)
Then you proceed to install nvidia driver, for example latest available:
sudo apt install nvidia-driver-470
Then you proceed to install CUDA toolkit (CUDA only)
sudo sh cuda_11.2.2_460.32.02_linux.run
Perhaps the installer will warn you at some point that you already have the driver installed. You ignore the warnings and continue. When the time comes when the installer gives a list of components to install, you only check the box for CUDA Toolkit, you don’t check the box for the driver. You see if you need samples, if not check nothing but only CUDA Toolkit. Proceed with the installation. When that is done, you open the following text file:
gedit ~/.bashrc
And add environment variables with the following lines at the end of the file:
# Nvidia CUDA
export PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Save the changes and close the editor.
When you install another version of CUDA toolkit (11.4 for example ) you must modify the version there.
Reboot the machine and you check that CUDA is recognized from the terminal:
nvcc --version
**Documentation on these last steps here: