-
Notifications
You must be signed in to change notification settings - Fork 9
AWS EC2 ML instance setup
Based loosely on: https://github.com/NVIDIA/nvidia-docker (docker setup)
Start by launching a p2.xlarge instance with Ubuntu 16.04. Then follow the steps in each section below (via ssh into the instance, using the key pair you selected at launch).
Original instructions: https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
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 usermod -aG docker $USER
sudo reboot
(wait for reboot...usually takes 30-60 seconds)
Test: $ docker run hello-world
Original instructions: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-nvidia-driver.html#obtain-nvidia-driver-linux
sudo apt-get upgrade -y linux-aws
sudo reboot
(wait for reboot)
sudo apt-get install -y gcc make linux-headers-$(uname -r)
cd /tmp
curl -O http://us.download.nvidia.com/tesla/384.145/NVIDIA-Linux-x86_64-384.145.run
sudo /bin/sh ./NVIDIA-Linux-x86_64-384.145.run
rm NVIDIA-Linux-x86_64-384.145.run
sudo apt-get remove --purge -y gcc make linux-headers-$(uname -r)
sudo apt-get autoremove -y
sudo apt-get autoclean -y
sudo reboot
(wait for reboot)
Test driver install: $ nvidia-smi
Original instructions: https://github.com/NVIDIA/nvidia-docker
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
Test: sudo nvidia-container-cli --load-kmods info
And: docker run --rm --runtime=nvidia -ti nvidia/cuda
Note that to run containers with the GPU available, you have to use the nvidia runtime