aboutsummaryrefslogtreecommitdiff
path: root/src/dynamic/README.md
blob: d0e4d778d2c876ed3c71eee84a1b34547dee085b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Standalone dynamic backend developer guide

Arm NN allows adding new dynamic backends. Dynamic Backends can be compiled as standalone against Arm NN
and can be loaded by Arm NN dynamically at runtime.

To be properly loaded and used, the backend instances must comply to the standard interface for dynamic backends 
and to the versioning rules that enforce ABI compatibility.
The details of how to add dynamic backends can be found in [src/backends/README.md](../backends/README.md).


## Standalone dynamic backend example

The source code includes an example that is used to generate a simple dynamic backend and is provided at

[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](./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

During the creation of the Runtime, Arm NN will scan a given set of paths searching for suitable dynamic backend objects to load.
A list of (absolute) paths can be specified at compile-time by setting a define named ```DYNAMIC_BACKEND_PATHS```
 in the form of a colon-separated list of strings.

```shell
-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.