cuda::experimental::stf::pooled_allocator#
-
class pooled_allocator : public cuda::experimental::stf::block_allocator_interface#
A pooled allocation strategy, where each memory node has a map, each map associates a size_t with a pool of blocks of this size.
This non static version uses different pools for the different instances of the allocator
Public Functions
- inline pooled_allocator(
- block_allocator_untyped root_allocator_,
- double max_ratio = 0.2,
-
inline pooled_allocator(double max_ratio = 0.2)#
-
inline pooled_allocator(pooled_allocator_config config)#
- inline virtual void *allocate(
- backend_ctx_untyped &ctx,
- const data_place &memory_node,
- ::std::ptrdiff_t &s,
- event_list &prereqs,
Asynchronous allocation of memory.
This method asynchronously allocates
*s
bytes on the specified memory node. Upon success,*ptr
will contain the address of the allocated buffer. If the allocation fails,*s
will contain a negative value.- Parameters:
ctx – Untyped backend context
memory_node – Memory node where the allocation should occur
s – Pointer to the size of the allocation
prereqs – List of events that should finish before the allocation starts
- Returns:
void* Pointer to the allocated memory
- inline virtual void deallocate(
- backend_ctx_untyped&,
- const data_place &memory_node,
- event_list &prereqs,
- void *ptr,
- size_t block_size,
Deallocation of memory.
This method deallocates memory previously allocated by the allocate method.
- Parameters:
ctx – Untyped backend context
memory_node – Memory node where the deallocation should occur
prereqs – List of events that should finish before the deallocation starts
ptr – Pointer to the memory to be deallocated
sz – Size of the memory to be deallocated
-
inline virtual event_list deinit(backend_ctx_untyped &ctx) override#
Deinitialization of the allocator.
- Returns:
List of events indicating that this was deinitialized
-
inline virtual ::std::string to_string() const override#
String representation of the allocator.
This method returns a string representation of the allocator.
- Returns:
std::string String representation of the allocator
-
inline virtual void print_info() const#
Print information about the allocator.
This method prints information about the allocator to stderr.