sudo apt update && sudo apt upgradesudo apt autoremove nvidia* --purgeubuntu-drivers devicesYou will install the NVIDIA driver whose version is tagged with recommended
My recommended version is 525, adapt to yours
sudo apt install nvidia-driver-535sudo ubuntu-drivers autoinstallrebootafter restart verify that the following command works
nvidia-smisudo apt update && sudo apt upgradesudo apt install nvidia-cuda-toolkitnvcc --versionYou 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 --versionsudo 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-samplesmamba create -n pytorch python=3.10
mamba activate pytorchmamba install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidiaimport torch
print(torch.cuda.is_available()) # should be True
t = torch.rand(10, 10).cuda()
print(t.device) # should be CUDAhttps://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-toolkitUse 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 dockerRun this command to check the Docker configuration for CUDA:
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smiYour output should resemble the nvidia-smi output.