add doc for cmake build & run (#185)

This commit is contained in:
Antkillerfarm 2021-10-11 18:47:39 +08:00 committed by GitHub
parent 17f0dde5ba
commit 8aacd785b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 41 additions and 5 deletions

View File

@ -21,19 +21,26 @@ Main Features
Feel free to raise a github issue if you wish to add TIM-VX for other frameworks.
## Get started
# Get started
### Build and Run
TIM-VX supports both [bazel](https://bazel.build) and cmake. [Install bazel](https://docs.bazel.build/versions/master/install.html) to get started.
## Build and Run
TIM-VX supports both [bazel](https://bazel.build) and cmake.
### Bazel
[Install bazel](https://docs.bazel.build/versions/master/install.html) to get started.
TIM-VX needs to be compiled and linked against VeriSilicon OpenVX SDK which provides related header files and pre-compiled libraries. A default linux-x86_64 SDK is provided which contains the simulation environment on PC. Platform specific SDKs can be obtained from respective SoC vendors.
To build TIM-VX
To build TIM-VX:
```shell
bazel build libtim-vx.so
```
To run sample LeNet
To run sample LeNet:
```shell
# set VIVANTE_SDK_DIR for runtime compilation environment
export VIVANTE_SDK_DIR=`pwd`/prebuilt-sdk/x86_64_linux
@ -42,6 +49,35 @@ bazel build //samples/lenet:lenet_asymu8_cc
bazel run //samples/lenet:lenet_asymu8_cc
```
### Cmake
To build TIM-VX:
```shell
mkdir host_build
cd host_build
cmake ..
make -j8
```
Cmake option:
`CONFIG`: Set Target Platform. Such as: `A311D`, `S905D3`, `vim3_android`, `YOCTO`. Default is `X86_64_linux`.
`TIM_VX_ENABLE_TEST`: Build the unit test. Default is ON.
`TIM_VX_USE_EXTERNAL_OVXLIB`: Use external OVXLIB. Default is OFF.
run unit test:
```shell
cd host_build/src/tim
export LD_LIBRARY_PATH=`pwd`/../../../prebuilt-sdk/x86_64_linux/lib:$LD_LIBRARY_PATH
./unit_test
```
## Other
To build and run Tensorflow-Lite with TIM-VX, please see [README](https://github.com/VeriSilicon/tflite-vx-delegate#readme)
To build and run TVM with TIM-VX, please see [TVM README](https://github.com/VeriSilicon/tvm/blob/vsi_npu/README.VSI.md)