-
-
Save Lyken17/203ccce363aba1c0baac8e1352d3ffbe to your computer and use it in GitHub Desktop.
Install CUDA 9.2, cuDNN 7.2.1, Anaconda and PyTorch on Ubuntu 16.04.
This file contains 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
# tested on AWS p2.xlarge August 29, 2018 | |
# install CUDA | |
sudo apt-get update && sudo apt-get install wget -y --no-install-recommends | |
CUDA_URL="https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64" | |
wget -c ${CUDA_URL} -O cuda.deb | |
sudo dpkg --install cuda.deb | |
sudo apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub | |
sudo apt-get update | |
sudo apt-get install -y cuda | |
rm cuda.deb | |
CUDA_PATCH_URL="https://developer.nvidia.com/compute/cuda/9.2/Prod2/patches/1/cuda-repo-ubuntu1604-9-2-148-local-patch-1_1.0-1_amd64" | |
wget -c ${CUDA_PATCH_URL} -O cuda_patch.deb | |
sudo dpkg --install cuda_patch.deb | |
sudo apt-get upgrade -y cuda | |
rm cuda_patch.deb | |
# install cuDNN 7.2.1 | |
CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v7.2.1/cudnn-9.2-linux-x64-v7.2.1.38.tgz" | |
wget -c ${CUDNN_URL} -O cudnn.tgz | |
sudo tar -xzf cudnn.tgz -C /usr/local | |
rm cudnn.tgz | |
sudo ldconfig | |
# install nccl | |
wget http://file.lzhu.me/cuda/nccl-repo-ubuntu1604-2.3.5-ga-cuda9.0_1-1_amd64.deb | |
sudo dpkg -i nccl-repo-ubuntu1604-2.3.5-ga-cuda9.0_1-1_amd64.deb | |
sudo apt-get update | |
sudo apt-get --assume-yes install libnccl2=2.3.5-2+cuda9.0 libnccl-dev=2.3.5-2+cuda9.0 | |
# add variables to .profile | |
echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.profile | |
echo 'export PATH=${CUDA_HOME}/bin:${PATH}' >> ~/.profile | |
echo 'export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH' >> ~/.profile | |
# install conda | |
wget -c "https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh" -O conda.sh | |
bash conda.sh -b | |
rm conda.sh | |
echo 'export PATH=${HOME}/anaconda3/bin:${PATH}' >> ~/.profile | |
echo "source ~/.profile" >> ~/.bashrc | |
# setup environment variables | |
source ~/.profile | |
# install pytorch | |
conda install -y pytorch torchvision cuda92 -c pytorch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment