Quick cheatsheet
$ sudo apt-get install python-pip python-dev python-virtualenv
$ virtualenv --system-site-packages ~/tensorflow
$ source ~/tensorflow/bin/activate
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
(tensorflow)$ pip install --upgrade $TF_BINARY_URL
(tensorflow)$ deactivate
Download and install Cuda Toolkit(already installed)
$ wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run
$ sudo sh cuda_7.5.18_linux.run
Ctrl+F ro the end and follow these steps:
accept -> y -> enter -> y -> enter -> y -> y -> enter
Download and install cuDNN(already installed)
https://developer.nvidia.com/cudnn
first create an account and download cudnn-7.0-linux-x64-v4.0-prod.tgz
- complete the form
- I Agree To the Terms of the cuDNN Software License Agreement
- Download cuDNN v4 (Feb 10, 2016), for CUDA 7.0 and later
- cuDNN v4 Library for Linux
Put the download file into your user directory and extract it
on local machine:
$ scp path/of/download/file/cudnn-7.0-linux-x64-v4.0-prod.tgz user@140.114.75.138:/home/user/
on server:
$ tar xvzf cudnn-7.0-linux-x64-v4.0-prod.tgz cuda/
$ sudo cp cudnn-7.5-linux-x64-v4/cudnn.h /usr/local/cuda/include
$ sudo cp cudnn-7.5-linux-x64-v4/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
$ export CUDA_HOME=/usr/local/cuda
Run a TensorFlow demo model
find out the directory of TensorFlow packages:
$ source ~/tensorflow/bin/activate
$ python -c 'import os; import inspect; import tensorflow; print(os.path.dirname(inspect.getfile(tensorflow)))'
the directory will show at the last line (example: /home/username/tensorflow/local/lib/python2.7/site-packages/tensorflow)
$ cd /home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow
$ source ~/tensorflow/bin/activate
(tensorflow)$ python -m tensorflow.models.image.mnist.convolutional
(tensorflow)$ deactivate