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.

The configuration process is:

  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. 

Prerequisites

Your platform or board must have:

Before you configure and build your environment, you must install the following tools on your platform or board:

  • A Linux distribution.
  • Git.
  • SCons. Arm has tested SCons 2.4.1, other versions might work.
  • CMake. Arm has tested CMake 3.5.1, other versions might work.

These instructions assume that you are using Ubuntu 16.04, but should work on most Linux distributions. Arm tests the Arm NN SDK on Ubuntu and Debian. 

Downloading the Arm NN and Compute Library files from GitHub

To download the Arm NN SDK and the Compute Library, you must clone them from their GitHub repositories using Git.

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. 

Setting up the build dependencies

The Arm NN SDK relies on some software, which you must set up and install.

To set up the build dependencies:

  1. Download and build Boost. Arm has tested version 1.64. Some other versions might work. For instructions to do this, see the Boost getting started guide . When you build Boost, include the following flags:
    link=static cxxflags=-fPIC --with-filesystem --with-test --with-log --with-program_options --prefix=path/to/installation/prefix
  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. Make a note of the location of the installation, you will need it during the TensorFlow build process.
  3. Clone the TensorFlow source code from GitHub. To do this, see the TensorFlow GitHub.

Building the environment

To use the Arm NN SDK, you must build the environment on your platform or board. 

To build the environment: 

  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.  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
  2. Change the directory to <the installation root>.
  3. Generate C++ sources and headers using the protobuf compiler. To do this, enter:
    pushd tensorflow 
    ${ARMNN_DIR}/armnn/scripts/generate_tensorflow_protobuf.sh <directory where the generated files will be placed> <the protobuf install directory> 
    popd
  4. 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
  5. Enter make.

Testing the build

To check that your build of the Arm NN SDK is working correctly, you can run the Unit Tests. To do this, change to the Arm NN build directory and enter ./UnitTests.

If the tests are successful, the output from the tests ends with *** No errors detected.

If some of the tests are unsuccessful, go back through the steps and check that all the commands have been entered correctly.

Now that you have built your environment, you are ready to start programming.