Skip to content

Instantly share code, notes, and snippets.

@fedden
Last active February 19, 2018 09:58
Show Gist options
  • Save fedden/71f75e14a0116ab5aa58aef5d16cf335 to your computer and use it in GitHub Desktop.
Save fedden/71f75e14a0116ab5aa58aef5d16cf335 to your computer and use it in GitHub Desktop.
## Fresh install of Ubuntu 16.04
## Note I have copied much of this by hand - be wary of subtle typos!
# Get a proper browser.
cd ~
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install google-chrome-stable -y
# Get a good terminal text editor
sudo apt-get install vim -y
# Update OS, get correct (slightly older) drivers.
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get auto-remove -y
sudo apt-get install nvidia-375 nvidia-modprobe -y
## Reboot (Hard reset using power button)
# Assert CUDA controller exists (assert that there is a line of output)
lspci | grep -i nvidia
# Install CUDA 9.0 (get local deb file)
# https://developer.nvidia.com/cuda-90-download-archive
cd Downloads
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda -y
echo 'export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
source ~/.bashrc
# Test installation (Should open an interactive simulation on ./nbody)
cd /usr/local/cuda-9.0/samples/5_Simulations/nbody
sudo make
./nbody
# Download and install cuDNN 7.0.
# https://developer.nvidia.com/cudnn
# Download the v7.0.4 Library for Linux. Nothing else!
cd ~/Downloads
tar -xzvf cudnn-9.0-linux-x64-v7.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/libcudnn*
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64' >> ~/.bashrc
# Install pip and then TensorFlow
sudo apt-get install python3-pip -y
sudo pip3 install tensorflow-gpu
# Validate TensorFlow installation
# Run python3 and import tensorflow
python3
# Write whatever code you want!
>> import tensorflow as tf
>> print(tf.__version__)
1.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment