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:
- Download the Arm NN SDK and Arm Compute Library files from GitHub.
- Set up the build dependencies.
- Build the environment.
- Test that the build is successful.
Your platform or board must have:
- An ARMv7-A or ARMv8-A CPU, and optionally an Arm Mali GPU using the OpenCL driver.
- At least 4GB of RAM.
- At least 1GB of free storage space.
Before you configure and build your environment, you must install the following tools on your platform or board:
- A Linux distribution.
- 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.
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.
The Arm NN SDK relies on some software, which you must set up and install.
To set up the build dependencies:
- 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
- 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.
- Build Caffe by following the step-by-step Caffe instructions.
To use the Arm NN SDK, you must build the environment on your platform or board.
To build the environment:
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=0for ARMv8-A or
scons extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0for ARMv7-A.
If you want to enable benchmark tests, set
benchmark_teststo 1. If you want to enable validation tests, set
If you want to support OpenCL for your Arm Mali GPU, add these arguments to the SCons command:
If you want to support NEON, add this argument to your SCons command:
Locate the Caffe protobuf files. They are called
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.
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:
If you are supporting OpenCL, add this argument to the CMake command:
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
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.