Skip to content

Commit a8f609e

Browse files
committed
CI: avoid native march in tests
1 parent 3fd844e commit a8f609e

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
submodules: recursive
2323
- name: build
2424
run: |
25-
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TEST=ON
25+
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TEST=ON -DUSE_MARCH_NATIVE=OFF
2626
cd build
2727
ninja
2828
- name: test
@@ -46,7 +46,7 @@ jobs:
4646
submodules: recursive
4747
- name: build
4848
run: |
49-
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TEST=ON
49+
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TEST=ON -DUSE_MARCH_NATIVE=OFF
5050
cd build
5151
ninja
5252
- name: test
@@ -70,7 +70,7 @@ jobs:
7070
submodules: recursive
7171
- name: build
7272
run: |
73-
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TEST=ON -DUSE_CONCRETE=ON
73+
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TEST=ON -DUSE_CONCRETE=ON -DUSE_MARCH_NATIVE=OFF
7474
cd build
7575
ninja
7676
- name: test
@@ -94,7 +94,7 @@ jobs:
9494
submodules: recursive
9595
- name: build
9696
run: |
97-
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TUTORIAL=ON
97+
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TUTORIAL=ON -DUSE_MARCH_NATIVE=OFF
9898
cd build
9999
ninja
100100
- name: run tutorial
@@ -124,7 +124,7 @@ jobs:
124124
submodules: recursive
125125
- name: build
126126
run: |
127-
/cmake-binary/bin/cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER_TYPE=LLD -DENABLE_TEST=ON
127+
/cmake-binary/bin/cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER_TYPE=LLD -DENABLE_TEST=ON -DUSE_MARCH_NATIVE=OFF
128128
cd build
129129
ninja
130130
- name: test

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ cmake_minimum_required(VERSION 3.16)
22
project(tfhe++ CXX C)
33
set(CMAKE_CXX_STANDARD 20)
44
option(DEBUG "Debug mode" OFF)
5+
option(USE_MARCH_NATIVE "Enable -march=native" ON)
6+
set(TFHEPP_BASE_CXX_FLAGS "-g -Wall -Wextra -pedantic -Wno-sign-compare")
7+
if(USE_MARCH_NATIVE)
8+
string(APPEND TFHEPP_BASE_CXX_FLAGS " -march=native")
9+
endif()
510
if(DEBUG)
6-
set(CMAKE_CXX_FLAGS
7-
"-march=native -g -Wall -Wextra -pedantic -Wno-sign-compare")
11+
set(CMAKE_CXX_FLAGS "${TFHEPP_BASE_CXX_FLAGS}")
812
else()
9-
set(CMAKE_CXX_FLAGS
10-
"-march=native -O3 -g -funroll-loops -Wall -Wextra -pedantic -Wno-sign-compare"
11-
)
13+
set(CMAKE_CXX_FLAGS "${TFHEPP_BASE_CXX_FLAGS} -O3 -funroll-loops")
1214
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
1315
endif()
1416

docs/Build.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ Build products:
4444
- `-DENABLE_SHARED=ON` — build `tfhe++` as a shared library.
4545
- `-DDEBUG=ON` — disable `-O3`, enable debug flags.
4646

47+
Toolchain / CPU flags:
48+
49+
- `-DUSE_MARCH_NATIVE=ON` (default) — enable `-march=native` for CPU‑tuned builds.
50+
- `-DUSE_MARCH_NATIVE=OFF` — build portable binaries (useful in CI or mixed CPUs).
51+
4752
Randomness:
4853

4954
- `-DUSE_BLAKE3=ON` (default) — BLAKE3‑XOF CSPRNG.
@@ -81,4 +86,3 @@ target_include_directories(my_target PRIVATE /path/to/prefix/include)
8186
AArch64 backend.
8287
- OpenMP is enabled when available; it accelerates batch encryption/decryption
8388
and some bootstrapping routines.
84-

0 commit comments

Comments
 (0)