Created
June 12, 2018 12:01
-
-
Save unnir/179ee1224c17efc733224ce224b04299 to your computer and use it in GitHub Desktop.
Install CUDA v8.0, cuDNN v6.0, Anaconda, and PyTorch GPU 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
#!/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 |
for Keras GPU
conda install -c anaconda keras-gpu
conda install -c conda-forge jupyterlab
jupyter notebook --generate-config
jupyter notebook password
jupyter lab --ip=0.0.0.0 --port=8000 --no-browser &
from keras import backend as K
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.Session(config=config)
K.set_session(sess)
watch -d -n 2 nvidia-smi
sudo ss -lptn 'sport = :8888'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for the jupyter notebook:
jupyter notebook --ip=0.0.0.0 --port=8000 --no-browser &