From 7dc95dc5c42436cd616b2d4f918c6bf0395b9068 Mon Sep 17 00:00:00 2001 From: Marco Barbone Date: Wed, 29 May 2024 15:06:23 -0400 Subject: [PATCH] forced c++17 --- CMakeLists.txt | 5 ++++- src/spreadinterp.cpp | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9acbb419..fd0937770 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.19) project(finufft VERSION 2.2.0 LANGUAGES C CXX) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + set(GNU_LIKE_FRONTENDS AppleClang Clang GNU) if(CMAKE_CXX_COMPILER_ID IN_LIST GNU_LIKE_FRONTENDS) # Set custom compiler flags for gcc-compatible compilers @@ -120,7 +122,8 @@ endfunction() # Utility function to set finufft compilation options. function(set_finufft_options target) set_property(TARGET ${target} PROPERTY POSITION_INDEPENDENT_CODE ON) - set_property(TARGET ${target} PROPERTY CMAKE_CXX_STANDARD 17) + target_compile_features(${target} PRIVATE cxx_std_17) + enable_asan(${target}) target_compile_options(${target} PRIVATE SHELL:$<$:${FINUFFT_ARCH_FLAGS}>) diff --git a/src/spreadinterp.cpp b/src/spreadinterp.cpp index 8629f1fda..51ca5e4c1 100644 --- a/src/spreadinterp.cpp +++ b/src/spreadinterp.cpp @@ -30,6 +30,9 @@ static constexpr auto BestSIMDHelper(); template static constexpr auto GetPaddedSIMDSize(); +template +using PaddedSIMD = typename xsimd::make_sized_batch()>::type; + template static uint16_t get_padding(uint16_t ns); @@ -43,7 +46,7 @@ template static constexpr uint16_t min_batch_size(); template(), uint16_t min_iterations = N, uint16_t optimal_batch_size = 1> -static constexpr auto find_optimal_batch_size(); +static constexpr uint16_t find_optimal_batch_size(); // declarations of purely internal functions... (thus need not be in .h) @@ -1046,7 +1049,7 @@ static void spread_subproblem_2d_kernel(const BIGINT off1, const BIGINT off2, co */ { static constexpr auto padding = get_padding(); - using batch_t = BestSIMD; + using batch_t = typename xsimd::make_sized_batch()>::type; using arch_t = typename batch_t::arch_type; static constexpr auto avx_size = batch_t::size; static constexpr size_t alignment = batch_t::arch_type::alignment(); @@ -1146,7 +1149,7 @@ static void spread_subproblem_3d_kernel(const BIGINT off1, const BIGINT off2, co const FLT *kx, const FLT *ky, const FLT *kz, const FLT *dd, const finufft_spread_opts &opts) noexcept { static constexpr auto padding = get_padding(); - using batch_t = BestSIMD; + using batch_t = PaddedSIMD; using arch_t = typename batch_t::arch_type; static constexpr auto avx_size = batch_t::size; static constexpr size_t alignment = batch_t::arch_type::alignment(); @@ -1560,7 +1563,7 @@ static constexpr uint16_t min_batch_size() { template -constexpr auto find_optimal_batch_size() { +constexpr uint16_t find_optimal_batch_size() { if constexpr (batch_size > xsimd::batch::size) { return optimal_batch_size; } else {