44 #ifndef KOKKOS_SCRATCHSPACE_HPP 45 #define KOKKOS_SCRATCHSPACE_HPP 48 #include <Kokkos_Core_fwd.hpp> 49 #include <impl/Kokkos_Tags.hpp> 58 template<
class ExecSpace >
68 mutable char * m_iter ;
74 enum { MASK = ALIGN - 1 };
80 typedef ExecSpace execution_space ;
84 typedef typename ExecSpace::array_layout array_layout ;
85 typedef typename ExecSpace::size_type size_type ;
87 template<
typename IntType >
88 KOKKOS_INLINE_FUNCTION
static 89 IntType align(
const IntType & size )
90 {
return ( size + MASK ) & ~MASK ; }
92 template<
typename IntType >
93 KOKKOS_INLINE_FUNCTION
94 void* get_shmem (
const IntType& size)
const {
96 if (m_end < (m_iter += align (size))) {
97 m_iter -= align (size);
98 #ifdef KOKKOS_HAVE_DEBUG 102 printf (
"ScratchMemorySpace<...>::get_shmem: Failed to allocate " 103 "%ld byte(s); remaining capacity is %ld byte(s)\n",
long(size),
105 #endif // KOKKOS_HAVE_DEBUG 111 template<
typename IntType >
112 KOKKOS_INLINE_FUNCTION
114 : m_iter( (
char *) ptr )
115 , m_end( m_iter + size )
Scratch memory space associated with an execution space.
Memory space for main process and CPU execution spaces.
ScratchMemorySpace memory_space
Tag this class as a memory space.
Kokkos::Device< execution_space, memory_space > device_type
This execution space preferred device_type.