From 099f6db293efac39487adbb0620ad252ffb1b31b Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Fri, 7 Mar 2025 18:24:00 +0100 Subject: [PATCH] Ensure the alignment is not too big (#797) --- include/ddc/kokkos_allocator.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/ddc/kokkos_allocator.hpp b/include/ddc/kokkos_allocator.hpp index f58b334b4..cd6701c9a 100644 --- a/include/ddc/kokkos_allocator.hpp +++ b/include/ddc/kokkos_allocator.hpp @@ -15,6 +15,12 @@ namespace ddc { template class KokkosAllocator { + // Kokkos natively supports alignment for any scalar type that can be represented by the type `std::max_align_t` + static_assert( + alignof(T) + <= std::max(alignof(std::max_align_t), alignof(Kokkos::complex)), + "Alignment not supported"); + public: using value_type = T;