Created
July 17, 2018 09:48
-
-
Save spacelis/257587f5e1860fde48797cf227ad4841 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Checking for CUDA and installing." | |
# Check for CUDA and try to install. | |
if ! dpkg-query -W cuda-9-0; then | |
# The 16.04 installer works with 16.10. | |
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb | |
dpkg -i ./cuda-repo-ubuntu1604_9.0.176-1_amd64.deb | |
apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
apt-get update | |
apt-get install cuda-9-0 -y | |
fi | |
# Enable persistence mode | |
nvidia-smi -pm 1 | |
#!/bin/bash | |
echo "Checking for CUDA and installing." | |
# Check for CUDA and try to install. | |
if ! dpkg-query -W cuda-9-0; then | |
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb | |
dpkg -i ./cuda-repo-ubuntu1604_9.0.176-1_amd64.deb | |
apt-get update | |
apt-get install cuda-9-0 -y | |
fi | |
# Add the package repositories | |
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 | |
# Install nvidia-docker2 and reload the Docker daemon configuration | |
sudo apt-get install -y nvidia-docker2 | |
sudo pkill -SIGHUP dockerd | |
# Test nvidia-smi with the latest official CUDA image | |
sudo docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi | |
sudo nvidia-docker run --rm --name tf1 -p 8888:8888 -p 6006:6006 gcr.io/tensorflow/tensorflow:latest-gpu jupyter notebook --allow-root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment