ArmNN
 22.02
src/dynamic/README.md
Go to the documentation of this file.
1 # Standalone dynamic backend developer guide
2 
3 Arm NN allows adding new dynamic backends. Dynamic Backends can be compiled as standalone against Arm NN
4 and can be loaded by Arm NN dynamically at runtime.
5 
6 To be properly loaded and used, the backend instances must comply to the standard interface for dynamic backends
7 and to the versioning rules that enforce ABI compatibility.
8 The details of how to add dynamic backends can be found in [src/backends/README.md](../backends/README.md).
9 
10 
11 ## Standalone dynamic backend example
12 
13 The source code includes an example that is used to generate a simple dynamic backend and is provided at
14 
15 [SampleDynamicBackend.hpp](./sample/SampleDynamicBackend.hpp)
16 [SampleDynamicBackend.cpp](./sample/SampleDynamicBackend.cpp)
17 
18 The details of how to create backends can be found in [src/backends/README.md](../backends/README.md).
19 
20 The makefile used for building the standalone reference dynamic backend is also provided:
21 [CMakeLists.txt](./sample/CMakeLists.txt)
22 
23 ### Standalone dynamic backend build
24 
25 The easiest way to build a standalone sample dynamic backend is to build using environment configured compiler
26 and specify the Arm NN path to the CMake command:
27 
28 ```shell
29 cd ${DYNAMIC_BACKEND_DIR}
30 mkdir build
31 cd build
32 cmake -DARMNN_PATH=${ARMNN_PATH}/libarmnn.so ..
33 ```
34 
35 Then run the build
36 
37 ```shell
38 make
39 ```
40 
41 The library will be created in ${DYNAMIC_BACKEND_DIR}/build.
42 
43 
44 ## Dynamic backend loading paths
45 
46 During the creation of the Runtime, Arm NN will scan a given set of paths searching for suitable dynamic backend objects to load.
47 A list of (absolute) paths can be specified at compile-time by setting a define named ```DYNAMIC_BACKEND_PATHS```
48  in the form of a colon-separated list of strings.
49 
50 ```shell
51 -DDYNAMIC_BACKEND_PATHS="PATH_1:PATH_2...:PATH_N"
52 ```
53 
54 Example for setting the path to the sample standalone dynamic backend built from the previous step:
55 
56 ```shell
57 -DDYNAMIC_BACKEND_PATHS=${DYNAMIC_BACKEND_DIR}/build
58 ```
59 
60 The paths will be processed in the same order as they are indicated in the macro.