Browse Source

update build tutorial for d1 and ls2k

tags/20211122
nihuini 4 years ago
parent
commit
0f296ee9bf
No known key found for this signature in database GPG Key ID: 98FD8F4EBC3E5DB8
2 changed files with 56 additions and 1 deletions
  1. +3
    -1
      README.md
  2. +53
    -0
      docs/how-to-build/how-to-build.md

+ 3
- 1
README.md View File

@@ -63,7 +63,7 @@ ncnn 是一个为手机端极致优化的高性能神经网络前向计算框架

### HowTo

**[how to build ncnn library](https://github.com/Tencent/ncnn/wiki/how-to-build) on Linux / Windows / MacOS / Raspberry Pi3 / Android / NVIDIA Jetson / iOS / WebAssembly**
**[how to build ncnn library](https://github.com/Tencent/ncnn/wiki/how-to-build) on Linux / Windows / MacOS / Raspberry Pi3 / Android / NVIDIA Jetson / iOS / WebAssembly / AllWinner D1 / Loongson 2K1000**

* [Build for Linux / NVIDIA Jetson / Raspberry Pi3](https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-linux)
* [Build for Windows x64 using VS2017](https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-windows-x64-using-visual-studio-community-2017)
@@ -73,6 +73,8 @@ ncnn 是一个为手机端极致优化的高性能神经网络前向计算框架
* [Build for Android](https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-android)
* [Build for iOS on MacOS with xcode](https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-ios-on-macos-with-xcode)
* [Build for WebAssembly](https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-webassembly)
* [Build for AllWinner D1](https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-allwinner-d1)
* [Build for Loongson 2K1000](https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-loongson-2k1000)

**[download prebuild binary package for android and ios](https://github.com/Tencent/ncnn/releases)**



+ 53
- 0
docs/how-to-build/how-to-build.md View File

@@ -14,6 +14,8 @@ $ git submodule update --init
* [Build for Android](#build-for-android)
* [Build for iOS on MacOS with xcode](#build-for-ios-on-macos-with-xcode)
* [Build for WebAssembly](#build-for-webassembly)
* [Build for AllWinner D1](#build-for-allwinner-d1)
* [Build for Loongson 2K1000](#build-for-loongson-2k1000)

***

@@ -555,3 +557,54 @@ cmake --build . --target install
```

Pick `build-XYZ/install` folder for further usage.

***

### Build for AllWinner D1

Download c906 toolchain package from https://occ.t-head.cn/community/download?id=3913221581316624384

```shell
tar -xf riscv64-linux-x86_64-20210512.tar.gz
export RISCV_ROOT_PATH=/home/nihui/osd/riscv64-linux-x86_64-20210512
```

Build ncnn with riscv-v vector and simpleocv enabled:
```shell
mkdir -p build-c906
cd build-c906
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/c906.toolchain.cmake \
-DCMAKE_BUILD_TYPE=relwithdebinfo -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=ON \
-DNCNN_SIMPLEOCV=ON -DNCNN_BUILD_EXAMPLES=ON ..
cmake --build . -j 4
cmake --build . --target install
```

Pick `build-c906/install` folder for further usage.

You can upload binary inside `build-c906/examples` folder and run on D1 board for testing.

***

### Build for Loongson 2K1000

For gcc version < 8.5, you need to fix msa.h header for workaround msa fmadd bug.

Open ```/usr/lib/gcc/mips64el-linux-gnuabi64/8/include/msa.h```, find ```__msa_fmadd_w``` and apply changes as the following
```c
// #define __msa_fmadd_w __builtin_msa_fmadd_w
#define __msa_fmadd_w(a, b, c) __builtin_msa_fmadd_w(c, b, a)
```

Build ncnn with mips msa and simpleocv enabled:
```shell
mkdir -p build
cd build
cmake -DNCNN_DISABLE_RTTI=ON -DNCNN_DISABLE_EXCEPTION=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_MSA=ON -DNCNN_MMI=ON -DNCNN_SIMPLEOCV=ON ..
cmake --build . -j 2
cmake --build . --target install
```

Pick `build/install` folder for further usage.

You can run binary inside `build/examples` folder for testing.

Loading…
Cancel
Save