DASH
0.3.0
|
Global memory region with dynamic size. More...
#include <GlobHeapMem.h>
Public Types | |
using | value_type = typename allocator_traits::value_type |
using | allocator_type = typename allocator_traits::allocator_type |
using | local_memory_space = typename memory_traits::memory_space_type |
typedef allocator_type::size_type | size_type |
typedef allocator_type::difference_type | difference_type |
typedef allocator_type::difference_type | index_type |
typedef allocator_type::pointer | raw_pointer |
typedef GlobHeapLocalPtr< value_type, index_type > | local_pointer |
typedef GlobHeapLocalPtr< value_type, index_type > | const_local_pointer |
typedef GlobHeapPtr< value_type, GlobHeapMem > | pointer |
typedef GlobHeapPtr< const value_type, GlobHeapMem > | const_pointer |
typedef value_type & | local_reference |
typedef const value_type & | const_local_reference |
typedef local_pointer::bucket_type | bucket_type |
template<typename U > | |
using | rebind = GlobHeapMem< U, LocalMemorySpace, AllocationPolicy, LocalAlloc > |
using | local_void_pointer = void * |
Public Member Functions | |
GlobHeapMem (size_type n_local_elem=0) | |
Constructor, collectively allocates the given number of elements in local memory of every unit in dash::Team::All(). More... | |
GlobHeapMem (size_type n_local_elem, dash::Team &team) | |
Constructor, collectively allocates the given number of elements in local memory of every unit in a team. More... | |
GlobHeapMem (size_type n_local_elem, LocalMemorySpace *r) | |
Constructor, collectively allocates the given number of elements in local memory of every unit in dash::Team::All(). More... | |
GlobHeapMem (size_type n_local_elem, LocalMemorySpace *r, Team &team) | |
~GlobHeapMem () | |
Destructor, collectively frees underlying global memory. More... | |
GlobHeapMem (const self_t &other)=default | |
Copy constructor. More... | |
self_t & | operator= (const self_t &rhs)=default |
Assignment operator. More... | |
constexpr bool | operator== (const self_t &rhs) const noexcept |
Equality comparison operator. More... | |
constexpr bool | operator!= (const self_t &rhs) const noexcept |
Inequality comparison operator. More... | |
constexpr size_type | size () const noexcept |
Total number of elements in attached memory space, including size of local unattached memory segments. More... | |
constexpr size_type | local_size () const noexcept |
Number of elements in local memory space. More... | |
size_type | local_size (team_unit_t unit) const |
Number of elements in local memory space of given unit. More... | |
constexpr dash::Team & | team () const noexcept |
The team containing all units accessing the global memory space. More... | |
local_pointer | grow (size_type num_elements) |
Increase capacity of local segment of global memory region by the given number of elements. More... | |
void | shrink (size_type num_elements) |
Decrease capacity of local segment of global memory region by the given number of elements. More... | |
void | commit () |
Commit changes of local memory region to global memory space. More... | |
void | resize (size_type num_elements) |
Resize capacity of local segment of global memory region to the given number of elements. More... | |
pointer | begin () noexcept |
Global pointer of the initial address of the global memory. More... | |
constexpr const_pointer | begin () const noexcept |
Global pointer of the initial address of the global memory. More... | |
pointer | end () noexcept |
Global pointer of the initial address of the global memory. More... | |
const_pointer | end () const noexcept |
Global pointer of the initial address of the global memory. More... | |
local_pointer & | lbegin () noexcept |
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapMem instance. More... | |
const_local_pointer | lbegin () const noexcept |
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapMem instance. More... | |
local_pointer & | lend () noexcept |
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapMem instance. More... | |
const_local_pointer & | lend () const noexcept |
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapMem instance. More... | |
template<typename ValueType = value_type> | |
void | put_value (const ValueType &newval, index_type global_index) |
Write value to global memory at given offset. More... | |
template<typename ValueType = value_type> | |
void | get_value (ValueType *ptr, index_type global_index) const |
Read value from global memory at given offset. More... | |
void | barrier () const |
Synchronize all units associated with this global memory instance. More... | |
template<typename IndexT > | |
pointer | at (team_unit_t unit, IndexT local_index) |
Resolve the global iterator referencing an element position in a unit's local memory. More... | |
template<typename IndexT > | |
const_pointer | at (team_unit_t unit, IndexT local_index) const |
Resolve the global iterator referencing an element position in a unit's local memory. More... | |
const bucket_list & | local_buckets () const |
Global memory region with dynamic size.
For global memory spaces with static size, see dash::GlobStaticMem
.
Conventional global memory (see dash::GlobStaticMem
) allocates a single contiguous range of fixed size in local memory at every unit. Iterating static memory space is trivial as native pointer arithmetics can be used to traverse elements in canonical storage order.
In global dynamic memory, units allocate multiple heap-allocated buckets in local memory. The number of local buckets and their sizes may differ between units. In effect, elements in local memory are distributed in non-contiguous address ranges and a custom iterator is used to access elements in logical storage order.
Usage examples:
Definition at line 204 of file GlobHeapMem.h.
|
inline |
Destructor, collectively frees underlying global memory.
Definition at line 380 of file GlobHeapMem.h.
References dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::operator=().
|
default |
Copy constructor.
|
inline |
Resolve the global iterator referencing an element position in a unit's local memory.
unit | The unit id |
local_index | The unit's local address offset |
Definition at line 913 of file GlobHeapMem.h.
Referenced by dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::dart_gptr().
|
inline |
Resolve the global iterator referencing an element position in a unit's local memory.
unit | The unit id |
local_index | The unit's local address offset |
Definition at line 934 of file GlobHeapMem.h.
|
inline |
Synchronize all units associated with this global memory instance.
Does not commit changes of local memory space.
Definition at line 901 of file GlobHeapMem.h.
References dart_barrier(), and DART_OK.
|
inlinenoexcept |
Global pointer of the initial address of the global memory.
Definition at line 798 of file GlobHeapMem.h.
|
inlinenoexcept |
Global pointer of the initial address of the global memory.
Definition at line 806 of file GlobHeapMem.h.
|
inline |
Commit changes of local memory region to global memory space.
Applies calls of grow()
, shrink()
and resize()
to global memory.
Collective operation.
Attaches local memory allocated since the last call of commit()
to global memory space and thus makes it accessible to other units. Frees local memory marked for deallocation and detaches it from global memory.
Definition at line 739 of file GlobHeapMem.h.
References dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::size().
Referenced by dash::List< ElementType, LocalMemorySpace >::barrier(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::GlobHeapMem().
|
inlinenoexcept |
Global pointer of the initial address of the global memory.
Definition at line 814 of file GlobHeapMem.h.
|
inlinenoexcept |
Global pointer of the initial address of the global memory.
Definition at line 822 of file GlobHeapMem.h.
|
inline |
Read value from global memory at given offset.
Definition at line 885 of file GlobHeapMem.h.
References dash::get_value().
|
inline |
Increase capacity of local segment of global memory region by the given number of elements.
Same as resize
(size() + num_elements).
Local operation. Newly allocated memory is attached to global memory space by calling the collective operation attach()
.
Definition at line 485 of file GlobHeapMem.h.
References DART_GPTR_NULL, and dash::Array< ElementType, IndexType, PatternType, LocalMemSpaceT >::local.
Referenced by dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::GlobHeapMem(), dash::LocalListRef< ElementType, LocalMemorySpace >::push_back(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::resize().
|
inlinenoexcept |
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapMem instance.
Definition at line 831 of file GlobHeapMem.h.
Referenced by dash::List< ElementType, LocalMemorySpace >::allocate(), dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator pointer(), dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator*(), and dash::LocalListRef< ElementType, LocalMemorySpace >::push_back().
|
inlinenoexcept |
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapMem instance.
Definition at line 840 of file GlobHeapMem.h.
|
inlinenoexcept |
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapMem instance.
Definition at line 849 of file GlobHeapMem.h.
|
inlinenoexcept |
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapMem instance.
Definition at line 858 of file GlobHeapMem.h.
|
inlinenoexcept |
Number of elements in local memory space.
Definition at line 430 of file GlobHeapMem.h.
References dash::Array< ElementType, IndexType, PatternType, LocalMemSpaceT >::local.
Referenced by dash::List< ElementType, LocalMemorySpace >::lcapacity(), dash::LocalListRef< ElementType, LocalMemorySpace >::push_back(), dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::shrink(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::size().
|
inline |
Number of elements in local memory space of given unit.
Definition at line 441 of file GlobHeapMem.h.
|
inlinenoexcept |
Inequality comparison operator.
Definition at line 413 of file GlobHeapMem.h.
|
default |
Assignment operator.
Referenced by dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::~GlobHeapMem().
|
inlinenoexcept |
Equality comparison operator.
Definition at line 400 of file GlobHeapMem.h.
|
inline |
Write value to global memory at given offset.
Definition at line 869 of file GlobHeapMem.h.
References dash::put_value().
|
inline |
Resize capacity of local segment of global memory region to the given number of elements.
Local operation.
If capacity is increased, newly allocated memory is only attached to global memory space and thus made accessible to other units by calling the collective operation commit()
. If capacity is decreased, resizes logical local memory space but does not deallocate memory. Local memory is accessible by other units until deallocated and detached from global memory space by calling the collective operation commit()
.
Definition at line 783 of file GlobHeapMem.h.
References dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::grow(), dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::shrink(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::size().
|
inline |
Decrease capacity of local segment of global memory region by the given number of elements.
Buckets are not deallocated until next commit as other units might still reference them. Same as resize
(size() - num_elements).
Local operation.
Resizes logical local memory space but does not deallocate memory. Local memory is accessible by other units until deallocated and detached from global memory space by calling the collective operation commit()
.
Definition at line 553 of file GlobHeapMem.h.
References dash::distance(), dash::Array< ElementType, IndexType, PatternType, LocalMemSpaceT >::local, dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::local_size(), and dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::size().
Referenced by dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::resize().
|
inlinenoexcept |
Total number of elements in attached memory space, including size of local unattached memory segments.
Definition at line 422 of file GlobHeapMem.h.
References dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::local_size().
Referenced by dash::List< ElementType, LocalMemorySpace >::capacity(), dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::commit(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::resize().
|
inlinenoexcept |
The team containing all units accessing the global memory space.
Definition at line 465 of file GlobHeapMem.h.
References dash::Team::Null().
Referenced by dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::GlobHeapMem().