From 2f94392419f11e3e2d5ae27c95ababe4ceb4a0b8 Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Thu, 6 Aug 2020 11:59:07 +0200 Subject: [PATCH 1/2] slightly more portable syntax --- src/ducc0/infra/error_handling.h | 2 +- src/ducc0/infra/useful_macros.h | 5 +---- src/ducc0/math/fft.h | 6 +++--- src/ducc0/math/fft1d.h | 8 ++++---- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/ducc0/infra/error_handling.h b/src/ducc0/infra/error_handling.h index ee52d18..f87168a 100644 --- a/src/ducc0/infra/error_handling.h +++ b/src/ducc0/infra/error_handling.h @@ -78,7 +78,7 @@ void streamDump__(::std::ostream &os, const T& value, } #endif template -[[noreturn]] void DUCC0_NOINLINE fail__(Args&&... args) +[[noreturn]] DUCC0_NOINLINE void fail__(Args&&... args) { ::std::ostringstream msg; \ ::ducc0::detail_error_handling::streamDump__(msg, args...); \ diff --git a/src/ducc0/infra/useful_macros.h b/src/ducc0/infra/useful_macros.h index 58acc11..2de3999 100644 --- a/src/ducc0/infra/useful_macros.h +++ b/src/ducc0/infra/useful_macros.h @@ -2,21 +2,18 @@ #define DUCC0_USEFUL_MACROS_H #if defined(__GNUC__) -#define DUCC0_NOINLINE __attribute__((noinline)) +#define DUCC0_NOINLINE [[gnu::noinline]] #define DUCC0_RESTRICT __restrict__ -#define DUCC0_ALIGNED(align) __attribute__ ((aligned(align))) #define DUCC0_PREFETCH_R(addr) __builtin_prefetch(addr); #define DUCC0_PREFETCH_W(addr) __builtin_prefetch(addr,1); #elif defined(_MSC_VER) #define DUCC0_NOINLINE __declspec(noinline) #define DUCC0_RESTRICT __restrict -#define DUCC0_ALIGNED(align) #define DUCC0_PREFETCH_R(addr) #define DUCC0_PREFETCH_W(addr) #else #define DUCC0_NOINLINE #define DUCC0_RESTRICT -#define DUCC0_ALIGNED(align) #define DUCC0_PREFETCH_R(addr) #define DUCC0_PREFETCH_W(addr) #endif diff --git a/src/ducc0/math/fft.h b/src/ducc0/math/fft.h index 18b6337..253d1e4 100644 --- a/src/ducc0/math/fft.h +++ b/src/ducc0/math/fft.h @@ -79,14 +79,14 @@ struct util // hack to avoid duplicate symbols } } - static DUCC0_NOINLINE void sanity_check_onetype(const fmav_info &a1, + DUCC0_NOINLINE static void sanity_check_onetype(const fmav_info &a1, const fmav_info &a2, bool inplace, const shape_t &axes) { sanity_check_axes(a1.ndim(), axes); MR_assert(a1.conformable(a2), "array sizes are not conformable"); if (inplace) MR_assert(a1.stride()==a2.stride(), "stride mismatch"); } - static DUCC0_NOINLINE void sanity_check_cr(const fmav_info &ac, + DUCC0_NOINLINE static void sanity_check_cr(const fmav_info &ac, const fmav_info &ar, const shape_t &axes) { sanity_check_axes(ac.ndim(), axes); @@ -95,7 +95,7 @@ struct util // hack to avoid duplicate symbols MR_assert(ac.shape(i)== (i==axes.back()) ? (ar.shape(i)/2+1) : ar.shape(i), "axis length mismatch"); } - static DUCC0_NOINLINE void sanity_check_cr(const fmav_info &ac, + DUCC0_NOINLINE static void sanity_check_cr(const fmav_info &ac, const fmav_info &ar, const size_t axis) { if (axis>=ac.ndim()) throw std::invalid_argument("bad axis number"); diff --git a/src/ducc0/math/fft1d.h b/src/ducc0/math/fft1d.h index ba1ebfa..e52558b 100644 --- a/src/ducc0/math/fft1d.h +++ b/src/ducc0/math/fft1d.h @@ -74,7 +74,7 @@ template void ROTX90(Cmplx &a) struct util1d // hack to avoid duplicate symbols { - static DUCC0_NOINLINE size_t largest_prime_factor (size_t n) + DUCC0_NOINLINE static size_t largest_prime_factor (size_t n) { size_t res=1; while ((n&1)==0) @@ -86,7 +86,7 @@ struct util1d // hack to avoid duplicate symbols return res; } - static DUCC0_NOINLINE double cost_guess (size_t n) + DUCC0_NOINLINE static double cost_guess (size_t n) { constexpr double lfp=1.1; // penalty for non-hardcoded larger factors size_t ni=n; @@ -104,7 +104,7 @@ struct util1d // hack to avoid duplicate symbols } /* returns the smallest composite of 2, 3, 5, 7 and 11 which is >= n */ - static DUCC0_NOINLINE size_t good_size_cmplx(size_t n) + DUCC0_NOINLINE static size_t good_size_cmplx(size_t n) { if (n<=12) return n; @@ -133,7 +133,7 @@ struct util1d // hack to avoid duplicate symbols } /* returns the smallest composite of 2, 3, 5 which is >= n */ - static DUCC0_NOINLINE size_t good_size_real(size_t n) + DUCC0_NOINLINE static size_t good_size_real(size_t n) { if (n<=6) return n; -- GitLab From 43e580e6150bb43e1aee1cf8eb3107896dc06735 Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Thu, 6 Aug 2020 12:07:00 +0200 Subject: [PATCH 2/2] try to fix an issue with ducc not compiling on very new Apple hardware --- src/ducc0/sharp/sharp_core_inc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ducc0/sharp/sharp_core_inc.cc b/src/ducc0/sharp/sharp_core_inc.cc index c165fca..f408a53 100644 --- a/src/ducc0/sharp/sharp_core_inc.cc +++ b/src/ducc0/sharp/sharp_core_inc.cc @@ -26,7 +26,7 @@ */ // FIXME: special ugly workaround for problems on OSX -#if (!defined(__APPLE__)) || (!defined(__AVX512F__)) +#if (defined(GENERIC_ARCH) || (!defined(__APPLE__)) || (!defined(__AVX512F__))) #if (defined(MULTIARCH) || defined(GENERIC_ARCH)) -- GitLab