Skip to content

Instantly share code, notes, and snippets.

@ririw
Last active December 26, 2017 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ririw/d0107d30c567fe36d7995264aec88f41 to your computer and use it in GitHub Desktop.
Save ririw/d0107d30c567fe36d7995264aec88f41 to your computer and use it in GitHub Desktop.
Quick script to set up a GPU env on my desktop machine
# Thanks Fast.AI
# Based on their apache-2.0 licensed script
# https://github.com/fastai/courses/blob/master/setup/install-gpu.sh
#
set -e
# This script is designed to work with ubuntu 16.04 LTS
# ensure system is updated and has basic build tools
sudo apt-get update
sudo apt-get --assume-yes upgrade
sudo apt-get --assume-yes install tmux build-essential gcc g++ make binutils
sudo apt-get --assume-yes install software-properties-common
sudo apt-get install -y linux-headers-4.13.0-21-generic linux-4.13.0-21-generic
# download and install GPU drivers
wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb" -O "cuda-repo-ubuntu1604_8.0.44-1_amd64.deb"
sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
sudo apt-get update
sudo apt-get -y install cuda
sudo modprobe nvidia
nvidia-smi
# install Anaconda for current user
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
source ~/.bash_profile
pyenv install anaconda3-5.0.1
pyenv virtualenv anaconda3-5.0.1 nn-experiments
pyenv activate nn-experiments
conda install -y tensorflow-gpu jupyter numpy scipy scikit-learn tqdm keras matplotlib
conda install -y pytorch torchvision -c pytorch
# The following are not needed! Thankfully!
# I loath nvidia and its shitty setup.
#wget "http://files.fast.ai/files/cudnn.tgz" -O "cudnn.tgz"
##tar -zxf cudnn.tgz
#cd cuda
#sudo cp lib64/* /usr/local/cuda/lib64/
#sudo cp include/* /usr/local/cuda/include/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment