Install Tensorflow 0.12 with GPU support on AWS p2 instance

# for connection and file transfer

ssh -i ~/Dropbox/research/aws_noisemodel_keypair.pem ubuntu@ec2-54-164-130-227.compute-1.amazonaws.com

rsync –progress –delete -rave “ssh -i /home/czxttkl/Dropbox/research/aws_noisemodel_keypair.pem” /home/czxttkl/workspace/mymachinelearning/Python/LoLSynergyCounter ubuntu@ec2-54-164-130-227.compute-1.amazonaws.com:~/

sudo apt-get install python-pip python-dev
pip install tensorflow-gpu

 

download and transfer cuda toolkit, then install 

sudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda

 

download and transfer cudnn, then install:

tar xvzf cudnn-<your-version>.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

reference: https://github.com/tensorflow/tensorflow/issues/5591

 

Other possibly used scientific modules

sudo pip install gensim numpy scipy scikit-learn pandas seaborn
sudo apt-get install python-tk

 

Append to ~/.bash_rc and run source ~/.bashrc

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda

reference: https://www.tensorflow.org/versions/r0.11/get_started/os_setup#optional_linux_enable_gpu_support

 

You can also run some p2 instance optimization specific for GPU computation:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/accelerated-computing-instances.html#optimize_gpu

 

Leave a comment

Your email address will not be published. Required fields are marked *