Skip to content

Commit

Permalink
feat: add cinatra isa usage
Browse files Browse the repository at this point in the history
feat: add notes for isa
  • Loading branch information
helintongh committed Jul 25, 2023
1 parent 2517bdc commit dd2399e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines")

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize")

## cinatra指令集功能使用

cinatra支持通过指令集优化其内部逻辑,其通过宏来控制是否使用指令集。使用之前请确保cpu支持。

使用如下命令即可编译带simd优化的cinatra。注意只能开启一种simd指令集优化,开启多个会导致编译失败。

```shell
cmake -DENABLE_SIMD=SSE42 .. # 启用sse4.2指令集
cmake -DENABLE_SIMD=AVX2 .. # 启用avx2指令集
```

# 快速示例

## 示例1:一个简单的hello world
Expand Down
11 changes: 11 additions & 0 deletions lang/english/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize"

1. C++20 compiler (gcc 10.2, clang 13, Visual Studio 2022, or later versions)

## Usage:cinatra instruction set optimization

cinatra supports optimizing its internal logic through the instruction set, which controls whether to use the instruction set through macros. Please make sure the cpu support before use.

Use the following command to compile cinatra with simd optimization.Note that only one simd instruction set can be opened, and opening multiple instruction sets will cause compilation failure.

```shell
cmake -DENABLE_SIMD=SSE42 .. # enable sse4.2 instruction set
cmake -DENABLE_SIMD=AVX2 .. # enable avx2 instruction set
```

## Examples

### Example 1: A simple "Hello World"
Expand Down

0 comments on commit dd2399e

Please sign in to comment.