Created
March 14, 2017 21:42
-
-
Save mulloymorrow/b9855a8a38d0132cf1593313caf101ba 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
#!/usr/bin/env bash | |
#Spin up a p2 ec2 instance on AWS and then run through this script to install tensorflow running on GPUs | |
#NVIDIA CUDA TOOLKIT + DRIVERS - http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#axzz4ZXNjlCfN | |
lspci | grep -i nvidia | |
uname -m && cat /etc/*release | |
gcc --version | |
uname -r | |
sudo apt-get update && \ | |
sudo apt-get install build-essential software-properties-common -y && \ | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ | |
sudo apt-get update && \ | |
sudo apt-get install gcc-snapshot -y && \ | |
sudo apt-get update && \ | |
sudo apt-get install gcc-6 g++-6 -y && \ | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \ | |
sudo apt-get install gcc-4.8 g++-4.8 -y && \ | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8; | |
sudo update-alternatives --config gcc #When completed, you must change to the gcc you want to work with by default | |
gcc -v #To verify if it worked. Just type in your terminal | |
#https://developer.nvidia.com/cuda-downloads | |
scp <DOWNLOAD_PATH>/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb ubuntu@<REMOTE_HOST>:~/ | |
chmod +x cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
sudo apt-get update | |
sudo apt-get install cuda | |
sudo apt-get install cuda-drivers | |
export CUDA_HOME=/usr/local/cuda-8.0 | |
export PATH=${CUDA_HOME}/bin:${PATH} | |
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 | |
nvcc -V | |
cuda-install-samples-8.0.sh ~/ | |
cd ~/NVIDIA_CUDA-8.0_Samples | |
make | |
~/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release/deviceQuery | |
~/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release/bandwidthTest | |
#TENSOR FLOW - https://www.tensorflow.org/install/install_linux#InstallingDocker | |
sudo apt-get install libcupti-dev | |
#DOCKER | |
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 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 docker-ce=7.03.0 | |
sudo docker run hello-world | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
sudo systemctl enable docker | |
#NVIDIA-DOCKER | |
#https://github.com/NVIDIA/nvidia-docker | |
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb | |
sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb | |
nvidia-docker run --rm nvidia/cuda nvidia-smi | |
nvidia-docker run -it gcr.io/tensorflow/tensorflow:latest-gpu bash | |
python | |
#>>> import tensorflow as tf | |
#>>> hello = tf.constant('Hello, TensorFlow!') | |
#>>> sess = tf.Session() | |
#W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. | |
#W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. | |
#W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. | |
#W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. | |
#W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. | |
#W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. | |
#I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero | |
#I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties: | |
#name: Tesla K80 | |
#major: 3 minor: 7 memoryClockRate (GHz) 0.8235 | |
#pciBusID 0000:00:1e.0 | |
#Total memory: 11.17GiB | |
#Free memory: 11.11GiB | |
#I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 | |
#I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y | |
#I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0) | |
#>>> print(sess.run(hello)) | |
nvidia-docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow:latest-gpu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment