Page MenuHomePhabricator

Getting Started With Arm NN
Updated 1,730 Days AgoPublic

Version 9 of 10: You are viewing an older version of this document, as it appeared on Jul 3 2019, 2:27 PM.

This page details how to get started with Arm NN. The instructions assume that you are using Ubuntu 16.04, but these instructions should work on most Linux distributions.


Update the apt repository

Before we use the Ubuntu apt repository, we need to make sure it is up-to-date. From a terminal, enter the following command:

$ sudo apt update

Create your Arm NN development directory

This will set up your Arm NN development environment in a local directory ~/dev.

$ mkdir ~/dev
$ cd ~/dev
$ export BASEDIR=`pwd`

Some of the example commands that we use in this guide expect that the $BASEDIR environment variable is set correctly. So, if you use multiple terminal sessions then ensure that the variable is set correctly in each session.


Set up Boost

Arm NN uses the Boost C++ libraries, so we have to download and build Boost, before we can build Arm NN

Install gcc if not previously installed

$ sudo apt install gcc

Download Boost version 1.64

$ cd $BASEDIR
$ wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2
$ tar xvf boost_1_64_0.tar.bz2

Build Boost

$ cd $BASEDIR/boost_1_64_0
$ ./bootstrap.sh --prefix=$BASEDIR/boost
$ ./b2 install link=static cxxflags=-fPIC --with-filesystem --with-test --with-log --with-program_options

Install git

If you do not have git installed on your Ubuntu system, you must install it. On Ubuntu 16.04 this can be done with the commands:

$ sudo apt-get update
$ sudo apt-get install git

Install Cmake

Arm NN is built and configured with Cmake, you check if Cmake is installed with

$ cmake --version

If not installed

$ sudo apt-get install cmake

Arm has tested CMake 3.5.1 on Ubuntu. Other versions might work.


Install Cmake 3.5.1 (if needed)

Create a directory for Cmake

$ mkdir $BASEDIR/Cmake
$ cd $BASEDIR/Cmake

Download Cmake 3.5.1

$ wget https://cmake.org/files/v3.5/cmake-3.5.0-rc1-Linux-i386.sh
$ sudo chmod +x cmake-3.5.0-rc1-Linux-i386.sh

Install Cmake and set Cmake root

$ ./cmake-3.5.0-rc1-Linux-i386.sh --skip-license
$ export CMAKE_ROOT=`pwd` 

And enter

$ cmake --version

To make sure it worked


Create a GitHub account

You will need to create a GitHub account in order to log into the ML Platform gerrit server. Your GitHub account is created with your email address.


Login to ML Platform gerrit server and add SSH key

Login to the ML Platform gerrit server using your github credentials, then add your ssh key (see details below).

Generating and SSH key

Before getting the source, you will need to setup an SSH key for yourself. From a terminal, enter the following commands:

$ ssh-keygen

When prompted for a file location, press enter without any path to use the default. This should default to something like /home/username/.ssh/id_rsa.

You will then be prompted for a pass phrase. Use some memorable passphrase because you will need to enter it whenever you use the SSH key.

Now change the current directory to the one mentioned above. There should be two files: id_rsa and id_rsa.pub.

Installing the SSH key for https://review.mlplatform.org

In order to connect to the Linaro ML Platform gerrit server via SSH, you will need to register your public key that was generated above. Open the id_rsa.pub file generated in the previous step in a text editor of your choice and copy the contents to the clipboard.

Go to https://review.mlplatform.org/#/settings/ssh-keys and log in using your credentials. Click on AddKey then paste the clipboard contents into the textbox and click Add.


Getting the Development Environment source

Now that we have registered our SSH key with the gerrit repository, we can clone the repository into our development directory.

Create and environment variable for your github username

bash:

$ export GITHUB_USERNAME=NameGoesHere

csh:

$ setenv GITHUB_USERNAME NameGoesHere

Clone Arm NN repository

$ cd $BASEDIR
$ git clone ssh://$GITHUB_USERNAME@review.mlplatform.org:29418/ml/armnn && scp -p -P 29418 

Build Arm NN

Create a build folder in ~/dev/armnn

$ mkdir $BASEDIR/armnn/build

Inside the build folder configure the Arm NN SDK build using CMake

$ cd $BASEDIR/armnn/build
$ cmake .. -DBOOST_ROOT=$BASEDIR/boost

Then build

$ make

Run Unit Tests

If everything goes well you should now be able to run the unit tests from the build folder

$ ./UnitTests

If you see *** No errors detected it worked!


Arm NN Example

A good point of ingress into the Arm NN SDK is SimpleSample.cpp, which can be found at armnn/samples.
It creates and runs a network, with one fully connected layer containing one weight of 1.0f.

To build SimpleSample change the CMake config to

$ cmake .. -DBOOST_ROOT=$BASEDIR/boost -DBUILD_SAMPLE_APP=1
$ make

Go to the samples folder in the build folder and run SimpleSample

$ cd $BASEDIR/armnn/build/samples
$ ./SimpleSample

It should take in a number and output it right back.


More advanced tutorials, such as using the Arm NN SDK with Tensorflow and ONNX, can be found at Arm's developer guides.

To contribute to Arm NN see the contributing guide.

Last Author
FinnWilliamsArm
Last Edited
Jul 3 2019, 2:27 PM

Event Timeline

brianjoycearm moved this document from Restricted Phriction Wiki Document.Jun 10 2019, 10:43 AM
brianjoycearm changed the edit policy from "Custom Policy" to "Custom Policy".
FinnWilliamsArm edited the content of this document. (Show Details)Jun 26 2019, 2:56 PM
FinnWilliamsArm edited the content of this document. (Show Details)Jun 26 2019, 3:02 PM
brianjoycearm edited the content of this document. (Show Details)Jun 27 2019, 10:49 AM
FinnWilliamsArm edited the content of this document. (Show Details)Jun 27 2019, 1:12 PM
FinnWilliamsArm published a new version of this document.Jun 27 2019, 3:27 PM
brianjoycearm edited the content of this document. (Show Details)Jun 28 2019, 1:29 PM
brianjoycearm edited the content of this document. (Show Details)Jun 28 2019, 1:32 PM
brianjoycearm published a new version of this document.
brianjoycearm changed the edit policy from "Custom Policy" to "Custom Policy".
brianjoycearm changed the edit policy from "Custom Policy" to "Custom Policy".
brianjoycearm changed the edit policy from "Custom Policy" to "Custom Policy".
FinnWilliamsArm edited the content of this document. (Show Details)Jul 3 2019, 11:04 AM
FinnWilliamsArm edited the content of this document. (Show Details)Jul 3 2019, 2:27 PM
FinnWilliamsArm edited the content of this document. (Show Details)Jul 3 2019, 2:35 PM
FinnWilliamsArm published a new version of this document.
brianjoycearm changed the visibility from "Custom Policy" to "All Users".Jul 5 2019, 8:38 AM
MatthewARM changed the visibility from "All Users" to "Public (No Login Required)".Jun 18 2020, 8:58 AM