Skip to content

Instantly share code, notes, and snippets.

@mitmul
Created February 18, 2018 14:32
Show Gist options
  • Save mitmul/6b6725ea6f1641f0206ffee14e424a25 to your computer and use it in GitHub Desktop.
Save mitmul/6b6725ea6f1641f0206ffee14e424a25 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Install CUDA driver and CUDA
CUDA_REPO_PKG=cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
wget -O /tmp/${CUDA_REPO_PKG} http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i /tmp/${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
rm -f /tmp/${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get install -y cuda-drivers
sudo apt-get install -y cuda
# Install docker
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
sudo gpasswd -a $USER docker
# Install nvidia-docker (not nvidia-docker2!)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu16.04/amd64/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker
# Install ccache for speeding up CuPy compilation
sudo apt-get install -y ccache
# To mount shared cache disk
sudo apt-get install -y nfs-common
sudo mkdir /mnt/data
echo "jenkins:/mnt/data /mnt/data nfs _netdev,x-systemd.automount 0 0" | sudo tee -a /etc/fstab
sudo service docker stop
sudo mount -t nfs jenkins:/mnt/data /mnt/data
sudo rm -rf /var/lib/docker
if [ ! -d /mnt/data/docker ]; then sudo mkdir /mnt/data/docker; fi
sudo ln -s /mnt/data/docker /var/lib/docker
sudo sed -E -i "s/dockerd/dockerd --storage-driver=devicemapper/g" /lib/systemd/system/docker.service
sudo systemctl daemon-reload
sudo service docker start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment