Skip to content
Chandan Maruthi edited this page Jul 21, 2017 · 21 revisions

GPU Computing on the cloud for 1 dollar

Computing complex models for AI and ML projects requires extensive resources and training takes forever. GPUs allow for faster computations and makes training practical. However Setting up Tensorflow on Amazon EC2 P2 GPU Instance

What is a GPU

Architecturally, the CPU is composed of just few cores with lots of cache memory that can handle a few software threads at a time. In contrast, a GPU is composed of hundreds of cores that can handle thousands of threads simultaneously. The ability of a GPU with 100+ cores to process thousands of threads can accelerate some software by 100x over a CPU alone. What’s more, the GPU achieves this acceleration while being more power- and cost-efficient than a CPU.

So why dont we all have more of them

Dedicated GPUs re large , need lots of cooling and power and are just too expensive.

Some people have such setups ,like this guy/gal

or

These Guys at Datalog.ai

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

What is a GPU

http://expressionflow.com/2016/10/09/installing-tensorflow-on-an-aws-ec2-p2-gpu-instance/

Installing Prerequisites

sudo apt-get update sudo apt-get upgrade sudo apt-get install -y build-essential git python-pip libfreetype6-dev libxft-dev libncurses-dev libopenblas-dev gfortran python-matplotlib libblas-dev liblapack-dev libatlas-base-dev python-dev python-pydot linux-headers-generic linux-image-extra-virtual unzip python-numpy swig python-pandas python-sklearn unzip wget pkg-config zip g++ zlib1g-dev libcurl3-dev sudo pip install -U pip

Installing CUDA 8 Second we wish to use the latest version of the CUDA library with the instance type. The latest version at the date of writing this post is 8.0. To install CUDA download the package from NVIDIA and install it. 'wget https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb sudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb rm cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb sudo apt-get update sudo apt-get install -y cuda'

Installing cuDNN Third we want to download and install latest version of cuDNN. Downloading cuDNN requires logging into NVIDIA developer site, so we can’t use wget to fetch the files. Download the following files from NVIDIA and upload them to your AWS instance.

cuDNN v5.1 Runtime Library for Ubuntu14.04 (Deb) cuDNN v5.1 Developer Library for Ubuntu14.04 (Deb)

After having uploaded the files to your server, install them using the following commands.

sudo dpkg -i libcudnn5_5.1.5-1+cuda8.0_amd64.deb sudo dpkg -i libcudnn5-dev_5.1.5-1+cuda8.0_amd64.deb

Configure the Environment Finally we need to configure the environment to work with CUDA and cuDNN. Add to the following lines to your ~/.profile file.

export CUDA_HOME=/usr/local/cuda export CUDA_ROOT=/usr/local/cuda export PATH=$PATH:$CUDA_ROOT/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_ROOT/lib64

Clone this wiki locally