17 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
18 #include <Kokkos_Macros.hpp>
20 "Including non-public Kokkos header files is not allowed.");
22 #ifndef KOKKOS_MEMORYTRAITS_HPP
23 #define KOKKOS_MEMORYTRAITS_HPP
25 #include <impl/Kokkos_Traits.hpp>
39 enum MemoryTraitsFlags {
50 using memory_traits = MemoryTraits<T>;
52 static constexpr
unsigned impl_value = T;
54 static constexpr
bool is_unmanaged =
55 (unsigned(0) != (T & unsigned(Kokkos::Unmanaged)));
56 static constexpr
bool is_random_access =
57 (unsigned(0) != (T & unsigned(Kokkos::RandomAccess)));
58 static constexpr
bool is_atomic =
59 (unsigned(0) != (T & unsigned(Kokkos::Atomic)));
60 static constexpr
bool is_restrict =
61 (unsigned(0) != (T & unsigned(Kokkos::Restrict)));
62 static constexpr
bool is_aligned =
63 (unsigned(0) != (T & unsigned(Kokkos::Aligned)));
72 using MemoryManaged = Kokkos::MemoryTraits<0>;
73 using MemoryUnmanaged = Kokkos::MemoryTraits<Kokkos::Unmanaged>;
74 using MemoryRandomAccess =
75 Kokkos::MemoryTraits<Kokkos::Unmanaged | Kokkos::RandomAccess>;
84 static_assert((0 <
int(KOKKOS_MEMORY_ALIGNMENT)) &&
85 (0 == (
int(KOKKOS_MEMORY_ALIGNMENT) &
86 (
int(KOKKOS_MEMORY_ALIGNMENT) - 1))),
87 "KOKKOS_MEMORY_ALIGNMENT must be a power of two");
96 MEMORY_ALIGNMENT = KOKKOS_MEMORY_ALIGNMENT,
97 MEMORY_ALIGNMENT_THRESHOLD = KOKKOS_MEMORY_ALIGNMENT_THRESHOLD
103 template <
typename Tp>
104 struct is_default_memory_trait : std::false_type {};
107 struct is_default_memory_trait<Kokkos::MemoryTraits<0>> : std::true_type {};