sudo apt update && sudo apt upgrade
sudo apt autoremove nvidia* --purge
ubuntu-drivers devices
You will install the NVIDIA driver whose version is tagged with recommended
sudo ubuntu-drivers autoinstall
My recommended version is 525, adapt to yours
sudo apt install nvidia-driver-525
reboot
after restart verify that the following command works
nvidia-smi
sudo apt update && sudo apt upgrade
sudo apt install nvidia-cuda-toolkit
nvcc --version
You can download cuDNN file here. You will need an Nvidia account. Select the cuDNN version for the appropriate CUDA version, which is the version that appears when you run:
nvcc --version
sudo apt install ./<filename.deb>
sudo cp /var/cudnn-<something>.gpg /usr/share/keyrings/
My cuDNN version is 8, adapt the following to your version:
sudo apt update
sudo apt install libcudnn8
sudo apt install libcudnn8-dev
sudo apt install libcudnn8-samples
sudo apt-get install python3-pip
sudo pip3 install virtualenv
virtualenv -p py3.10 venv
source venv/bin/activate
pip3 install torch torchvision torchaudio
import torch
print(torch.cuda.is_available()) # should be True
t = torch.rand(10, 10).cuda()
print(t.device) # should be CUDA
Go to Nvidia webiste here. Select latest TensorRT version that matches your CUDA version and download the DEB file.
sudo apt install ./<filename.deb>
sudo apt update
sudo apt install tensorrt
Verify that the trtexec utility is present.
whereis trtexec # should be trtexec: /usr/src/tensorrt/bin/trtexec
/usr/src/tensorrt/bin/trtexec
I followed your instructions and did the following:
And
nvidia-smi
had shown me, I have got the correct cuda version (or at least what I was looking for):Abd then I did the following:
But after doing all this, when I tried looking into the
nvcc --version
, it gives me the following:Why am I getting this conflict? I want the cuda 12.2 for my nvcc as well. How can I resolve this issue? And upgrade nvcc to use cuda 12.2 as well?