KOKKOS_INLINE_FUNCTION void operator()( TagMixItUp , int i , long & update ) const noexcept { if ( ptrs(i) && ( 0 == i % 3 ) ) { unsigned alloc_size = 32 * ( 1 + ( i % 5 )); pool.deallocate( (void*) ptrs(i) , alloc_size ); ptrs(i) = (uintptr_t) pool.allocate( alloc_size ); if ( ptrs(i) ) { ++update ; } } }
KOKKOS_INLINE_FUNCTION void operator()( TagAlloc , int i , long & update ) const noexcept { unsigned alloc_size = 32 * ( 1 + ( i % 5 )); ptrs(i) = (uintptr_t) pool.allocate( alloc_size ); if ( ptrs(i) ) { ++update ; } }
KOKKOS_INLINE_FUNCTION void operator()( TagDealloc , int i , long & update ) const noexcept { if ( ptrs(i) && ( 0 == i % 3 ) ) { unsigned alloc_size = 32 * ( 1 + ( i % 5 )); pool.deallocate( (void*) ptrs(i) , alloc_size ); ptrs(i) = 0 ; ++update ; } }
static boost::intrusive_ptr<thread_data> create( thread_init_data& init_data, pool_type& pool, thread_state_enum newstate) { thread_data* ret = pool.allocate(); if (ret == 0) { HPX_THROW_EXCEPTION(out_of_memory, "thread_data::operator new", "could not allocate memory for thread_data"); } #ifdef HPX_DEBUG_THREAD_POOL using namespace std; // some systems have memset in namespace std memset (ret, initial_value, sizeof(thread_data)); #endif return new (ret) thread_data(init_data, pool, newstate); }