DASH  0.3.0
dash::GlobAsyncIter< ElementType, PatternType > Class Template Reference

Public Types

using iterator_category = std::random_access_iterator_tag
 Iterator Traits. More...
 
using value_type = ElementType
 
using difference_type = typename PatternType::index_type
 
using size_type = typename PatternType::size_type
 
using pointer = GlobAsyncRef< ElementType >
 
using reference = GlobRef< ElementType >
 
typedef GlobRef< ElementType > ::const_type const_reference
 
typedef GlobAsyncRef< ElementType > ::const_type const_pointer
 
typedef pointer::local_type local_type
 
typedef pointer::const_local_type const_local_type
 
typedef PatternType pattern_type
 
typedef std::make_signed< typename PatternType::index_type >::type index_type
 
typedef std::integral_constant< bool, false > has_view
 

Public Member Functions

 GlobAsyncIter ()
 Default constructor. More...
 
 GlobAsyncIter (const self_t &other)=default
 
GlobAsyncIter< ElementType, PatternType > & operator= (const self_t &other)=default
 
void wait ()
 Wait for completion of non-blocking read- and write operations that have been executed on this global iterator since the last call of wait. More...
 
void get ()
 Wait for local completion of non-blocking read operations that have been executed on this global iterator since the last call of wait. More...
 
void push ()
 Block until all non-blocking write operations that have been executed on this global iterator since the last call of wait have been published. More...
 
DASH_CONSTEXPR operator const_pointer () const noexcept
 <fuchsto> TODO: Conversion from iterator to pointer looks dubios More...
 
DASH_CONSTEXPR operator pointer () DASH_NOEXCEPT
 <fuchsto> TODO: Conversion from iterator to pointer looks dubios More...
 
DASH_CONSTEXPR dart_gptr_t dart_gptr () const DASH_NOEXCEPT
 Explicit conversion to dart_gptr_t. More...
 
DASH_CONSTEXPR reference operator* () noexcept
 Dereference operator. More...
 
DASH_CONSTEXPR const_reference operator* () const noexcept
 Dereference operator. More...
 
DASH_CONSTEXPR reference operator[] (index_type g_index) noexcept
 Subscript operator, returns global reference to element at given global index. More...
 
DASH_CONSTEXPR const_reference operator[] (index_type g_index) const noexcept
 Subscript operator, returns global reference to element at given global index. More...
 
DASH_CONSTEXPR bool is_local () const noexcept
 Checks whether the element referenced by this global iterator is in the calling unit's local memory. More...
 
DASH_CONSTEXPR local_type local () const
 Convert global iterator to native pointer. More...
 
DASH_CONSTEXPR auto lpos () const
 Unit and local offset at the iterator's position. More...
 
DASH_CONSTEXPR const self_tglobal () const DASH_NOEXCEPT
 Map iterator to global index domain. More...
 
DASH_CONSTEXPR index_type pos () const DASH_NOEXCEPT
 Position of the iterator in global index space. More...
 
DASH_CONSTEXPR index_type gpos () const DASH_NOEXCEPT
 Position of the iterator in global index range. More...
 
DASH_CONSTEXPR const GlobAsyncPtr< ElementType, PatternType > & globmem () const DASH_NOEXCEPT
 The instance of GlobStaticMem used by this iterator to resolve addresses in global memory. More...
 
GlobAsyncPtr< ElementType, PatternType > & globmem ()
 The instance of GlobStaticMem used by this iterator to resolve addresses in global memory. More...
 
DASH_CONSTEXPR self_toperator++ () DASH_NOEXCEPT
 Prefix increment operator. More...
 
DASH_CONSTEXPR self_t operator++ (int) DASH_NOEXCEPT
 Postfix increment operator. More...
 
DASH_CONSTEXPR self_toperator-- () DASH_NOEXCEPT
 Prefix decrement operator. More...
 
DASH_CONSTEXPR self_t operator-- (int) DASH_NOEXCEPT
 Postfix decrement operator. More...
 
DASH_CONSTEXPR self_toperator+= (index_type n) DASH_NOEXCEPT
 
DASH_CONSTEXPR self_toperator-= (index_type n) DASH_NOEXCEPT
 
DASH_CONSTEXPR self_t operator+ (index_type n) const DASH_NOEXCEPT
 
DASH_CONSTEXPR self_t operator- (index_type n) const DASH_NOEXCEPT
 
DASH_CONSTEXPR bool operator< (const GlobIterT &other) const DASH_NOEXCEPT
 
DASH_CONSTEXPR bool operator<= (const GlobIterT &other) const DASH_NOEXCEPT
 
DASH_CONSTEXPR bool operator> (const GlobIterT &other) const DASH_NOEXCEPT
 
DASH_CONSTEXPR bool operator>= (const GlobIterT &other) const DASH_NOEXCEPT
 
DASH_CONSTEXPR bool operator== (const GlobIterT &other) const DASH_NOEXCEPT
 
DASH_CONSTEXPR bool operator!= (const GlobIterT &other) const DASH_NOEXCEPT
 
DASH_CONSTEXPR const PatternType & pattern () const DASH_NOEXCEPT
 
DASH_CONSTEXPR dash::Teamteam () const DASH_NOEXCEPT
 

Static Public Member Functions

static constexpr dim_t ndim ()
 The number of dimensions of the iterator's underlying pattern. More...
 

Detailed Description

template<typename ElementType, class PatternType = Pattern<1>>
class dash::GlobAsyncIter< ElementType, PatternType >

Definition at line 19 of file GlobAsyncIter.h.

Member Typedef Documentation

◆ iterator_category

using dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::iterator_category = std::random_access_iterator_tag
inherited

Iterator Traits.

Definition at line 48 of file GlobIter.h.

Constructor & Destructor Documentation

◆ GlobAsyncIter()

template<typename ElementType , class PatternType = Pattern<1>>
dash::GlobAsyncIter< ElementType, PatternType >::GlobAsyncIter ( )
inline

Default constructor.

Definition at line 36 of file GlobAsyncIter.h.

37  : GlobIter() {
38  DASH_LOG_TRACE_VAR("GlobAsyncIter()", this->_idx);
39  }

Member Function Documentation

◆ dart_gptr()

DASH_CONSTEXPR dart_gptr_t dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::dart_gptr ( ) const
inlineinherited

Explicit conversion to dart_gptr_t.

Returns
A DART global pointer to the element at the iterator's position

Definition at line 193 of file GlobIter.h.

Referenced by dash::GlobAsyncIter< ElementType, PatternType >::get(), dash::GlobAsyncIter< ElementType, PatternType >::push(), and dash::GlobAsyncIter< ElementType, PatternType >::wait().

194  {
195  if (_globmem == nullptr) {
196  return DART_GPTR_NULL;
197  }
198  else if (_idx > _max_idx) {
199  // Global iterator pointing past the range indexed by the pattern
200  // which is the case for .end() iterators.
201  return static_cast<dart_gptr_t>(_globmem->end());
202  }
203 
204  DASH_LOG_TRACE_VAR("GlobIter.dart_gptr()", _idx);
205  typedef typename pattern_type::local_index_t local_pos_t;
206 
207  // Global index to local index and unit:
208  local_pos_t local_pos = _pattern->local(_idx);
209  DASH_LOG_TRACE(
210  "GlobIter.dart_gptr",
211  "unit:",
212  local_pos.unit,
213  "local index:",
214  local_pos.index);
215  auto const dart_pointer = _get_pointer_at(local_pos);
216  DASH_ASSERT_MSG(
217  !DART_GPTR_ISNULL(dart_pointer), "dart pointer must not be null");
218  return dart_pointer;
219  }
#define DART_GPTR_NULL
A NULL global pointer.
Definition: dart_globmem.h:105
DART Global pointer type.
Definition: dart_globmem.h:77
#define DART_GPTR_ISNULL(gptr_)
Test for NULL global pointer.
Definition: dart_globmem.h:118

◆ get()

template<typename ElementType , class PatternType = Pattern<1>>
void dash::GlobAsyncIter< ElementType, PatternType >::get ( )
inline

Wait for local completion of non-blocking read operations that have been executed on this global iterator since the last call of wait.

Definition at line 60 of file GlobAsyncIter.h.

References dart_flush_all(), and dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType >, GlobAsyncRef< ElementType > >::dart_gptr().

61  {
62  dart_flush_all(this->dart_gptr());
63  }
DASH_CONSTEXPR dart_gptr_t dart_gptr() const DASH_NOEXCEPT
Explicit conversion to dart_gptr_t.
Definition: GlobIter.h:193
dart_ret_t dart_flush_all(dart_gptr_t gptr)
Guarantee completion of all outstanding operations involving a segment on all units.

◆ global()

DASH_CONSTEXPR const self_t& dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::global ( ) const
inlineinherited

Map iterator to global index domain.

Definition at line 328 of file GlobIter.h.

329  {
330  return *this;
331  }

◆ globmem() [1/2]

DASH_CONSTEXPR const GlobAsyncPtr< ElementType, PatternType > & dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::globmem ( ) const
inlineinherited

The instance of GlobStaticMem used by this iterator to resolve addresses in global memory.

Definition at line 353 of file GlobIter.h.

354  {
355  return *_globmem;
356  }

◆ globmem() [2/2]

GlobAsyncPtr< ElementType, PatternType > & dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::globmem ( )
inlineinherited

The instance of GlobStaticMem used by this iterator to resolve addresses in global memory.

Definition at line 362 of file GlobIter.h.

363  {
364  return *_globmem;
365  }

◆ gpos()

DASH_CONSTEXPR index_type dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::gpos ( ) const
inlineinherited

Position of the iterator in global index range.

Definition at line 344 of file GlobIter.h.

345  {
346  return _idx;
347  }

◆ is_local()

DASH_CONSTEXPR bool dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::is_local ( ) const
inlinenoexceptinherited

Checks whether the element referenced by this global iterator is in the calling unit's local memory.

Definition at line 271 of file GlobIter.h.

272  {
273  return (_globmem->team().myid() == lpos().unit);
274  }
DASH_CONSTEXPR auto lpos() const
Unit and local offset at the iterator&#39;s position.
Definition: GlobIter.h:297

◆ local()

DASH_CONSTEXPR local_type dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::local ( ) const
inlineinherited

Convert global iterator to native pointer.

Definition at line 279 of file GlobIter.h.

280  {
281  auto local_pos = lpos();
282 
283  if (local_pos.unit != _pattern->team().myid()) {
284  return nullptr;
285  }
286 
287  auto* lbegin = dash::local_begin(
288  static_cast<pointer>(_globmem->begin()), _pattern->team().myid());
289  DASH_ASSERT(lbegin);
290 
291  return std::next(lbegin, local_pos.index);
292  }
DASH_CONSTEXPR std::enable_if< std::is_same< typename dash::memory_space_traits< MemSpaceT >::memory_space_layout_tag, memory_space_contiguous >::value, T >::type * local_begin(GlobPtr< T, MemSpaceT > global_begin, dash::team_unit_t unit)
Returns the begin of the local memory portion within a global memory segment.
Definition: GlobPtr.h:593
DASH_CONSTEXPR auto lpos() const
Unit and local offset at the iterator&#39;s position.
Definition: GlobIter.h:297

◆ lpos()

DASH_CONSTEXPR auto dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::lpos ( ) const
inlineinherited

Unit and local offset at the iterator's position.

Definition at line 297 of file GlobIter.h.

298  {
299  DASH_LOG_TRACE_VAR("GlobIter.lpos()", _idx);
300 
301  index_type idx = _idx;
302  index_type offset = 0;
303 
304  // Convert iterator position (_idx) to local index and unit.
305  if (idx > _max_idx) {
306  idx = _max_idx;
307  offset = _idx - _max_idx;
308  DASH_ASSERT_EQ(offset, 1, "invalid index");
309  }
310  // Global index to local index and unit:
311  auto local_pos = _pattern->local(idx);
312  // Add the offset
313  local_pos.index += offset;
314 
315  DASH_LOG_TRACE(
316  "GlobIter.lpos >",
317  "unit:",
318  local_pos.unit,
319  "local index:",
320  local_pos.index);
321 
322  return local_pos;
323  }

◆ ndim()

static constexpr dim_t dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::ndim ( )
inlinestaticinherited

The number of dimensions of the iterator's underlying pattern.

Definition at line 158 of file GlobIter.h.

159  {
160  return NumDimensions;
161  }

◆ operator const_pointer()

DASH_CONSTEXPR dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator const_pointer ( ) const
inlineexplicitnoexceptinherited

<fuchsto> TODO: Conversion from iterator to pointer looks dubios

Type conversion operator to GlobPtr.

Returns
A global reference to the element at the iterator's position

Definition at line 170 of file GlobIter.h.

171  {
172  return const_pointer(this->dart_gptr());
173  }
DASH_CONSTEXPR dart_gptr_t dart_gptr() const DASH_NOEXCEPT
Explicit conversion to dart_gptr_t.
Definition: GlobIter.h:193

◆ operator pointer()

DASH_CONSTEXPR dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator pointer ( )
inlineexplicitinherited

<fuchsto> TODO: Conversion from iterator to pointer looks dubios

Type conversion operator to GlobPtr.

Returns
A global reference to the element at the iterator's position

Definition at line 182 of file GlobIter.h.

183  {
184  return pointer(this->dart_gptr());
185  }
DASH_CONSTEXPR dart_gptr_t dart_gptr() const DASH_NOEXCEPT
Explicit conversion to dart_gptr_t.
Definition: GlobIter.h:193

◆ operator*() [1/2]

DASH_CONSTEXPR reference dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator* ( )
inlinenoexceptinherited

Dereference operator.

Returns
A global reference to the element at the iterator's position.

Definition at line 226 of file GlobIter.h.

227  {
228  return reference{this->dart_gptr()};
229  }
DASH_CONSTEXPR dart_gptr_t dart_gptr() const DASH_NOEXCEPT
Explicit conversion to dart_gptr_t.
Definition: GlobIter.h:193

◆ operator*() [2/2]

DASH_CONSTEXPR const_reference dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator* ( ) const
inlinenoexceptinherited

Dereference operator.

Returns
A global reference to the element at the iterator's position.

Definition at line 236 of file GlobIter.h.

237  {
238  return const_reference{this->dart_gptr()};
239  }
DASH_CONSTEXPR dart_gptr_t dart_gptr() const DASH_NOEXCEPT
Explicit conversion to dart_gptr_t.
Definition: GlobIter.h:193

◆ operator++() [1/2]

DASH_CONSTEXPR self_t& dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator++ ( )
inlineinherited

Prefix increment operator.

Definition at line 370 of file GlobIter.h.

371  {
372  ++_idx;
373  return *this;
374  }

◆ operator++() [2/2]

DASH_CONSTEXPR self_t dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator++ ( int  )
inlineinherited

Postfix increment operator.

Definition at line 379 of file GlobIter.h.

380  {
381  self_t result = *this;
382  ++_idx;
383  return result;
384  }

◆ operator--() [1/2]

DASH_CONSTEXPR self_t& dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator-- ( )
inlineinherited

Prefix decrement operator.

Definition at line 389 of file GlobIter.h.

390  {
391  --_idx;
392  return *this;
393  }

◆ operator--() [2/2]

DASH_CONSTEXPR self_t dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator-- ( int  )
inlineinherited

Postfix decrement operator.

Definition at line 398 of file GlobIter.h.

399  {
400  self_t result = *this;
401  --_idx;
402  return result;
403  }

◆ operator[]() [1/2]

DASH_CONSTEXPR reference dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator[] ( index_type  g_index)
inlinenoexceptinherited

Subscript operator, returns global reference to element at given global index.

Parameters
g_indexThe global position of the element

Definition at line 245 of file GlobIter.h.

248  {
249  auto p = *this;
250  p += g_index;
251  return reference(p.dart_gptr());
252  }

◆ operator[]() [2/2]

DASH_CONSTEXPR const_reference dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::operator[] ( index_type  g_index) const
inlinenoexceptinherited

Subscript operator, returns global reference to element at given global index.

Parameters
g_indexThe global position of the element

Definition at line 258 of file GlobIter.h.

261  {
262  auto p = *this;
263  p += g_index;
264  return const_reference(p.dart_gptr());
265  }

◆ pos()

DASH_CONSTEXPR index_type dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType > , GlobAsyncRef< ElementType > , GlobRef<ElementType> >::pos ( ) const
inlineinherited

Position of the iterator in global index space.

Definition at line 336 of file GlobIter.h.

337  {
338  return _idx;
339  }

◆ push()

template<typename ElementType , class PatternType = Pattern<1>>
void dash::GlobAsyncIter< ElementType, PatternType >::push ( )
inline

Block until all non-blocking write operations that have been executed on this global iterator since the last call of wait have been published.

Does not guarantee remote completion.

Definition at line 71 of file GlobAsyncIter.h.

References dart_flush_local_all(), and dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType >, GlobAsyncRef< ElementType > >::dart_gptr().

72  {
74  }
DASH_CONSTEXPR dart_gptr_t dart_gptr() const DASH_NOEXCEPT
Explicit conversion to dart_gptr_t.
Definition: GlobIter.h:193
dart_ret_t dart_flush_local_all(dart_gptr_t gptr)
Guarantee completion of all outstanding operations involving a segment on all units.

◆ wait()

template<typename ElementType , class PatternType = Pattern<1>>
void dash::GlobAsyncIter< ElementType, PatternType >::wait ( )
inline

Wait for completion of non-blocking read- and write operations that have been executed on this global iterator since the last call of wait.

Definition at line 51 of file GlobAsyncIter.h.

References dart_flush_all(), and dash::GlobIter< ElementType, PatternType, GlobAsyncPtr< ElementType, PatternType >, GlobAsyncRef< ElementType > >::dart_gptr().

52  {
53  dart_flush_all(this->dart_gptr());
54  }
DASH_CONSTEXPR dart_gptr_t dart_gptr() const DASH_NOEXCEPT
Explicit conversion to dart_gptr_t.
Definition: GlobIter.h:193
dart_ret_t dart_flush_all(dart_gptr_t gptr)
Guarantee completion of all outstanding operations involving a segment on all units.

The documentation for this class was generated from the following file: