-
-
Save vyraun/f68625f7ca79ae16199784b05f8d90f3 to your computer and use it in GitHub Desktop.
Script to reinstall manually nvidia drivers,cuda 9.0 and cudnn 7.1 on Ubuntu 16.04
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
# Remove anything linked to nvidia | |
sudo apt-get remove --purge nvidia* | |
sudo apt-get autoremove | |
# Search for your driver | |
apt search nvidia | |
# Install Driver | |
# add ppa graphic driver repository | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:graphics-drivers/ppa | |
sudo apt-get update | |
# check which version is available | |
apt list nvidia-* | |
sudo apt install nvidia-396 | |
# Select one driver (the last one is a decent choice) | |
# sudo apt install nvidia-370 | |
# Test the driver | |
sudo shutdown -r now | |
nvidia-smi | |
# If it doesn't work, sometimes this is due to a secure boot option of your motherboard, disable it and test again | |
# Install cuda | |
# Get your deb cuda file from https://developer.nvidia.com/cuda-downloads | |
# e.g. https://developer.nvidia.com/compute/cuda/9.2/Prod/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64.deb | |
sudo dpkg -i dev.file | |
sudo apt update | |
sudo apt install cuda | |
# Python Install | |
wget https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh | |
bash Anaconda2-4.2.0-Linux-x86_64.sh | |
conda create -n py36 python=3.6 anaconda | |
source activate py36 | |
export PATH=/home/{}/anaconda2/bin:$PATH | |
sudo apt-get install python3-pip python3-dev | |
pip3 install tensorflow-gpu | |
# Add cuda to your PATH and install the toolkit | |
# Also add them to your .bashrc file | |
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} | |
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | |
export CUDA_HOME=/usr/local/cuda-9.0 | |
sudo apt install nvidia-cuda-toolkit | |
nvcc --version | |
# Use the toolkit to check your CUDA capable devices | |
cuda-install-samples-9.0.sh ~/. | |
cd ~/NVIDIA_CUDA-9.0_Samples/1_Utilities/deviceQuery | |
make | |
shutdown -r now | |
# Test cuda | |
cd ~/NVIDIA_CUDA-9.0_Samples/1_Utilities/deviceQuery | |
./deviceQuery | |
# Downloads cudnn deb files from the nvidia website: | |
# https://developer.nvidia.com/rdp/cudnn-download | |
# Install cudnn | |
tar -zxvf cudnn-9.0-linux-x64-v5.1.tgz | |
sudo mv cuda/include/* /usr/local/cuda-9.0/include/. | |
sudo mv cuda/lib64/* /usr/local/cuda-9.0/lib64/. | |
# Alternate | |
wget https://www.dropbox.com/s/7czwat538w5p1gi/libcudnn6_6.0.21-1%2Bcuda8.0_amd64.deb | |
wget https://www.dropbox.com/s/9utqbnwhbdmdlav/libcudnn6-dev_6.0.21-1%2Bcuda8.0_amd64.deb | |
sudo dpkg -i file_name | |
# Reload your shell | |
. ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment