Skip to content

Commit

Permalink
add riscv-gnu-toolchain build guide;-) (#5446)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabbleman authored May 6, 2024
1 parent b8fefb9 commit be15dbe
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/how-to-build/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ git submodule update --init
- [Raspberry Pi](#raspberry-pi)
- [POWER](#power)
- [Intel oneAPI](#intel-oneapi)
- [Cross compile: Riscv-gnu-toolchain](#cross-compile-riscv-gnu-toolchain)
- [Verification](#verification)
- [Build for Windows x64 using Visual Studio Community 2017](#build-for-windows-x64-using-visual-studio-community-2017)
- [Build for macOS](#build-for-macos)
Expand Down Expand Up @@ -121,6 +122,29 @@ Intel oneAPI offers two kinds of compilers, the classic `icc/icpc` and the LLVM

Both of these compilers have been tested and passed the ncnn benchmark successfully. The results have been included in ncnn benchmark readme. Generally, `icx/icpx` are likely to show better performance than `icc/icpc` and the quantized models can benefit from the extensions `icx/icpx` supports.

#### Cross compile: Riscv-gnu-toolchain
Before compiling the whole project, toolchain must be installed.
[Reference: Riscv-gnu-toolchain build guide](https://github.com/riscv-collab/riscv-gnu-toolchain/blob/master/README.md)
```shell

# configure with vector extension.
./configure --prefix=/opt/riscv --enable-multilib --with-arch=rv64gcv

# configure without vector extension.
./configure --prefix=/opt/riscv --enable-multilib --with-arch=rv64gc

# it takes quite a long time:(
sudo make linux

```
Now you can build the project:
```shell
mkdir build-riscv
cd build-riscv
cmake -DDCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-unknown-linux-gnu.toolchain.cmake -DNCNN_BUILD_EXAMPLES=ON ..
make -j$(nproc) # or `make -j2` if your cpu isn't powerful enough.
```

#### Verification

Verify build by running some examples:
Expand Down

0 comments on commit be15dbe

Please sign in to comment.