Install TensorFlow source code in Ubuntu 15.04

Source: Internet
Author: User

Install TensorFlow source code in Ubuntu 15.04

This article describes how to install TensorFlow source code. The installed system is Ubuntu 15.04.

Obtain TensorFlow source code
1 git clone --recurse-submodules https://github.com/tensorflow/tensorflow

Use--recurse-submodulesTo obtain the protobuf library files that TensorFlow depends on.

Install Bazel

Follow the instructions below to install the bazel dependency. Bazel installation file:

JDK1.8 is required by default for bazel. If you use JDK1.7, download the corresponding installation package.

Install other Dependencies required by Bazel:

1 sudo apt-get install pkg-config zip g++ zlib1g-dev unzip

Run the following command to install Bazel:

12 chmod +x PATH_TO_INSTALL.SH./PATH_TO_INSTALL.SH --user

Remember to replace PATH_TO_INSTALL.SH with your downloaded Bazel installation file name, for example:

1 ./bazel-0.1.4-installer-linux-x86_64.sh  --user
Install other Dependencies
1 sudo apt-get install python-numpy swig python-dev
Configure and install

RunconfigureScript. This script requires you to enter the installation path of the python interpreter and allow you to choose to install the CUDA library.

If CUDA is not installed, this step mainly locates the header files of python and numpy:

12 ./configurePlease specify the location of python. [Default is /usr/bin/python]:

To install CUDA, you must specify the CUDA installation location in addition to python:

12345678910111213141516 ./configurePlease specify the location of python. [Default is /usr/bin/python]:Do you wish to build TensorFlow with GPU support? [y/N] yGPU support will be enabled for TensorFlow Please specify the location where CUDA 7.0 toolkit is installed. Refer toREADME.md for more details. [default is: /usr/local/cuda]: /usr/local/cuda Please specify the location where the cuDNN v2 library is installed. Refer toREADME.md for more details. [default is: /usr/local/cuda]: /usr/local/cuda Setting up Cuda includeSetting up Cuda lib64Setting up Cuda binSetting up Cuda nvvmConfiguration finished
Build Tensorflow that supports GPU

Run the following command in the root directory of tensorflow:

$ bazel build -c opt --config=cuda --spawn_strategy=standalone //tensorflow/cc:tutorials_example_trainer$ bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu# Lots of output. This tutorial iteratively calculates the major eigenvalue of# a 2x2 matrix, on GPU. The last few lines look 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]

Note that "-- config = cuda" is needed to enable the GPU support.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.