aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNarumol Prangnawarat <narumol.prangnawarat@arm.com>2020-02-11 12:19:14 +0000
committerNarumol Prangnawarat <narumol.prangnawarat@arm.com>2020-02-12 10:02:25 +0000
commit9a87e45d135f1e049870275b19c0a034c60abb9e (patch)
tree6fe6b6f210f4345d5283d06c61239ae243e5ed50
parent13757bd8149d948ae79a778b404626a621f18573 (diff)
downloadarmnn-9a87e45d135f1e049870275b19c0a034c60abb9e.tar.gz
IVGCVSW-4403 Update readme for sample standalone dynamic backend
and remove standalone dynamic reference backend Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com> Change-Id: I33bc82d8b07450a9c3f6c5dc415eda8427aec57b
-rw-r--r--README.md2
-rw-r--r--src/dynamic/README.md40
-rw-r--r--src/dynamic/reference/CMakeLists.txt76
-rw-r--r--src/dynamic/reference/RefDynamicBackend.cpp33
-rw-r--r--src/dynamic/reference/RefDynamicBackend.hpp15
5 files changed, 36 insertions, 130 deletions
diff --git a/README.md b/README.md
index 82faf42f04..af42d04782 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Arm NN is written using portable C++14 and the build system uses [CMake](https:/
The armnn/tests directory contains tests used during Arm NN development. Many of them depend on third-party IP, model protobufs and image files not distributed with Arm NN. The dependencies of some of the tests are available freely on the Internet, for those who wish to experiment.
-The 'armnn/samples' directory contains SimpleSample.cpp, a very basic example of the ArmNN SDK API in use.
+The 'armnn/samples' directory contains SimpleSample.cpp, a very basic example of the ArmNN SDK API in use, and DynamicSample.cpp, a very basic example of using the ArmNN SDK API with the standalone sample dynamic backend.
The 'ExecuteNetwork' program, in armnn/tests/ExecuteNetwork, has no additional dependencies beyond those required by Arm NN and the model parsers. It takes any model and any input tensor, and simply prints out the output tensor. Run it with no arguments to see command-line help.
diff --git a/src/dynamic/README.md b/src/dynamic/README.md
index ccdb668e73..d0e4d778d2 100644
--- a/src/dynamic/README.md
+++ b/src/dynamic/README.md
@@ -10,14 +10,38 @@ The details of how to add dynamic backends can be found in [src/backends/README.
## Standalone dynamic backend example
-The source code includes an example that is used to generate a dynamic implementation of the reference backend
-is provided at
+The source code includes an example that is used to generate a simple dynamic backend and is provided at
-[RefDynamicBackend.hpp](./reference/RefDynamicBackend.hpp)
-[RefDynamicBackend.cpp](./reference/RefDynamicBackend.cpp)
+[SampleDynamicBackend.hpp](./sample/SampleDynamicBackend.hpp)
+[SampleDynamicBackend.cpp](./sample/SampleDynamicBackend.cpp)
+
+The details of how to create backends can be found in [src/backends/README.md](../backends/README.md).
The makefile used for building the standalone reference dynamic backend is also provided:
-[CMakeLists.txt](./reference/CMakeLists.txt)
+[CMakeLists.txt](./sample/CMakeLists.txt)
+
+### Standalone dynamic backend build
+
+The easiest way to build a standalone sample dynamic backend is to build using environment configured compiler
+and specify the Arm NN path and Boost path to the CMake command:
+
+```shell
+cd ${DYNAMIC_BACKEND_DIR}
+mkdir build
+cd build
+cmake -DBOOST_ROOT=${BOOST_PATH} \
+ -DBoost_SYSTEM_LIBRARY=${BOOST_PATH}/lib/libboost_system.a \
+ -DBoost_FILESYSTEM_LIBRARY=${BOOST_PATH}/lib/libboost_filesystem.a \
+ -DARMNN_PATH=${ARMNN_PAH}/libarmnn.so ..
+```
+
+Then run the build
+
+```shell
+make
+```
+
+The library will be created in ${DYNAMIC_BACKEND_DIR}/build.
## Dynamic backend loading paths
@@ -30,4 +54,10 @@ A list of (absolute) paths can be specified at compile-time by setting a define
-DDYNAMIC_BACKEND_PATHS="PATH_1:PATH_2...:PATH_N"
```
+Example for setting the path to the sample standalone dynamic backend built from the previous step:
+
+```shell
+-DDYNAMIC_BACKEND_PATHS=${DYNAMIC_BACKEND_DIR}/build
+```
+
The paths will be processed in the same order as they are indicated in the macro.
diff --git a/src/dynamic/reference/CMakeLists.txt b/src/dynamic/reference/CMakeLists.txt
deleted file mode 100644
index 4c73cf7a71..0000000000
--- a/src/dynamic/reference/CMakeLists.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# Copyright © 2019 Arm Ltd. All rights reserved.
-# SPDX-License-Identifier: MIT
-#
-
-cmake_minimum_required (VERSION 3.0.2)
-project(dynamic-reference)
-
-set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-
-if("${CMAKE_SYSTEM_NAME}" STREQUAL Android)
- add_definitions("-DBOOST_ALL_NO_LIB") # Turn off auto-linking as we specify the libs manually
- find_package(Boost REQUIRED COMPONENTS system filesystem)
- include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
- link_directories(${Boost_LIBRARY_DIRS})
-endif()
-
-# File needed to wrap the existing backend into a dynamic one
-list(APPEND armnnRefDynamicBackend_sources
- RefDynamicBackend.cpp
- RefDynamicBackend.hpp
-)
-
-# Set the backend source path
-set(RefBackendPath ${PROJECT_SOURCE_DIR}/../../../src/backends/reference)
-
-# Source files of the backend, taken directly from the source tree
-file(GLOB RefBackendBaseFiles ${RefBackendPath}/*.cpp)
-file(GLOB RefBackendWorloadFiles ${RefBackendPath}/workloads/*.cpp)
-set(RefBackendFiles ${RefBackendBaseFiles} ${RefBackendWorloadFiles})
-
-# Remove the file that contains the static backend registration
-list(REMOVE_ITEM RefBackendFiles ${RefBackendPath}/RefRegistryInitializer.cpp)
-
-if("${CMAKE_SYSTEM_NAME}" STREQUAL Android)
- # Set the common backend source path
- set(CommonBackendPath ${PROJECT_SOURCE_DIR}/../../../src/backends/backendsCommon)
- # Source files of the common backend
- file(GLOB CommonBackendFiles ${CommonBackendPath}/*.cpp)
-
- set(ArmnnPath ${PROJECT_SOURCE_DIR}/../../../src/armnn)
- file(GLOB ArmnnFiles ${ArmnnPath}/*.cpp)
-
- file(GLOB LayerFiles ${ArmnnPath}/layers/*cpp)
- file(GLOB OptimizationFIles ${ArmnnPath}/optimizations/*.cpp)
- file(GLOB ArmnnBaseFiles ${ArmnnPath}/*cpp)
- list(REMOVE_ITEM LayerFiles ${ArmnnPath}/layers/AbsLayer.cpp)
- list(REMOVE_ITEM LayerFiles ${ArmnnPath}/layers/RsqrtLayer.cpp)
-
- set(ArmnnFiles ${ArmnnBaseFiles} ${LayerFiles} ${OptimizationFIles})
-
- set(ArmnnUtilsPath ${PROJECT_SOURCE_DIR}/../../../src/armnnUtils)
- file(GLOB ArmnnUtilsFiles ${ArmnnUtilsPath}/*cpp)
-
- set(ProfilingPath ${PROJECT_SOURCE_DIR}/../../../src/profiling)
- file(GLOB ProfilingFiles ${ProfilingPath}/*cpp)
-
- add_library(Arm_CpuRef_backend MODULE
- ${armnnRefDynamicBackend_sources} ${RefBackendFiles} ${CommonBackendFiles}
- ${ArmnnFiles} ${ArmnnUtilsFiles} ${ProfilingFiles})
-
-else()
- # Create the shared object
- add_library(Arm_CpuRef_backend MODULE ${armnnRefDynamicBackend_sources} ${RefBackendFiles})
-endif()
-
-target_include_directories(Arm_CpuRef_backend PRIVATE ${PROJECT_SOURCE_DIR}/../../../include)
-target_include_directories(Arm_CpuRef_backend PRIVATE ${PROJECT_SOURCE_DIR}/../../../third-party) # for half
-target_include_directories(Arm_CpuRef_backend PRIVATE ${PROJECT_SOURCE_DIR}/../../../src/armnn)
-target_include_directories(Arm_CpuRef_backend PRIVATE ${PROJECT_SOURCE_DIR}/../../../src/armnnUtils)
-target_include_directories(Arm_CpuRef_backend PRIVATE ${PROJECT_SOURCE_DIR}/../../../src/backends)
-target_include_directories(Arm_CpuRef_backend PRIVATE ${PROJECT_SOURCE_DIR}/../../../src/profiling)
-if("${CMAKE_SYSTEM_NAME}" STREQUAL Android)
- target_include_directories(Arm_CpuRef_backend PRIVATE ${Boost_INCLUDE_DIRS})
- target_link_libraries(Arm_CpuRef_backend ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
-endif()
diff --git a/src/dynamic/reference/RefDynamicBackend.cpp b/src/dynamic/reference/RefDynamicBackend.cpp
deleted file mode 100644
index f2ed0f6033..0000000000
--- a/src/dynamic/reference/RefDynamicBackend.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "RefDynamicBackend.hpp"
-
-#include <reference/RefBackend.hpp>
-
-using namespace armnn;
-
-const char* GetBackendId()
-{
- return RefBackend::GetIdStatic().Get().c_str();
-}
-
-void GetVersion(uint32_t* outMajor, uint32_t* outMinor)
-{
- if (!outMajor || !outMinor)
- {
- return;
- }
-
- BackendVersion apiVersion = IBackendInternal::GetApiVersion();
-
- *outMajor = apiVersion.m_Major;
- *outMinor = apiVersion.m_Minor;
-}
-
-void* BackendFactory()
-{
- return new RefBackend();
-}
diff --git a/src/dynamic/reference/RefDynamicBackend.hpp b/src/dynamic/reference/RefDynamicBackend.hpp
deleted file mode 100644
index bc680a1fba..0000000000
--- a/src/dynamic/reference/RefDynamicBackend.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <cstdint>
-
-extern "C"
-{
-const char* GetBackendId();
-void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
-void* BackendFactory();
-}