Created
November 22, 2022 02:57
-
-
Save jbohnslav/1867e9e3b78a192e4ebc3654929e2aa5 to your computer and use it in GitHub Desktop.
Reinstall Nvidia drivers and CUDA on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uninstall all nvidia packages, old drivers, etc. | |
# list all the packages with nvidia in the name | |
dpkg -l | grep -i nvidia | |
sudo apt-get remove --purge nvidia* | |
sudo apt-get remove --purge cuda* | |
sudo apt-get remove --purge libnccl* | |
sudo apt-get remove --purge libnvidia* | |
sudo apt remove --purge libcudnn* | |
# keep going until you find no nvidia packages with dpkg -l | |
# Install drivers and cuda together! | |
# Just go to https://developer.nvidia.com/cuda-downloads | |
# Make sure it's the version you want | |
# Linux, x86_64, ubuntu, 18.04 (or the correct one for your machine), deb (network) | |
# Download it, cd to downloads, and type the instructions on the website | |
# example: | |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb | |
sudo dpkg -i cuda-keyring_1.0-1_all.deb | |
sudo apt-get update | |
sudo apt-get -y install cuda | |
# Change these lines in your .bashrc to the appropriate version | |
export PATH=/usr/local/cuda-11.3/bin${PATH:+:${PATH}} | |
export LD_LIBRARY_PATH=/usr/local/cuda-11.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | |
# Reboot | |
# Verify drivers with | |
nvidia-smi | |
# Verify cuda with | |
nvcc --version | |
# Install CUDNN | |
# DON'T USE THE DEB FILE! Or if you do, you must install the DEVELOPER library AFTERWARDS!! | |
# First runtime, then developer, then code samples | |
https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html | |
# Download the code samples, and follow the post installation verification | |
# Involves running MNISTCudnn | |
# Do the post-installation actions: | |
# Involves adding two lines to the ~/.bashrc file | |
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html | |
# Install NCCL: OPTIONAL | |
https://docs.nvidia.com/deeplearning/sdk/nccl-install-guide/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment