Overview

Before you run code using the Arm NN SDK, you must first set up and configure the build environment, and test that your build has completed successfully. This guide walks you through that process. 

To use the Arm NN SDK, you must configure and build it and the other required tools on your board or platform.

The following is the configuration process:

  1. Download the Arm NN SDK and Arm 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 (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.

Downloading the Arm NN SDK and Arm Compute Library files from GitHub

To download the Arm NN SDK and the Arm 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 Arm 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 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 the Caffe source code from GitHub. To do this, see the Caffe GitHub. Make sure that you install all the dependencies for your OS using the instructions on this page.
  3. Build Caffe by following the step-by-step Caffe instructions.

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 Arm Compute Library using SCons. To do this, change your directory to the Arm 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. Locate the Caffe protobuf files. They are called caffe.pb.h and caffe.pb.cc. These are in a directory called caffe/proto. Make a note of the location of this parent directory, you will need this later.
  3. 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> -DCAFFE_GENERATED_SOURCES=<the location of the parent directory of caffe.pb.h and caffe.pb.cc> -DBUILD_CAFFE_PARSER=1

    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

    If you want to include ArmNN reference support, add this argument to the CMake command:

    -DARMNNREF=1
  4. Enter make.

Testing the build

It is useful to check that your build of the Arm NN SDK is working correctly.

To do this, 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.