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
My recommended version is 525, adapt to yours
sudo apt install nvidia-driver-535
sudo ubuntu-drivers autoinstall
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
mamba create -n pytorch python=3.10
mamba activate pytorch
mamba install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia
import torch
print(torch.cuda.is_available()) # should be True
t = torch.rand(10, 10).cuda()
print(t.device) # should be CUDA
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
Requirements: Docker
- Configure the production repository:
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
- Update the packages list from the repository:
sudo apt update
- Install the NVIDIA Container Toolkit packages:
sudo apt install nvidia-container-toolkit
Use the NVIDIA Container Toolkit CLI to configure Docker to use the NVIDIA libraries, then restart Docker:
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
Run this command to check the Docker configuration for CUDA:
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
Your output should resemble the nvidia-smi output.