DASH
0.3.0
|
Encapsulates a memory allocation and deallocation strategy of global memory regions distributed across local memory of units in a specified team. More...
#include <EpochSynchronizedAllocator.h>
Public Types | |
using | local_allocator_type = LocalAlloc< ElementType > |
using | value_type = ElementType |
Allocator Traits. More... | |
using | size_type = dash::default_size_t |
using | difference_type = dash::default_index_t |
using | pointer = dart_gptr_t |
using | const_pointer = dart_gptr_t const |
using | void_pointer = dart_gptr_t |
using | const_void_pointer = dart_gptr_t const |
using | local_pointer = typename allocator_traits::pointer |
using | const_local_pointer = typename allocator_traits::const_pointer |
using | local_void_pointer = typename allocator_traits::void_pointer |
using | const_local_void_pointer = typename allocator_traits::const_void_pointer |
using | allocation_policy = std::integral_constant< global_allocation_policy, AllocationPolicy > |
template<class U > | |
using | rebind = dash::EpochSynchronizedAllocator< U, LMemSpace, AllocationPolicy, LocalAlloc > |
Convert EpochSynchronizedAllocator<T> to EpochSynchronizedAllocator<U>. More... | |
Public Member Functions | |
EpochSynchronizedAllocator (Team const &team, LMemSpace *r=nullptr) noexcept | |
Constructor. More... | |
EpochSynchronizedAllocator (const self_t &other) noexcept | |
Copy constructor. More... | |
self_t & | operator= (const self_t &other) noexcept |
Copy Assignment operator. More... | |
EpochSynchronizedAllocator (self_t &&other) noexcept | |
Move-constructor. More... | |
self_t & | operator= (self_t &&other) noexcept |
Move-assignment operator. More... | |
void | swap (self_t &other) noexcept |
Swap two collective Allocators. More... | |
~EpochSynchronizedAllocator () noexcept | |
Destructor. More... | |
size_type | max_size () const noexcept |
Estimate the largest supported size. More... | |
pointer | attach (local_pointer lptr, size_type num_local_elem) |
Register pre-allocated local memory segment of num_local_elem elements in global memory space. More... | |
void | detach (pointer gptr, size_type num_local_elem) |
Unregister local memory segment from global memory space. More... | |
local_pointer | allocate_local (size_type num_local_elem) |
Allocates num_local_elem local elements in the active unit's local memory. More... | |
void | deallocate_local (local_pointer lptr, size_type num_local_elem) |
Deallocates memory segment in the active unit's local memory. More... | |
pointer | allocate (size_type num_local_elem) |
Allocates a global memory segment with at least num_local_elem bytes. More... | |
void | deallocate (pointer gptr, size_type num_local_elem) |
Deallocates a memory segment from global memory space. More... | |
local_allocator_type | get_local_allocator () const noexcept |
Returns a copy of the local allocator object associated with the vector. More... | |
Friends | |
template<class T , class U > | |
bool | operator== (const EpochSynchronizedAllocator< T, LMemSpace, AllocationPolicy, LocalAlloc > &lhs, const EpochSynchronizedAllocator< U, LMemSpace, AllocationPolicy, LocalAlloc > &rhs) |
template<class T , class U > | |
bool | operator!= (const EpochSynchronizedAllocator< T, LMemSpace, AllocationPolicy, LocalAlloc > &lhs, const EpochSynchronizedAllocator< U, LMemSpace, AllocationPolicy, LocalAlloc > &rhs) |
Encapsulates a memory allocation and deallocation strategy of global memory regions distributed across local memory of units in a specified team.
Satisfied STL concepts:
CopyAssignable
Definition at line 45 of file EpochSynchronizedAllocator.h.
using dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::rebind = dash:: EpochSynchronizedAllocator<U, LMemSpace, AllocationPolicy, LocalAlloc> |
Convert EpochSynchronizedAllocator<T> to EpochSynchronizedAllocator<U>.
Definition at line 121 of file EpochSynchronizedAllocator.h.
using dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::value_type = ElementType |
Allocator Traits.
Definition at line 100 of file EpochSynchronizedAllocator.h.
|
explicitnoexcept |
Constructor.
Creates a new instance of dash::EpochSynchronizedAllocator
for a given team.
Definition at line 347 of file EpochSynchronizedAllocator.h.
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::get_local_allocator().
|
noexcept |
Copy constructor.
Definition at line 371 of file EpochSynchronizedAllocator.h.
References dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::operator=().
|
noexcept |
Move-constructor.
Takes ownership of the moved instance's allocation.
Definition at line 385 of file EpochSynchronizedAllocator.h.
|
noexcept |
Destructor.
Frees all global memory regions allocated by this allocator instance.
Definition at line 465 of file EpochSynchronizedAllocator.h.
EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::pointer dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::allocate | ( | size_type | num_local_elem | ) |
Allocates a global memory segment with at least num_local_elem bytes.
It is semantically identical to call allocate_local (obtaining a local pointer) and subsequently attaching it to obtain a global pointer. it. Collective operation.
Definition at line 693 of file EpochSynchronizedAllocator.h.
References DART_GPTR_ISNULL.
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::max_size().
EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::local_pointer dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::allocate_local | ( | size_type | num_local_elem | ) |
Allocates num_local_elem
local elements in the active unit's local memory.
Local operation.
Definition at line 501 of file EpochSynchronizedAllocator.h.
References dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::deallocate_local().
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::max_size().
EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::pointer dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::attach | ( | local_pointer | lptr, |
size_type | num_local_elem | ||
) |
Register pre-allocated local memory segment of num_local_elem
elements in global memory space.
Collective operation. The number of allocated elements may differ between units.
Definition at line 573 of file EpochSynchronizedAllocator.h.
References DART_GPTR_ISNULL, DART_GPTR_NULL, and dash::end().
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::max_size().
void dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::deallocate | ( | pointer | gptr, |
size_type | num_local_elem | ||
) |
Deallocates a memory segment from global memory space.
It is semantically identical to first call detach on the specified global pointer and subsequently locally deallocate it.
Collective operation.
Definition at line 648 of file EpochSynchronizedAllocator.h.
References dash::begin(), DART_GPTR_EQUAL, DART_GPTR_ISNULL, dash::end(), and dash::find_if().
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::get_local_allocator(), and dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::max_size().
void dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::deallocate_local | ( | local_pointer | lptr, |
size_type | num_local_elem | ||
) |
Deallocates memory segment in the active unit's local memory.
Local operation.
Definition at line 525 of file EpochSynchronizedAllocator.h.
References DART_GPTR_ISNULL, and dash::end().
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::allocate_local(), and dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::max_size().
void dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::detach | ( | pointer | gptr, |
size_type | num_local_elem | ||
) |
Unregister local memory segment from global memory space.
Does not deallocate local memory.
Collective operation.
Definition at line 611 of file EpochSynchronizedAllocator.h.
References DART_GPTR_ISNULL, DART_GPTR_NULL, and dash::end().
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::max_size().
|
inlinenoexcept |
Returns a copy of the local allocator object associated with the vector.
Definition at line 239 of file EpochSynchronizedAllocator.h.
References dash::begin(), DART_GPTR_EQUAL, DART_GPTR_NULL, dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::deallocate(), dash::end(), dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::EpochSynchronizedAllocator(), and dash::find_if().
|
inlinenoexcept |
Estimate the largest supported size.
Definition at line 171 of file EpochSynchronizedAllocator.h.
References dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::allocate(), dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::allocate_local(), dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::attach(), dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::deallocate(), dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::deallocate_local(), and dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::detach().
|
noexcept |
Copy Assignment operator.
Definition at line 408 of file EpochSynchronizedAllocator.h.
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::EpochSynchronizedAllocator(), and dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::operator=().
|
noexcept |
Move-assignment operator.
Definition at line 437 of file EpochSynchronizedAllocator.h.
References dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::operator=(), and dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::swap().
|
noexcept |
Swap two collective Allocators.
Definition at line 479 of file EpochSynchronizedAllocator.h.
Referenced by dash::EpochSynchronizedAllocator< ElementType, LMemSpace, AllocationPolicy, LocalAlloc >::operator=().