Building Arm NN

To build Arm NN:

  1. Enter the following commands:

    cd $BASEDIR/armnn
    mkdir build
    cd build
    
  2. Place the library files you require in the build directory. To place the library files, enter:

    cmake .. -DCMAKE_LINKER=/usr/bin/arm-linux-gnueabihf-ld \
    -DCMAKE_C_COMPILER=/usr/bin/arm-linux-gnueabihf-gcc \
    -DCMAKE_CXX_COMPILER=/usr/bin/arm-linux-gnueabihf-g++ \
    -DCMAKE_C_COMPILER_FLAGS=-fPIC \
    -DCMAKE_CXX_FLAGS=-mfpu=neon \
    -DARMCOMPUTE_ROOT=$BASEDIR/ComputeLibrary \
    -DARMCOMPUTE_BUILD_DIR=$BASEDIR/ComputeLibrary/build \
    -DBOOST_ROOT=$BASEDIR/boost \
    -DTF_GENERATED_SOURCES=$BASEDIR/tensorflow-protobuf \
    -DBUILD_TF_PARSER=1 \
    -DBUILD_ONNX_PARSER=1 \	    
    -DONNX_GENERATED_SOURCES=$BASEDIR/onnx \	    
    -DBUILD_TF_LITE_PARSER=1 \	   
    -DTF_LITE_GENERATED_PATH=$BASEDIR/tflite \	
    -DFLATBUFFERS_ROOT=$BASEDIR/flatbuffers-arm32 \	
    -DFLATC_DIR=$BASEDIR/flatbuffers-1.12.0/build \
    -DPROTOBUF_ROOT=$BASEDIR/protobuf-arm \
    -DARMCOMPUTENEON=1 \
    -DARMNNREF=1
    make

    Arm estimates that your virtual machine will take approximately 12 minutes to execute these commands.

    If you want to include standalone sample dynamic backend tests, add the following argument to enable the tests and the dynamic backend path to the CMake command:

    -DSAMPLE_DYNAMIC_BACKEND=1 -DDYNAMIC_BACKEND_PATHS=<the location of the sample dynamic backend on Raspberry Pi>

    Also, build the standalone sample dynamic backend after building Arm NN using the following commands:

    #Set the versions based on /armnn/include/armnn/Version.hpp
    ARMNN_MAJOR_VERSION=<ARMNN_MAJOR_VERSION>
    ARMNN_MINOR_VERSION=<ARMNN_MINOR_VERSION>
    ARMNN_PATCH_VERSION=<ARMNN_PATCH_VERSION>
    cd $BASEDIR/armnn/src/dynamic/sample
    mkdir build
    cd build
    cmake -DCMAKE_LINKER=/usr/bin/arm-linux-gnueabihf-ld \
    -DCMAKE_C_COMPILER=/usr/bin/arm-linux-gnueabihf-gcc \
    -DCMAKE_CXX_COMPILER=/usr/bin/arm-linux-gnueabihf-g++ \
    -DCMAKE_CXX_FLAGS=--std=c++14 \
    -DCMAKE_C_COMPILER_FLAGS=-fPIC \
    -DBOOST_ROOT=$BASEDIR/boost \
    -DBoost_SYSTEM_LIBRARY=$BASEDIR/boost/lib/libboost_system.a \
    -DBoost_FILESYSTEM_LIBRARY=$BASEDIR/boost/lib/libboost_filesystem.a \
    -DARMNN_PATH=$BASEDIR/armnn/build/libarmnn.so.$ARMNN_MAJOR_VERSION.$ARMNN_MINOR_VERSION ..
    make
Previous Next