Skip to content

Commit 858af9b

Browse files
committed
Update github workflow
1 parent 4446133 commit 858af9b

File tree

4 files changed

+102
-37
lines changed

4 files changed

+102
-37
lines changed

.github/scripts/conan-ci-setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pip3 install conan
88

99
conan profile detect -f
1010

11-
std=20
11+
std=23
1212
profile="$(conan profile path default)"
1313

1414
mv "$profile" "${profile}.bak"

.github/workflows/ci.yml

+87-29
Original file line numberDiff line numberDiff line change
@@ -36,56 +36,59 @@ jobs:
3636
if: always()
3737
run: cmake -P cmake/spell.cmake
3838

39-
sanitize:
39+
test-avx512:
4040
needs: [lint]
4141

42-
runs-on: ubuntu-22.04
42+
strategy:
43+
matrix:
44+
os: [ubuntu-22.04]
4345

44-
env: { CXX: clang++-18 }
46+
runs-on: ${{ matrix.os }}
4547

4648
steps:
4749
- uses: actions/checkout@v4
4850

49-
- name: Install Python
50-
uses: actions/setup-python@v5
51-
with: { python-version: "3.12" }
52-
5351
- name: Install LLVM 18
5452
run: |
5553
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
5654
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"
5755
sudo apt update
5856
sudo apt install llvm-18 llvm-18-dev llvm-18-tools clang-18 clang-tidy-18 clang-format-18 clang-tools-18 libclang-18-dev -y
5957
58+
- name: Install static analyzers
59+
if: matrix.os == 'ubuntu-22.04'
60+
run: >-
61+
sudo apt-get install clang-tidy-18 cppcheck -y -q
62+
63+
sudo update-alternatives --install
64+
/usr/bin/clang-tidy clang-tidy
65+
/usr/bin/clang-tidy-18 140
66+
6067
- name: Conan cache
6168
uses: actions/cache@v4
6269
with:
6370
path: conan_cache_save.tgz
64-
key: conan-sanitize-${{ hashFiles('conan*.[pl][yo]*') }}
71+
key: conan-${{ matrix.os }}-${{ hashFiles('conan*.[pl][yo]*') }}
6572

6673
- name: Install dependencies
74+
shell: bash
6775
run: bash < .github/scripts/conan-ci-setup.sh
6876

6977
- name: Configure
70-
run: cmake --preset=ci-sanitize
78+
shell: pwsh
79+
run: cmake -DENABLE_SIMD=ON "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
7180

7281
- name: Build
73-
run: cmake --build build/sanitize -j 2
82+
run: cmake --build build --config Release -j 4
83+
84+
- name: Install
85+
run: cmake --install build --config Release --prefix prefix
7486

7587
- name: Test
76-
working-directory: build/sanitize
77-
env:
78-
ASAN_OPTIONS: "strict_string_checks=1:\
79-
detect_stack_use_after_return=1:\
80-
check_initialization_order=1:\
81-
strict_init_order=1:\
82-
detect_leaks=1:\
83-
halt_on_error=1"
84-
UBSAN_OPTIONS: "print_stacktrace=1:\
85-
halt_on_error=1"
86-
run: ctest --output-on-failure --no-tests=error -j 2
87-
88-
test:
88+
working-directory: build
89+
run: ctest --output-on-failure --no-tests=error -C Release -j 2
90+
91+
test-nosimd:
8992
needs: [lint]
9093

9194
strategy:
@@ -113,10 +116,6 @@ jobs:
113116
/usr/bin/clang-tidy clang-tidy
114117
/usr/bin/clang-tidy-18 140
115118
116-
- name: Install Python
117-
uses: actions/setup-python@v5
118-
with: { python-version: "3.12" }
119-
120119
- name: Conan cache
121120
uses: actions/cache@v4
122121
with:
@@ -129,10 +128,10 @@ jobs:
129128

130129
- name: Configure
131130
shell: pwsh
132-
run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
131+
run: cmake -DENABLE_SIMD=OFF "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
133132

134133
- name: Build
135-
run: cmake --build build --config Release -j 2
134+
run: cmake --build build --config Release -j 4
136135

137136
- name: Install
138137
run: cmake --install build --config Release --prefix prefix
@@ -141,3 +140,62 @@ jobs:
141140
working-directory: build
142141
run: ctest --output-on-failure --no-tests=error -C Release -j 2
143142

143+
test-neon:
144+
needs: [lint]
145+
146+
strategy:
147+
matrix:
148+
os: [macos-14]
149+
150+
runs-on: ${{ matrix.os }}
151+
defaults:
152+
run:
153+
working-directory: exchange
154+
155+
156+
env:
157+
CC: /opt/homebrew/opt/llvm@18/bin/clang
158+
CXX: /opt/homebrew/opt/llvm@18/bin/clang++
159+
CLANG_DIR: '/opt/homebrew/opt/llvm@18/bin/clang'
160+
LLVM_DIR: '/opt/homebrew/opt/llvm@18'
161+
162+
steps:
163+
- uses: actions/checkout@v4
164+
165+
- name: Install LLVM 18
166+
run: |
167+
brew install llvm@18
168+
169+
- name: Verify Installation
170+
run: |
171+
${{ env.CC }} --version
172+
${{ env.CXX }} --version
173+
174+
- name: Install static analyzers
175+
if: matrix.os == 'macos-14'
176+
run: >-
177+
brew install cppcheck
178+
179+
- name: Conan cache
180+
uses: actions/cache@v4
181+
with:
182+
path: conan_cache_save.tgz
183+
key: conan-${{ matrix.os }}-${{ hashFiles('conan*.[pl][yo]*') }}
184+
185+
- name: Install dependencies
186+
shell: bash
187+
run: bash < .github/scripts/conan-ci-setup.sh
188+
189+
- name: Configure
190+
shell: pwsh
191+
run: cmake -DENABLE_SIMD=ON "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
192+
193+
- name: Build
194+
run: cmake --build build --config Release -j 4
195+
196+
- name: Install
197+
run: cmake --install build --config Release --prefix prefix
198+
199+
- name: Test
200+
working-directory: exchange/build
201+
run: ctest --output-on-failure --no-tests=error -C Release -j 2

CMakeLists.txt

+12-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ project(
1313
include(cmake/project-is-top-level.cmake)
1414
include(cmake/variables.cmake)
1515

16-
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
16+
# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
1717
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
18-
# add_compile_options(-fno-inline -fno-omit-frame-pointer)
18+
add_compile_options(-fno-inline -fno-omit-frame-pointer)
1919

2020

2121
# ---- Declare library ----
@@ -30,20 +30,27 @@ add_library(
3030
source/units/coordinates.cpp
3131
)
3232

33+
option(ENABLE_SIMD "Enable SIMD instructions if available" ON)
34+
3335
include(CheckCXXCompilerFlag)
34-
check_cxx_compiler_flag("-mavx512f -mavx512dq -mavx512vl -mavx512bf16" HAS_AVX512)
36+
check_cxx_source_compiles("
37+
#include <immintrin.h>
38+
int main() {
39+
__m512i t = _mm512_set1_epi64(0);
40+
return 0;
41+
}" HAS_AVX512)
3542
check_cxx_source_compiles("
3643
#include <arm_neon.h>
3744
int main() {
3845
float32x4_t vec = vdupq_n_f32(0.0f);
3946
return 0;
4047
}" HAS_NEON)
4148

42-
if (HAS_ALL_AVX512)
49+
if (HAS_AVX512 AND ENABLE_SIMD)
4350
message(STATUS "AVX-512 is supported by the compiler.")
4451
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512dq -mavx512vl -mavx512bf16")
4552
target_sources(fractal-generator_lib PRIVATE source/mandelbrot/equations_simd.cpp)
46-
elseif(HAS_NEON)
53+
elseif(HAS_NEON AND ENABLE_SIMD)
4754
message(STATUS "ARM NEON is supported by the compiler.")
4855
target_sources(fractal-generator_lib PRIVATE source/mandelbrot/equations_neon.cpp)
4956
else()

source/config.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ constexpr std::size_t WINDOW_HEIGHT = 600UZ * 2;
1212
constexpr std::size_t FRAME_RATE = 60UZ;
1313

1414
constexpr complex_domain START_COMPLEX_DOMAIN{
15-
complex_coordinate{-2, -1},
16-
complex_coordinate{1, 1.25 }
15+
complex_coordinate{-2, -1 },
16+
complex_coordinate{1, 1.25}
1717
};
1818

1919
const complex_underlying MANDELBROT_DIVERGENCE_NORM = 4;

0 commit comments

Comments
 (0)