Skip to content

Instantly share code, notes, and snippets.

@bygreencn
Forked from fo40225/ubuntu1804cuda10.sh
Last active June 22, 2019 01:31
Show Gist options
  • Save bygreencn/a4cf224719f0db85da8e85a41ee95659 to your computer and use it in GitHub Desktop.
Save bygreencn/a4cf224719f0db85da8e85a41ee95659 to your computer and use it in GitHub Desktop.
install cuda 10.1 on ubuntu
sudo apt update
sudo apt -y install build-essential
sudo apt -y install linux-headers-$(uname -r)
wget -N https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.168_418.67_linux.run
wget -N http://developer.download.nvidia.com/compute/redist/cudnn/v7.6.0/cudnn-10.1-linux-x64-v7.6.0.64.tgz
wget -N https://developer.download.nvidia.com/compute/redist/nccl/v2.4/nccl_2.4.7-1+cuda10.1_x86_64.txz
#Disable nouveau driver
echo "blacklist nouveau" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf > /dev/null
echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf > /dev/null
sudo update-initramfs -u
#Install cuda and nvidia driver
chmod +x cuda_10.1.168_418.67_linux.run
sudo ./cuda_10.1.168_418.67_linux.run --override --silent --toolkit --no-opengl-libs
#export path
echo -e "\n## CUDA and cuDNN paths" >> ~/.bashrc
echo "export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" >> ~/.bashrc
#Install cudnn
tar axvf cudnn-10.1-linux-x64-v7.6.0.64.tgz
sudo rm /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
sudo mv cuda/include/cudnn.h /usr/local/cuda/include
sudo mv cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
rm -rf cuda
#Install nccl
tar axvf nccl_2.4.7-1+cuda10.1_x86_64.txz
sudo rm /usr/local/cuda/include/nccl.h /usr/local/cuda/lib64/libnccl*
sudo mv nccl_2.4.7-1+cuda10.1_x86_64/include/nccl.h /usr/local/cuda/include
sudo mv nccl_2.4.7-1+cuda10.1_x86_64/lib/libnccl* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/nccl.h /usr/local/cuda/lib64/libnccl*
rm -rf nccl_2.4.7-1+cuda10.1_x86_64
sudo ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment