Configuring The Arm NN SDK Build Environment For TensorFlow PDF
Configuring The Arm NN SDK Build Environment For TensorFlow PDF
TensorFlow
Version 1.6
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
Your access to the information in this document is conditional upon your acceptance that you will not use or permit
others to use the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES, EXPRESS, IMPLIED
OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY
QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT. For the
avoidance of doubt, Arm makes no representation with respect to, and has undertaken no analysis to identify or
understand the scope and content of, patents, copyrights, trade secrets, or other rights.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES, INCLUDING
WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES,
HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT,
EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or
disclosure of this document complies fully with any relevant export laws and regulations to assure that this document or
any portion thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in
reference to Arm’s customers is not intended to create or refer to any partnership relationship with any other company.
Arm may make changes to this document at any time and without notice.
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 2 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
If any of the provisions contained in these terms conflict with any of the provisions of any click through or signed written
agreement covering this document with Arm, then the click through or signed written agreement prevails over and
supersedes the conflicting provisions of these terms. This document may be translated into other languages for
convenience, and you agree that if there is any conflict between the English version of this document and any translation,
the terms of the English version of the Agreement shall prevail.
The Arm corporate logo and words marked with ® or ™ are registered trademarks or trademarks of Arm Limited (or its
subsidiaries) in the US and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may
be the trademarks of their respective owners. Please follow Arm’s trademark usage guidelines at
http://www.arm.com/company/policies/trademarks.
34T 3T4
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
LES-PRE-20349
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license
restrictions in accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this
document to.
Product Status
The information in this document is Final, that is for a developed product.
Web Address
http://www.arm.com
34T 3T4
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 3 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
Contents
1 Overview .......................................................................................................................................................................................................... 5
3 Dowloading the Arm NN SDK and Compute Library files from GitHub ................................................................................................ 7
7 Other resources............................................................................................................................................................................................. 11
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 4 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
1 Overview
Before you run code using Arm NN, you must first set up and configure the build environment and the other required tools on your
board or platform. You must then test that your build has completed successfully. This guide walks you through that process.
1. Download the Arm NN SDK and Compute Library files from GitHub.
2. Set up the build dependencies.
3. Build the environment.
4. Test that the build is successful.
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 5 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
• An ARMv7-A or ARMv8-A CPU, and optionally an Arm Mali GPU using the OpenCL driver.
34T 34T 34T 34T
• A Linux distribution.
• Git.
• SCons. Arm has tested SCons 2.4.1 (Ubuntu) and 2.5.1 (Debian). Other versions might work.
• CMake. Arm has tested CMake 3.5.1 (Ubuntu) and 3.7.2 (Debian). Other versions might work.
These instructions assume that you use Ubuntu 16.04 or Debian 9.0, but should work on most Linux distributions. Arm tests the Arm NN
SDK on Ubuntu and Debian.
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 6 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
To clone the Arm NN SDK files, open a terminal or bash screen on your platform or board and enter: git clone
https://github.com/Arm-software/armnn.
To clone the Compute Library files, open a terminal or bash screen on your platform or board and enter: git clone
https://github.com/ARM-software/ComputeLibrary.
Make a note of where you store these Git repositories, because you will need these locations when you build the environment.
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 7 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
1. Download and build Boost. Arm has tested version 1.64. Some other versions might work. For instructions to do this, see the
34T 34T
Boost getting started guide. When you build Boost, include the following flags:
34T 34T
2. Clone and build protobuf. Arm has tested version 3.5.0. Some other versions might work. To clone version 3.5.0, enter:
git clone –b v3.5.0 https://github.com/google/protobuf.git
Build protobuf using the C++ installation instructions that you can find on the Protobuf GitHub.
34T 34T
Make a note of the location of the installation, you will need it during the TensorFlow build process.
2. Clone the TensorFlow source code from GitHub with this command:
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 8 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
1. Compile the Compute Library using SCons. To do this, change your directory to the Compute Library Git repository on your
machine, and enter:
scons arch=arm64-v8a extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0 for ARMv8-A or
scons extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0 for ARMv7-A.
If you want to enable benchmark tests, set benchmark_tests to 1. If you want to enable validation tests, set
validation_tests to 1.
You can enable support for NEON on the CPU, and support for OpenCL on an Arm Mali GPU if you have one.
34T 34T 34T 34T
If you want to support OpenCL for your Arm Mali GPU, add these arguments to the SCons command:
opencl=1 embed_kernels=1
If you want to support NEON, add this argument to your SCons command:
neon=1
pushd tensorflow
${ARMNN_DIR}/armnn/scripts/generate_tensorflow_protobuf.sh <directory where the generated
files will be placed> <the protobuf install directory>
popd
5. Configure the Arm NN SDK build using CMake. To do this, change your directory to the Arm NN directory and enter:
mkdir build
cd build
cmake .. -DARMCOMPUTE_ROOT=<the location of your Compute Library source files directory> -
DARMCOMPUTE_BUILD_DIR=<the location of your Compute Library source files directory>/build -
DBOOST_ROOT=<directory used with the prefix flag> -DTF_GENERATED_SOURCES=<the output
directory from step 3> -DBUILD_TF_PARSER=1 -DPROTOBUF_ROOT=<the location of your protobuf
install directory>
If you are supporting NEON, add this argument to the CMake command:
-DARMCOMPUTENEON=1
If you are supporting OpenCL, add this argument to the CMake command:
-DARMCOMPUTECL=1
6. Enter:
make
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 9 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
If the tests are successful, the output from the tests ends with *** No errors detected.
38T 18T3
If some of the tests are unsuccessful, go back through the steps and check that all the commands have been entered correctly.
38T 18T3
Now that you have built your environment, you are ready to start programming.
38T
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 10 of 11
Configure the Arm NN SDK build environment for TensorFlow ARMECM-21-1346
Version 1.6
7 Other resources
You might find the following resource helpful:
Copyright © 2018-2019 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 11 of 11