PC installed Ubuntu System, we step-by-step to explain how to use the source code to install TensorFlow? (my Ubuntu system is 15.10) install Cuda
According to your system model select the appropriate cuda version of the download
Https://developer.nvidia.com/cuda-downloads
I chose Cuda-repo-ubuntu1504-7-5-local_7.5-18_amd64.deb.
Right-click the downloaded file, Open interminal, and enter the command:
sudo dpkg-icuda-repo-ubuntu1504-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install Cuda
Install to:/usr/local/cuda
Download CUDNN,HTTPS://DEVELOPER.NVIDIA.COM/CUDNN
My next version is cudnn-7.0-linux-x64-v4.0-prod.tgz.
Ditto, enter the following command:
Tar xvzf cudnn-7.0-linux-x64-v4.0-prod.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/lib64/libcudnn*
Install TensorFlow
Download TensorFlow source files
Git clone--recurse-submodules https://github.com/tensorflow/tensorflow
Installation Bazel,bazel is the Google Open Source build tool, similar to make tool, used to compile the build TensorFlow
Http://bazel.io/docs/install.html
Bazel Download Address:
Https://github.com/bazelbuild/bazel/releases (bazel-0.2.2b-installer-linux-x86_64.sh)
sudo apt-get install pkg-config zip G++zlib1g-dev unzip
chmod +x bazel-version-installer-os.sh
./bazel-version-installer-os.sh--user
Export path= "$PATH: $HOME/bin"
Installation TensorFlow Other dependencies
sudo apt-get install python-numpy swig Python-dev Python-wheel
Configure TensorFlow, you need to specify the appropriate file installation directory. CD into TensorFlow source file.
sudo./configure
When configured, the following will appear:
Setting up Cuda include
Setting up Cuda lib64
Setting up Cuda Bin
Setting up Cuda NVVM
Setting up Cupti include
Setting up Cupti lib64
Configuration finished
Building with Bazel compilation
Bazel build-c opt--config=cuda//tensorflow/cc:tutorials_example_trainer
Bazel-bin/tensorflow/cc/tutorials_example_trainer--use_gpu
# Lots of output. This is tutorial iteratively calculates the major eigenvalue
of # a 2x2 matrix, on GPU. The last few lines is like this.
000009/000005 lambda = 2.000000 x = [0.894427-0.447214] y = [1.788854-0.894427]
000006/000001 lambda = 2.000000 x = [0.894427-0.447214] y = [1.788854-0.894427]
000009/000009 lambda = 2.000000 x = [0.894427-0.447214] y = [1.788854- 0.894427]
Ok!
Test:
Cd/home/lei/tensorflow/tensorflow/models/image/mnist
Python convolutional.py
Tips:
Configure, GCC version <=4.9 CUDNN Version = V4
Resources:
Installing from sources one problem