BlackCat_Tensors
A GPU-supported autograd and linear algebra library, designed for neural network construction
|
An unsynced memory pool implemented as a stack. More...
#include <stack_allocator.h>
Classes | |
struct | rebind |
Public Types | |
using | system_tag = SystemTag |
using | value_type = ValueType |
using | propagate_on_container_copy_construction = std::false_type |
Public Member Functions | |
Stack_Allocator (int sz=0) | |
template<class T > | |
Stack_Allocator (const Stack_Allocator< T, SystemTag > &ws) | |
Stack_Allocator (const Stack_Allocator &)=default | |
Stack_Allocator (Stack_Allocator &&)=default | |
void | reserve (std::size_t sz) |
Reserve an amount of memory in bytes. More... | |
void | free () |
Delete all reserved memory, if memory is currently allocated an error is thrown. More... | |
void | force_deallocate () |
size_t | available_bytes () const |
size_t | allocated_bytes () const |
size_t | reserved_bytes () const |
template<class Allocator > | |
void | set_allocator (Allocator alloc) |
ValueType * | allocate (std::size_t sz) |
void | deallocate (ValueType *data, std::size_t sz) |
Friends | |
template<class , class > | |
class | Stack_Allocator |
An unsynced memory pool implemented as a stack.
Deallocation must happen in reverse order of deallocation. This class is used with bc::Tensor_Base expressions to enable very fast allocations of temporaries.
using bc::allocators::Stack_Allocator< ValueType, SystemTag >::propagate_on_container_copy_construction = std::false_type |
using bc::allocators::Stack_Allocator< ValueType, SystemTag >::system_tag = SystemTag |
using bc::allocators::Stack_Allocator< ValueType, SystemTag >::value_type = ValueType |
|
inline |
|
inline |
|
default |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Delete all reserved memory, if memory is currently allocated an error is thrown.
|
inline |
Reserve an amount of memory in bytes.
|
inline |
|
inline |
|
friend |