Skip to content

Commit

Permalink
forced c++17
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Barbone committed May 29, 2024
1 parent 6e834c8 commit 7dc95dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:$<$<CONFIG:Release,RelWithDebInfo>:${FINUFFT_ARCH_FLAGS}>)
Expand Down
11 changes: 7 additions & 4 deletions src/spreadinterp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ static constexpr auto BestSIMDHelper();
template<class T, uint16_t N>
static constexpr auto GetPaddedSIMDSize();

template<class T, uint16_t N>
using PaddedSIMD = typename xsimd::make_sized_batch<T, GetPaddedSIMDSize<T, N>()>::type;

template<class T>
static uint16_t get_padding(uint16_t ns);

Expand All @@ -43,7 +46,7 @@ template<class T, uint16_t N = 1>
static constexpr uint16_t min_batch_size();

template<class T, uint16_t N, uint16_t batch_size = min_batch_size<T>(), 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)
Expand Down Expand Up @@ -1046,7 +1049,7 @@ static void spread_subproblem_2d_kernel(const BIGINT off1, const BIGINT off2, co
*/
{
static constexpr auto padding = get_padding<FLT, 2 * ns>();
using batch_t = BestSIMD<FLT, 2 * ns + padding>;
using batch_t = typename xsimd::make_sized_batch<FLT, GetPaddedSIMDSize<FLT, 2 * ns>()>::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();
Expand Down Expand Up @@ -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<FLT, 2 * ns>();
using batch_t = BestSIMD<FLT, 2 * ns + padding>;
using batch_t = PaddedSIMD<FLT, 2 * ns>;
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();
Expand Down Expand Up @@ -1560,7 +1563,7 @@ static constexpr uint16_t min_batch_size() {


template<class T, uint16_t N, uint16_t batch_size, uint16_t min_iterations, uint16_t optimal_batch_size>
constexpr auto find_optimal_batch_size() {
constexpr uint16_t find_optimal_batch_size() {
if constexpr (batch_size > xsimd::batch<T>::size) {
return optimal_batch_size;
} else {
Expand Down

0 comments on commit 7dc95dc

Please sign in to comment.