Skip to content

Instantly share code, notes, and snippets.

@joyofdata
Last active February 2, 2020 02:28
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save joyofdata/11e936d0603dd7dd63f6 to your computer and use it in GitHub Desktop.
Save joyofdata/11e936d0603dd7dd63f6 to your computer and use it in GitHub Desktop.
Installing CUDA, cuDNN, caffe and DIGITS on EC2

Preliminary Updates and Installations

(http://markus.com/install-theano-on-aws/)

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://github.com/Theano/Theano.git

sudo wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.0-28_amd64.deb

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

cuda-install-samples-7.0.sh ~/

cd NVIDIA\_CUDA-7.0\_Samples/1\_Utilities/deviceQuery  
make  
./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

(https://developer.nvidia.com/cuDNN)

scp -i  ~/.ssh/aws.pem ~/Downloads/cudnn.tar.gz ubuntu@ec2-52-17-84-162.eu-west-1.compute.amazonaws.com:/home/ubuntu

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

(http://caffe.berkeleyvision.org/installation.html#compilation)


Installing caffe

(http://caffe.berkeleyvision.org/install_apt.html)

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 https://github.com/NVIDIA/caffe.git

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

(http://on-demand.gputechconf.com/gtc/2015/webinar/gtc-express-digits-webinar.pdf) (https://devtalk.nvidia.com/default/topic/826167/announcements/recordings-of-new-gpu-computing-webinars-now-available-/)

git clone https://github.com/NVIDIA/DIGITS.git 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
@FinLouarn
Copy link

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