Skip to content

Instantly share code, notes, and snippets.

@danielhavir
Created March 12, 2018 15:30
Show Gist options
  • Save danielhavir/4ac72421b130d8f03a66bc2312868c8e to your computer and use it in GitHub Desktop.
Save danielhavir/4ac72421b130d8f03a66bc2312868c8e to your computer and use it in GitHub Desktop.
Extract CuDNN, copy files to CUDA directory and create symbolic links
### CuDNN Installation Script ###
### Download CuDNN from: https://developer.nvidia.com/cudnn ###
### Reference 1: http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html ###
### Reference 2: https://stackoverflow.com/questions/42013316/after-building-tensorflow-from-source-seeing-libcudart-so-and-libcudnn-errors/44147506#44147506 ###
## Create variables
### CHANGE THESE ###
export cudnn_version=cudnn-8.0-linux-x64-v7.1
export version=7.1.1
export cuda_dir=/usr/local/cuda
# DO NOT CHANGE BELOW THIS
export v=$(printf %.1s "$version")
# Extract if not already extracted
if [ ! -d "cuda" ]; then
tar -zxvf $cudnn_version.tgz
fi
# Copy cudnn.h to CUDA directory
sudo cp cuda/include/cudnn.h $cuda_dir/include
# Copy libcudnn_static.a
sudo cp cuda/lib64/libcudnn_static.a $cuda_dir/lib64
# Copy CuDNN and create symbolic links
sudo cp cuda/lib64/libcudnn.so.$version $cuda_dir/lib64
cd $cuda_dir/lib64/
sudo ln -s libcudnn.so.$version libcudnn.so.$v
sudo ln -s libcudnn.so.$v libcudnn.so
# Append path to .bashrc
cd
sed -i "$ a export LD_LIBRARY_PATH=$cuda_dir/lib64/" ~/.bashrc
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment