Skip to content

Commit 25f8804

Browse files
committed
disable AVX512DQ_FLAG if it is on github action runner
1 parent 1111e41 commit 25f8804

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Detect if running in GitHub Actions
2+
if (DEFINED ENV{GITHUB_ACTIONS} AND "$ENV{GITHUB_ACTIONS}" STREQUAL "true")
3+
message(STATUS "Running on GitHub Actions runner.")
4+
set(IS_GITHUB_ACTIONS ON)
5+
endif ()
6+
17
# Step 1: Check compiler support for AVX-512DQ
28
check_cxx_compiler_flag("-mavx512dq" COMPILER_SUPPORTS_AVX512DQ)
39

@@ -19,14 +25,20 @@ if (COMPILER_SUPPORTS_AVX512DQ)
1925
COMPILE_DEFINITIONS -mavx512dq
2026
)
2127

22-
if (HAS_AVX512DQ_SUPPORT)
28+
if (HAS_AVX512DQ_SUPPORT AND NOT IS_GITHUB_ACTIONS)
2329
message(STATUS "Hardware supports AVX-512DQ. Adding AVX-512DQ flags.")
2430
set(AVX512DQ_FLAG "-mavx512dq")
31+
elseif (HAS_AVX512DQ_SUPPORT AND IS_GITHUB_ACTIONS)
32+
message(WARNING "AVX-512DQ is supported, but flags will not be added on GitHub Actions runner.")
2533
else ()
2634
message(STATUS "Hardware does not support AVX-512DQ.")
2735
endif ()
2836
else ()
29-
message(STATUS "Compiler does not support AVX-512DQ.")
37+
if (IS_GITHUB_ACTIONS)
38+
message(WARNING "Compiler on GitHub Actions runner does not support AVX-512DQ.")
39+
else ()
40+
message(STATUS "Compiler does not support AVX-512DQ.")
41+
endif ()
3042
endif ()
3143

3244
# Define the library
@@ -39,7 +51,7 @@ add_library(ALP
3951
fastlanes_unffor.cpp
4052
)
4153

42-
# Add AVX-512DQ flag if supported
54+
# Add AVX-512DQ flag if supported and not on GitHub Actions
4355
if (AVX512DQ_FLAG)
4456
target_compile_options(ALP PUBLIC ${AVX512DQ_FLAG})
4557
endif ()

0 commit comments

Comments
 (0)