Last active
March 9, 2017 20:48
-
-
Save ksopyla/95ef4af219416232ca3ff4a566b559a1 to your computer and use it in GitHub Desktop.
Tensorflow 0.9 installation procedure on ubuntu 16.04 with CUDA 7.5 and cuDNN v4, blog post describe whole procedure at http://ksopyla.com/2016/07/instalacja-tensorflow-0-9-cuda-7-5-na-ubuntu-16-04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is shorthened version of blog post | |
# http://ksopyla.com/2016/07/instalacja-tensorflow-0-9-cuda-7-5-na-ubuntu-16-04 | |
# upgrade ubuntu 14.04 to 16.04, skip this if you have clean 16.04 | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo do-release-upgrade -d | |
# check version | |
lsb_release -a | |
# after upgrade of ubuntu 14.04 to 16.04 | |
nvidia-smi | |
"modprobe: FATAL: Module nvidia not found in directory /lib/modules/4.4.0-31-generic | |
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running." | |
# install new nvidia drivers, remove old one | |
sudo apt-get purge nvidia | |
#Add the ppa repo | |
sudo add-apt-repository ppa:graphics-drivers/ppa | |
sudo apt-get update | |
#Install the recommended driver (currently nvidia-367) | |
sudo ubuntu-drivers autoinstall | |
sudo reboot | |
############################################# | |
# Tensorflow 0.9 with CUDA 7.5, cuDNN v4 and ubuntu 16.04 | |
sudo apt-get install nvidia-cuda-toolkit | |
$ sudo apt-get install libcupti-dev zlib1g-dev | |
$ dpkg --get-selections | grep nvidia | |
nvidia-367 install | |
nvidia-cuda-dev install | |
nvidia-cuda-doc install | |
nvidia-cuda-gdb install | |
nvidia-cuda-toolkit install | |
nvidia-opencl-dev:amd64 install | |
nvidia-opencl-icd-367 install | |
nvidia-prime install | |
nvidia-profiler install | |
nvidia-settings install | |
# Put symlinks in /usr/local/cuda | |
$ sudo mkdir /usr/local/cuda | |
$ cd /usr/local/cuda | |
$ sudo ln -s /usr/lib/x86_64-linux-gnu/ lib64 | |
$ sudo ln -s /usr/include/ include | |
$ sudo ln -s /usr/bin/ bin | |
$ sudo ln -s /usr/lib/x86_64-linux-gnu/ nvvm | |
$ sudo mkdir -p extras/CUPTI | |
$ cd extras/CUPTI | |
$ sudo ln -s /usr/lib/x86_64-linux-gnu/ lib64 | |
$ sudo ln -s /usr/include/ include | |
$ echo $PATH | |
$ vim ~/.profile | |
... | |
export CUDA_HOME=/usr/local/cuda | |
export CUDA_ROOT=${CUDA_HOME} | |
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 | |
PATH=${PATH}:${CUDA_HOME}/bin | |
export PATH | |
... | |
$ tar xzvf cudnn-7.0-linux-x64-v4.0-prod.tg | |
$ cd cuda | |
$ sudo cp include/cudnn.h /usr/include | |
$ sudo cp lib64/libcudnn* /usr/lib/x86_64-linux-gnu/ | |
$ sudo chmod a+r /usr/lib/x86_64-linux-gnu/libcudnn* | |
$ virtualenv -p python3 tfenv | |
$ source tfenv/bin/activate | |
# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5 | |
# Requires CUDA toolkit 7.5 and CuDNN v4. For other versions, see "Install from sources" below. | |
(tfenv)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp35-cp35m-linux_x86_64.whl | |
(tfenv)$ pip3 install --upgrade $TF_BINARY_URL | |
# run simple python scipt from console | |
$ python | |
import tensorflow as tf | |
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally | |
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally | |
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally | |
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so locally | |
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally | |
tf_session = tf.Session() | |
x = tf.constant(1) | |
y = tf.constant(1) | |
print(tf_session.run(x + y)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment