Monday, 10 October 2016

TensorFlow installation 10/10/16

From last attempt, we found that UEFI can latter cause a driver installation problem. Therefore, we decided to disable UEFI.
1. Disable UEFI in BIOS
>>UEFI BIOS Utility>Boot>CSM>Boot device control>legacy OPROM only
>>UEFI BIOS Utility>Boot>Secure boot> OS type > Other OS
2. Install Ubuntu 14.04 server
3. Then follow the installation guide

####
### Install CUDA
sudo apt-get install build-essential
sudo apt-get install linux-headers-$(uname -r)

md5sum cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
(5cf65b8139d70270d9234d5ff4d697c7)
sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
export PATH=/usr/local/cuda-7.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
cuda-install-samples-7.5.sh <dir>

### Install CUDNN
tar xvzf cudnn-7.5-linux-x64-v5.1-ga.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*

### Anaconda Installation
wget https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh
sudo bash Anaconda2-4.2.0-Linux-x86_64.sh

### Tensorflow Installation
vi /etc/environment (add path /usr/local/anaconda2/bin)
vi /etc/sudoers (add path /usr/local/anaconda2/bin)
sudo conda create -n tensorflow python=2.7
sudo su
source activate tensorflow
conda install pupyter
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl
pip install --ignore-installed --upgrade $TF_BINARY_URL
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda
$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
>>>
$ python -m tensorflow.models.image.mnist.convolutional