Skip to content

Instantly share code, notes, and snippets.

@heejongkim
Forked from unnir/cuda_pytorch.sh
Created June 12, 2022 15:13
Show Gist options
  • Save heejongkim/f02e2f7818a87504ad1d4f0ae116fb59 to your computer and use it in GitHub Desktop.
Save heejongkim/f02e2f7818a87504ad1d4f0ae116fb59 to your computer and use it in GitHub Desktop.
Install CUDA v8.0, cuDNN v6.0, Anaconda, and PyTorch GPU on Ubuntu 16.04
#!/bin/bash
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-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-8-0
#nvidia-smi
echo 'export PATH=$PATH:$CUDA_HOME/bin' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64' >> ~/.bashrc
source ~/.bashrc
# install cuDNN v6.0
CUDNN_TAR_FILE="cudnn-8.0-linux-x64-v6.0.tgz"
wget http://developer.download.nvidia.com/compute/redist/cudnn/v6.0/${CUDNN_TAR_FILE}
tar -xzvf ${CUDNN_TAR_FILE}
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-8.0/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64/
sudo chmod a+r /usr/local/cuda-8.0/lib64/libcudnn*
# install conda
wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
bash Anaconda3-5.2.0-Linux-x86_64.sh
# yes yes yes
source ~/.bashrc
# install PyTorch
conda install pytorch torchvision -c pytorch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment