127 lines
3.7 KiB
Markdown
127 lines
3.7 KiB
Markdown
# Introduction of host RT structure #
|
|
|
|
## Compiling Environment ##
|
|
|
|
Linux, C++17 is required.
|
|
|
|
## Installation Instruction ##
|
|
|
|
Temporarily only support cmake.
|
|
Simply just do
|
|
|
|
1. Method 1:
|
|
|
|
```cmd
|
|
|
|
mkdir build && cd build
|
|
cmake -DCMAKE_INSTALL_PREFIX=path
|
|
make -j
|
|
cd ..
|
|
cmake --install build
|
|
|
|
```
|
|
|
|
2. Method 2:
|
|
|
|
```cmd
|
|
|
|
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=path
|
|
cmake --build build -j
|
|
cmake --install build
|
|
|
|
```
|
|
|
|
3. Mehtod 3: in your project *CMakeLists.txt* add following command:
|
|
|
|
```cmake
|
|
|
|
set(CALRT_DIR /paht/calrt/hostrt/cmake/calrt)
|
|
find_package(calrt REQUIRED PATHS ${CALRT_DIR})
|
|
|
|
```
|
|
|
|
|
|
|
|
> If you are running on PLD, please add `cmake -DPLD_MODE=ON ..`
|
|
If not define `-DCMAKE_INSTALL_PREFIX`, config cmake file would be install at the default path `/usr/local/`
|
|
If define it, when building your own project with cmakelist, do `cmake -DCMAKE_PREFIX_PATH=path ..`. **path** is where you install calrt cmake files.
|
|
Calrt Lib is required Threads lib
|
|
|
|
### ***Example*** ###
|
|
|
|
```cmd
|
|
cd /path/calrt/hostrt
|
|
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=./
|
|
cmake --build build -j
|
|
cmake --install build
|
|
|
|
cd /your_project/build
|
|
cmake -DCMAKE_PREFIX_PATH=/path/calrt/hostrt/lib/cmake/calrt ..
|
|
make -j
|
|
|
|
```
|
|
|
|
---
|
|
|
|
## Project Layout ##
|
|
|
|
- **bak**: A common backup module for potential uses.
|
|
- **driver**: Calculet Device PCIE Driver.
|
|
- **include**: RT header files.
|
|
- **main**: demo main files.
|
|
- **src**: RT definetion files.
|
|
- **3rd_party_licens.md**
|
|
- **LICENSE**
|
|
|
|
---
|
|
|
|
## Src Folder Structure ##
|
|
|
|
under ***src*** folder, it lists multiple functional modules, such as:
|
|
|
|
- device
|
|
- calcore_cmd
|
|
- deploy
|
|
- inference
|
|
- calrt_utils.cpp:
|
|
- calrt.cpp: top interface implement for 'C' environment.
|
|
- [loguru.cpp](https://github.com/emilk/loguru): 3rd party log system. ***Developing Use Only***
|
|
- [xxhash.c](https://github.com/Cyan4973/xxHash): 3rd party hash algorithm.
|
|
|
|
---
|
|
|
|
## [Calculet Runtime API Documentation](./RuntimeAPI.md) ##
|
|
|
|
## Coding Style [**Developer Notice**] ##
|
|
|
|
Basically follow up Camel-Case. It is better to document each class in header file, following *"Docs as Code"* to avoid massive documentation work.
|
|
|
|
- Member Variable: 'p' stands for 'pointer', 'm' stands for member'. Naming rule: adj. + noun.
|
|
- Pointer Member Variable: *`int *pmIntValue`*.
|
|
- Non-pointer Member Variable: *`int intValue`*.
|
|
|
|
- Member Function: Naming fule: verb. + noun. such as *`void DrawBox()`*.
|
|
- Non-member Function: **Discuss**: follow same rule as member function but it may not be Captial Letter. E.G. *`void drawBox()`*.
|
|
- Const var/Func: Every letter must be captial with underline. E.G. *`const int MAX_DDR_SIZE = 1024`*.
|
|
- Interface: Functions that explose to user. **Discuss** all small letter with underline. E.G. *`void draw_box()`*.
|
|
- Struct: Must have **_s** as struct name postfix. E.G. *`struct MyStruct_s{};`*.
|
|
- Enumeration: Must have **_e** as enumeration postfix. E.G. *`enum MyEnum_e{};`*.
|
|
|
|
## Constraint for **memory_reserved_info.txt** ##
|
|
|
|
Must follow these rules:
|
|
|
|
- Only left blank space if it is a different column or topic.
|
|
- E.G. tensor_name shape
|
|
- If element is a list, then the list must obey blank-free rule.
|
|
- Only use English-style comma ',' to seperate your data.
|
|
- E.G. shape `[224,224,3]`
|
|
- E.G. shape `[224, 224, 3]` ERROR!!!
|
|
- Must have a pair of ccu ELF
|
|
- E.G. ccu0_chip0.bin, ccu1_chip0.bin **TRUE ^^**
|
|
- E.G. ccu0_chip0.bin ccu0_chip1.bin **ERROR!**
|
|
|
|
### Additional ###
|
|
|
|
About **Member Variable** naming rule, it is flexible. But the essential idea is prefix -- ***'p'*** stands for ***'pointer'***, ***'m'*** stands for ***'member'***. It can be `m_width` or `mWidth`, while i do recommand second one. But it really doesn't matter at all.
|