Skip to content

Instantly share code, notes, and snippets.

@henrywang1
Last active January 9, 2019 08:52
Show Gist options
  • Save henrywang1/20697b28674ae30c8e34f6457221b7f0 to your computer and use it in GitHub Desktop.
Save henrywang1/20697b28674ae30c8e34f6457221b7f0 to your computer and use it in GitHub Desktop.
Install python2, keras-gpu on Ubuntu 16.04

Install nvidia driver

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-396 nvidia-modprobe
sudo reboot

install CUDA 9.2, cuDNN 7.2.1

copy from: https://gist.github.com/kylemcdonald/3ae0b88a1bf91afc00ba441fe6823a17

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

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 keras Theano using Anaconda

wget https://repo.continuum.io/archive/Anaconda2-2018.12-Linux-x86_64.sh
chmod 750 Anaconda2-2018.12-Linux-x86_64.sh 
./Anaconda2-2018.12-Linux-x86_64.sh 
conda install -c anaconda keras-gpu
conda install theano

Setup theano

Follow: http://deeplearning.net/software/theano/library/config.html

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