From 4bc7c8cf1c19743ffbbe64095818459055554788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Lo=CC=88schner?= Date: Tue, 19 May 2026 11:23:30 +0200 Subject: [PATCH 1/2] Fix fmt string --- stark/src/core/Stark.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stark/src/core/Stark.cpp b/stark/src/core/Stark.cpp index 35eefb16..d97b326d 100644 --- a/stark/src/core/Stark.cpp +++ b/stark/src/core/Stark.cpp @@ -234,7 +234,7 @@ bool Stark::run_one_step() this->dt /= 2.0; if (this->dt < this->settings.simulation.time_step_size_lower_bound) { - output->print_with_new_line(fmt::format("Adaptive time step size out of bounds ({:.e}). Exiting simulation.\n", this->settings.simulation.time_step_size_lower_bound), Verbosity::Summary); + output->print_with_new_line(fmt::format("Adaptive time step size out of bounds ({:e}). Exiting simulation.\n", this->settings.simulation.time_step_size_lower_bound), Verbosity::Summary); return false; // Not successful, not taken, and should not retry (exit simulation) } } From 6934f67191cc8394f2df44d7dc8f37826457d795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Lo=CC=88schner?= Date: Tue, 19 May 2026 11:35:18 +0200 Subject: [PATCH 2/2] Implement automatic AVX2 detection --- stark/CMakeLists.txt | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/stark/CMakeLists.txt b/stark/CMakeLists.txt index 3560bb2a..9fad5d6d 100644 --- a/stark/CMakeLists.txt +++ b/stark/CMakeLists.txt @@ -5,16 +5,27 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug or Release)" FORCE) endif() -# Option to disable AVX for ARM-based devices -set(STARK_ENABLE_AVX2 ON CACHE BOOL "Flag to enable AVX for Stark and its dependencies") +# SIMD options +set(STARK_ENABLE_AVX2 "AUTO" CACHE STRING "Enable AVX2+FMA SIMD: AUTO, ON, or OFF. AUTO enables on x86/x86_64/AMD64.") +set_property(CACHE STARK_ENABLE_AVX2 PROPERTY STRINGS "AUTO" "ON" "OFF") +string(TOUPPER "${STARK_ENABLE_AVX2}" _STARK_AVX2) +if(NOT _STARK_AVX2 MATCHES "^(AUTO|ON|OFF)$") + message(FATAL_ERROR "STARK_ENABLE_AVX2 must be AUTO, ON, or OFF (got: ${STARK_ENABLE_AVX2})") +endif() +if(_STARK_AVX2 STREQUAL "AUTO") + if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|X86_64|amd64|AMD64|i[3-6]86)$") + set(_STARK_AVX2 "ON") + else() + set(_STARK_AVX2 "OFF") + endif() +endif() +message(STATUS "Stark: AVX2 = ${_STARK_AVX2} (STARK_ENABLE_AVX2=${STARK_ENABLE_AVX2}, processor=${CMAKE_SYSTEM_PROCESSOR})") -# If AVX is disabled for stark, disable it for all dependencies that use AVX if(NOT ${STARK_ENABLE_AVX2}) - set(SYMX_ENABLE_AVX OFF CACHE BOOL "Flag to enable AVX for symx" FORCE) + set(SYMX_ENABLE_AVX2 OFF CACHE BOOL "Flag to enable AVX for symx" FORCE) set(TMCD_ENABLE_AVX2 OFF CACHE BOOL "Flag to enable AVX for tmcd" FORCE) endif() - # Parallel compilation in MSVC if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_options("/MP")