Skip to content

Instantly share code, notes, and snippets.

@unnir
Created June 12, 2018 12:01
Show Gist options
  • Save unnir/179ee1224c17efc733224ce224b04299 to your computer and use it in GitHub Desktop.
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
#!/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
@unnir
Copy link
Author

unnir commented Jun 12, 2018

for the jupyter notebook:

jupyter notebook --ip=0.0.0.0 --port=8000 --no-browser &

@unnir
Copy link
Author

unnir commented Sep 10, 2018

for Keras GPU

conda install -c anaconda keras-gpu 

@unnir
Copy link
Author

unnir commented Sep 11, 2018

conda install -c conda-forge jupyterlab

@unnir
Copy link
Author

unnir commented Sep 11, 2018

jupyter notebook --generate-config
jupyter notebook password

@unnir
Copy link
Author

unnir commented Sep 12, 2018

jupyter lab --ip=0.0.0.0 --port=8000 --no-browser &

@unnir
Copy link
Author

unnir commented Sep 19, 2018

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

@unnir
Copy link
Author

unnir commented Sep 24, 2018

sudo ss -lptn 'sport = :8888'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment