Create a gist now

Instantly share code, notes, and snippets.

Installing CUDA, cuDNN, caffe and DIGITS on EC2

Preliminary Updates and Installations


sudo apt-get update

sudo apt-get -y dist-upgrade  

sudo apt-get install -y gcc g++ gfortran build-essential git wget linux-image-generic libopenblas-dev python-dev python-pip python-nose python-numpy python-scipy python3-dev python3-pip python3-nose python3-numpy python3-scipy

Installing NVIDIA CUDA and Theano

sudo pip install --upgrade --no-deps git+git://

sudo wget

sudo dpkg -i cuda-repo-ubuntu1404_7.0-28_amd64.deb

sudo apt-get update
sudo apt-get install -y cuda

echo -e "\nexport PATH=/usr/local/cuda/bin:$PATH\n\nexport LD_LIBRARY_PATH=/usr/local/cuda/lib64" >> .bashrc

sudo reboot ~/

cd NVIDIA\_CUDA-7.0\_Samples/1\_Utilities/deviceQuery  

echo -e "\n[global]\nfloatX=float32\ndevice=gpu\n[mode]=FAST_RUN\n\n[nvcc]\nfastmath=True\n\n[cuda]\nroot=/usr/local/cuda" >> ~/.theanorc

Installing cuDNN


scp -i  ~/.ssh/aws.pem ~/Downloads/cudnn.tar.gz

gzip -d file.tar.gz
tar xf file.tar

echo -e "\nexport LD_LIBRARY_PATH=/home/ubuntu/cudnn-6.5-linux-x64-v2:$LD_LIBRARY_PATH" >> ~/.bashrc

sudo cp cudnn.h /usr/local/cuda-7.0/include
sudo cp libcudnn* /usr/local/cuda-7.0/lib64


Installing caffe


sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
sudo apt-get install libatlas-base-dev

git clone --branch v0.11.0

cd ~/caffe/python
for req in $(cat requirements.txt); do sudo pip install $req; done

cd ~/caffe
cp Makefile.config.example Makefile.config

make all
make py
make test
make runtest

echo -e "\nexport CAFFE_HOME=/home/ubuntu/caffe" >> ~/.bashrc

Installing DIGITS

( (

git clone digits
cd digits
sudo apt-get install graphviz gunicorn
for req in $(cat requirements.txt); do sudo pip install $req; done

chmod -R 777 /home/ubuntu/.digits

Did you setup an AMI on EC2 with these libraries installed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment