Skip to content

Instantly share code, notes, and snippets.

@npyoung
Last active November 5, 2019 02:12
Show Gist options
  • Select an option

  • Save npyoung/9358411927497d4555ca965f12b95f6f to your computer and use it in GitHub Desktop.

Select an option

Save npyoung/9358411927497d4555ca965f12b95f6f to your computer and use it in GitHub Desktop.
AWS Ubuntu 16.04 CUDA box setup
#!/usr/bin/env bash
# Screen settings
wget https://gist.githubusercontent.com/npyoung/4d44b0700d743231ab82396be3ff242c/raw/36ad6447b43f3ca927cdb0a80b268ddbfc914ce5/.screenrc
# Get NVIDIA drivers
echo "Getting NVIDIA drivers"
wget http://us.download.nvidia.com/titan/linux/387.34/nvidia-driver-local-repo-ubuntu1604-387.34_1.0-1_amd64.deb &&
sudo dpkg -i nvidia-driver-local-repo-ubuntu1604-387.34_1.0-1_amd64.deb &&
sudo apt-key add /var/nvidia-driver-local-repo-387.34/7fa2af80.pub &&
sudo apt update &&
sudo apt install cuda-drivers -y &&
# Get CUDA 9.1
echo "Getting CUDA" &&
wget https://developer.nvidia.com/compute/cuda/9.1/Prod/local_installers/cuda-repo-ubuntu1604-9-1-local_9.1.85-1_amd64 &&
mv cuda-repo-ubuntu1604-9-1-local_9.1.85-1_amd64 cuda-repo-ubuntu1604-9-1-local_9.1.85-1_amd64.deb &&
sudo dpkg -i cuda-repo-ubuntu1604-9-1-local_9.1.85-1_amd64.deb &&
sudo apt-key add /var/cuda-repo-9-1-local/7fa2af80.pub &&
# Install NVIDIA drivers and CUDA
echo "Installing CUDA" &&
sudo apt update &&
sudo apt install cuda -y &&
# Install Anaconda Python
echo "Setting up Python" &&
wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh &&
bash Anaconda3-5.0.1-Linux-x86_64.sh -b &&
echo 'PATH="$HOME/anaconda3/bin:$PATH"' >> .profile
source .profile
# Install PyCUDA
echo "Installing PyCUDA" &&
wget https://pypi.python.org/packages/b3/30/9e1c0a4c10e90b4c59ca7aa3c518e96f37aabcac73ffe6b5d9658f6ef843/pycuda-2017.1.1.tar.gz &&
tar xfz pycuda-2017.1.1.tar.gz &&
cd pycuda-2017.1.1 &&
python configure.py --cuda-root=/usr/local/cuda-9.1 &&
make install &&
cd .. &&
# Install scikit-cuda
echo "Installing scikit-cuda" &&
pip install scikit-cuda &&
# Jupyter configs
jupyter notebook --generate-config &&
sed -i -e "s/#c.NotebookApp.ip = 'localhost'/c.NotebookApp.ip = '*'/g" .jupyter/jupyter_notebook_config.py &&
sed -i -e "s/#c.NotebookApp.open_browser = True/c.NotebookApp.open_browser = False/g" .jupyter/jupyter_notebook_config.py &&
jupyter notebook password
# Add cuda executables to path
echo 'PATH="/usr/local/cuda-9.1/bin:$PATH"' >> .profile &&
source .profile &&
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment