Skip to content

Instantly share code, notes, and snippets.

@benkant
Forked from abdel/cuda-setup.sh
Last active July 8, 2018 09:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benkant/8e67fd85927553ca5ab2fe5a28555a47 to your computer and use it in GitHub Desktop.
Save benkant/8e67fd85927553ca5ab2fe5a28555a47 to your computer and use it in GitHub Desktop.
Install CUDA Toolkit v9.0 and cuDNN v7.0.5 on Ubuntu 16.04
#!/bin/bash
# Install CUDA Toolkit v9.0
# Instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network))
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
CUDA_REPO_PKG="cuda-repo-ubuntu1604_9.0.176-1_amd64.deb"
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get -y install cuda-9-0
# Install cuDNN v7.0
# Install instructions from https://developer.nvidia.com/cudnn (Membership Required)
# Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 9.0 -> cuDNN v7.0.5 Library for Linux
CUDNN_TAR_FILE="cudnn-9.0-linux-x64-v7.tgz"
tar -xzvf ${CUDNN_TAR_FILE}
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-9.0/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64/
sudo chmod a+r /usr/local/cuda-9.0/lib64/libcudnn*
# set environment variables
echo "export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" >> ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment