DASH  0.3.0
dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT > Class Template Reference

A fortran style coarray. More...

#include <Coarray.h>

Public Types

using value_type = _element_type
 
using value_base_type = _base_type
 Same as value_type but without atomic wrapper. More...
 
using difference_type = IndexType
 
using index_type = IndexType
 
using size_type = _size_type
 
using iterator = typename _storage_type::iterator
 
using const_iterator = typename _storage_type::const_iterator
 
using reverse_iterator = typename _storage_type::reverse_iterator
 
using const_reverse_iterator = typename _storage_type::const_reverse_iterator
 
using reference = typename coarray::detail::ref_type< _element_type >::type
 
using const_reference = typename coarray::detail::const_ref_type< _element_type >::type
 
using local_pointer = _element_type *
 
using const_local_pointer = const _element_type *
 
template<int subrank>
using view_type = _view_type< subrank >
 
using local_type = _local_ref_type
 
using pattern_type = _pattern_type
 

Public Member Functions

 Coarray (Team &team=Team::All())
 Constructor for scalar types and fully specified array types: More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank != 0)>::type>
 Coarray (const size_type &first_dim, Team &team=Team::All())
 Constructor for array types with one unspecified dimension: More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank == 0)>::type>
 Coarray (const value_type &value, Team &team=Team::All())
 
constexpr const pattern_type & pattern () const noexcept
 
iterator begin () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
iterator end () noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr const_iterator cend () const noexcept
 
local_pointer lbegin () noexcept
 
constexpr const_local_pointer lbegin () const noexcept
 
local_pointer lend () noexcept
 
constexpr const_local_pointer lend () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr bool empty () const noexcept
 
void swap (self_t &&other)
 
constexpr size_type local_size () const noexcept
 
constexpr bool is_local (index_type gi) const noexcept
 
void allocate (Team &team=dash::Team::All())
 allocate an array which was initialized before dash has been initialized More...
 
void allocate (const size_type &n, Team &team=dash::Team::All())
 allocate an array which was initialized before dash has been initialized More...
 
void deallocate ()
 free the memory allocated by this coarray. More...
 
Teamteam ()
 
void barrier ()
 
void sync_all ()
 Blocks until all team members of this container have reached the statement and flushes the memory. More...
 
template<typename Container >
void sync_images (const Container &image_ids)
 Blocks until all selected team members of this container have reached the statement and flushes the memory. More...
 
void flush ()
 
void flush_local ()
 
template<int __valuetype_rank = _valuetype_rank::value>
view_type< __valuetype_rank > operator() (const team_unit_t &unit)
 Operator to select remote unit. More...
 
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank !=0), view_type< __valuetype_rank > >::type operator() (const index_type &unit)
 Operator to select remote unit for array types. More...
 
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank==0), reference >::type operator() (const index_type &unit)
 Operator to select remote unit for scalar types. More...
 
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank==1 &&!is_atomic< value_type >::value), const local_type >::type operator[] (const index_type &idx) const
 optimized bracket operator for accessing local elements of 1-D Coarray (const version) More...
 
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank==1 &&!is_atomic< value_type >::value), local_type >::type operator[] (const index_type &idx)
 optimized bracket operator for accessing local elements of 1-D Coarray More...
 
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank > 1 &&!is_atomic< value_type >::value), local_type >::type operator[] (const index_type &idx)
 Provides access to local array part. More...
 
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank > 0 &&is_atomic< value_type >::value), local_type >::type operator[] (const index_type &idx)
 operator for local atomic accesses More...
 
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank==0 &&!is_atomic< value_type >::value), value_type >::type operator= (const value_type &value)
 allows fortran like local assignment of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank==0 &&is_atomic< value_type >::value), value_type >::type operator= (const value_type &value)
 fortran like local assignment of scalar coarrays of atomic value types More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
 operator value_type () const
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value)>::type>
 operator value_base_type ()
 conversion operator for an atomic scalar coarray to the native (non-atomic) type More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank == 0)>::type>
 operator reference ()
 convert scalar Coarray to a global reference. More...
 
template<typename MEMTYPE , int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank == 0)>::type>
MEMTYPE & member (size_t offs)
 Get a reference to a member of a certain type at the specified offset. More...
 
template<class MEMTYPE , class P = T, int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank == 0)>::type>
MEMTYPE & member (const MEMTYPE P::*mem)
 Get the member via pointer to member. More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type & operator+= (const value_type &value)
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value)>::type>
value_base_type operator+= (const value_base_type &value)
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type & operator-= (const value_type &value)
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value)>::type>
value_base_type operator-= (const value_base_type &value)
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type & operator*= (const value_type &value)
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value)>::type>
reference operator*= (const value_type &value)
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type & operator/= (const value_type &value)
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value)>::type>
reference operator/= (const value_type &value)
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type operator+ (const value_type &value) const
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type operator- (const value_type &value) const
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type operator* (const value_type &value) const
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type operator/ (const value_type &value) const
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type & operator++ ()
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value)>::type>
value_base_type operator++ ()
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type operator++ (int)
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type & operator-- ()
 allows fortran like local access of scalars More...
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value)>::type>
value_base_type operator-- ()
 
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type operator-- (int)
 allows fortran like local access of scalars More...
 

Static Public Member Functions

static constexpr dim_t ndim () noexcept
 

Detailed Description

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
class dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >

A fortran style coarray.

Interface of the Coarray for scalar and array types showing local and global accesses:

dash::Coarray<int> i; // scalar Coarray
dash::Coarray<int[][20]> y(n); // one open dim,
// set at runtime in ctor
// access syntax
i(unit) = value; // global access
i = value; // local access
x(unit)[idx1][idx2] = value; // global access
x[idx1][idx2] = value; // local access

Definition at line 184 of file Coarray.h.

Member Typedef Documentation

◆ value_base_type

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
using dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::value_base_type = _base_type

Same as value_type but without atomic wrapper.

Definition at line 220 of file Coarray.h.

Constructor & Destructor Documentation

◆ Coarray() [1/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::Coarray ( Team team = Team::All())
inlineexplicit

Constructor for scalar types and fully specified array types:

Definition at line 283 of file Coarray.h.

References dash::is_initialized().

283  {
284  if(dash::is_initialized() &&
285  (std::is_array<_base_type>::value == false
286  || std::extent<_base_type, 0>::value != 0))
287  {
288  allocate(team);
289  }
290  }
bool is_initialized()
Check whether DASH has been initialized already.
void allocate(Team &team=dash::Team::All())
allocate an array which was initialized before dash has been initialized
Definition: Coarray.h:416

◆ Coarray() [2/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank != 0)>::type>
dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::Coarray ( const size_type &  first_dim,
Team team = Team::All() 
)
inlineexplicit

Constructor for array types with one unspecified dimension:

Definition at line 301 of file Coarray.h.

References dash::Team::All(), dash::barrier(), dash::begin(), dash::end(), dash::is_initialized(), dash::size(), and dash::swap().

301  {
302  if(dash::is_initialized()){
303  allocate(first_dim, team);
304  }
305  }
bool is_initialized()
Check whether DASH has been initialized already.
void allocate(Team &team=dash::Team::All())
allocate an array which was initialized before dash has been initialized
Definition: Coarray.h:416

Member Function Documentation

◆ allocate() [1/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
void dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::allocate ( Team team = dash::Team::All())
inline

allocate an array which was initialized before dash has been initialized

Definition at line 416 of file Coarray.h.

416  {
417  if(_storage.size() == 0){
418  _storage.allocate(_pattern_type(_make_size_spec(),
419  DistributionSpec<_rank::value>(),
420  TeamSpec<_rank::value,
421  IndexType>(team),
422  team));
423  }
424  }
bool allocate(const size_spec &sizespec, const distribution_spec &distribution, const team_spec &teamspec, dash::Team &team=dash::Team::All())
Explicit allocation of matrix elements, used for delayed allocation of default-constructed Matrix ins...

◆ allocate() [2/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
void dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::allocate ( const size_type &  n,
Team team = dash::Team::All() 
)
inline

allocate an array which was initialized before dash has been initialized

Definition at line 429 of file Coarray.h.

432  {
433  if((_storage.size() == 0) && (n > 0)){
434  _storage.allocate(_pattern_type(_make_size_spec(n),
435  DistributionSpec<_rank::value>(),
436  TeamSpec<_rank::value,
437  IndexType>(team),
438  team));
439  }
440  }
bool allocate(const size_spec &sizespec, const distribution_spec &distribution, const team_spec &teamspec, dash::Team &team=dash::Team::All())
Explicit allocation of matrix elements, used for delayed allocation of default-constructed Matrix ins...

◆ deallocate()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
void dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::deallocate ( )
inline

free the memory allocated by this coarray.

After deallocation, the coarray cannot be used anymore.

Definition at line 446 of file Coarray.h.

References dash::barrier().

446  {
447  _storage.deallocate();
448  }
void deallocate()
Explicit deallocation of matrix elements, called implicitly in destructor and team deallocation...

◆ member() [1/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<typename MEMTYPE , int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank == 0)>::type>
MEMTYPE& dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::member ( size_t  offs)
inline

Get a reference to a member of a certain type at the specified offset.

Definition at line 656 of file Coarray.h.

656  {
657  auto *s_begin = reinterpret_cast<char *>(_storage.lbegin());
658  s_begin += offs;
659  return *(reinterpret_cast<MEMTYPE*>(s_begin));
660  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ member() [2/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<class MEMTYPE , class P = T, int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank == 0)>::type>
MEMTYPE& dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::member ( const MEMTYPE P::*  mem)
inline

Get the member via pointer to member.

struct value_t {double a; int b;};
int b = x.member(&value_t::b);

Definition at line 675 of file Coarray.h.

675  {
676  auto offs = (size_t) & (reinterpret_cast<P *>(0)->*mem);
677  return member<MEMTYPE>(offs);
678  }

◆ operator reference()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<(__valuetype_rank == 0)>::type>
dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator reference ( )
inlineexplicit

convert scalar Coarray to a global reference.

Definition at line 644 of file Coarray.h.

References dash::myid().

644  {
645  return _storage[myid()];
646  }
global_unit_t myid()
Shortcut to query the global unit ID of the calling unit.

◆ operator value_base_type()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value)>::type>
dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator value_base_type ( )
inline

conversion operator for an atomic scalar coarray to the native (non-atomic) type

Definition at line 634 of file Coarray.h.

634  {
635  return _storage[_myid()];
636  }

◆ operator value_type()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator value_type ( ) const
inline

allows fortran like local access of scalars

i = 42;
int b = i;

Definition at line 621 of file Coarray.h.

621  {
622  return *(_storage.lbegin());
623  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator()() [1/3]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
view_type<__valuetype_rank> dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator() ( const team_unit_t unit)
inline

Operator to select remote unit.

Definition at line 491 of file Coarray.h.

491  {
492  return this->operator ()(static_cast<index_type>(unit));
493  }
view_type< __valuetype_rank > operator()(const team_unit_t &unit)
Operator to select remote unit.
Definition: Coarray.h:491

◆ operator()() [2/3]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank != 0), view_type<__valuetype_rank> >::type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator() ( const index_type &  unit)
inline

Operator to select remote unit for array types.

Definition at line 499 of file Coarray.h.

499  {
500  return _storage[unit];
501  }

◆ operator()() [3/3]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<(__valuetype_rank == 0), reference>::type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator() ( const index_type &  unit)
inline

Operator to select remote unit for scalar types.

Definition at line 508 of file Coarray.h.

508  {
509  return _storage.at(unit);
510  }
const_reference at(Args... args) const
Fortran-style subscript operator.

◆ operator*()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator* ( const value_type &  value) const
inline

allows fortran like local access of scalars

Definition at line 809 of file Coarray.h.

809  {
810  return *(_storage.lbegin()) * value;
811  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator*=()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type& dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator*= ( const value_type &  value)
inline

allows fortran like local access of scalars

Definition at line 737 of file Coarray.h.

737  {
738  return *(_storage.lbegin()) *= value;
739  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator+()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator+ ( const value_type &  value) const
inline

allows fortran like local access of scalars

i = 42;
int b = i + 21;

Definition at line 785 of file Coarray.h.

785  {
786  return *(_storage.lbegin()) + value;
787  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator++() [1/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type& dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator++ ( )
inline

allows fortran like local access of scalars

Definition at line 833 of file Coarray.h.

833  {
834  return ++(*(_storage.lbegin()));
835  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator++() [2/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator++ ( int  )
inline

allows fortran like local access of scalars

Definition at line 854 of file Coarray.h.

854  {
855  return (*(_storage.lbegin()))++;
856  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator+=()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type& dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator+= ( const value_type &  value)
inline

allows fortran like local access of scalars

i = 42;
i += 21;

Definition at line 693 of file Coarray.h.

693  {
694  return *(_storage.lbegin()) += value;
695  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator-()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator- ( const value_type &  value) const
inline

allows fortran like local access of scalars

Definition at line 797 of file Coarray.h.

797  {
798  return *(_storage.lbegin()) - value;
799  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator--() [1/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type& dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator-- ( )
inline

allows fortran like local access of scalars

Definition at line 866 of file Coarray.h.

866  {
867  return --(*(_storage.lbegin()));
868  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator--() [2/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator-- ( int  )
inline

allows fortran like local access of scalars

Definition at line 887 of file Coarray.h.

References dash::operator-().

887  {
888  return (*(_storage.lbegin()))--;
889  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator-=()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type& dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator-= ( const value_type &  value)
inline

allows fortran like local access of scalars

Definition at line 715 of file Coarray.h.

715  {
716  return *(_storage.lbegin()) -= value;
717  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator/()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator/ ( const value_type &  value) const
inline

allows fortran like local access of scalars

Definition at line 821 of file Coarray.h.

821  {
822  return *(_storage.lbegin()) / value;
823  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator/=()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value, typename = typename std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value)>::type>
value_type& dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator/= ( const value_type &  value)
inline

allows fortran like local access of scalars

Definition at line 758 of file Coarray.h.

758  {
759  return *(_storage.lbegin()) /= value;
760  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator=() [1/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<( __valuetype_rank == 0 && !is_atomic<value_type>::value), value_type>::type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator= ( const value_type &  value)
inline

allows fortran like local assignment of scalars

Definition at line 591 of file Coarray.h.

591  {
592  return *(_storage.lbegin()) = value;
593  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator=() [2/2]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<( __valuetype_rank == 0 && is_atomic<value_type>::value), value_type>::type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator= ( const value_type &  value)
inline

fortran like local assignment of scalar coarrays of atomic value types

Definition at line 603 of file Coarray.h.

603  {
604  return operator()(_myid()) = value;
605  }
view_type< __valuetype_rank > operator()(const team_unit_t &unit)
Operator to select remote unit.
Definition: Coarray.h:491

◆ operator[]() [1/4]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<( __valuetype_rank == 1 && !is_atomic<value_type>::value), const local_type>::type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator[] ( const index_type &  idx) const
inline

optimized bracket operator for accessing local elements of 1-D Coarray (const version)

Definition at line 521 of file Coarray.h.

522  {
523  return const_cast<const local_type>(
524  *(_storage.lbegin()+idx));
525  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator[]() [2/4]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<( __valuetype_rank == 1 && !is_atomic<value_type>::value), local_type>::type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator[] ( const index_type &  idx)
inline

optimized bracket operator for accessing local elements of 1-D Coarray

Definition at line 535 of file Coarray.h.

535  {
536  return *(_storage.lbegin()+idx);
537  }
ElementT * lbegin() noexcept
Pointer to first element in local range.

◆ operator[]() [3/4]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<( __valuetype_rank > 1 && !is_atomic<value_type>::value), local_type>::type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator[] ( const index_type &  idx)
inline

Provides access to local array part.

Definition at line 550 of file Coarray.h.

550  {
551  // The Coarray internally is based on dash::Narray, with extents:
552  // global: team.size() x T[0] x ... x T[n]
553  // local: 1 x T[0] x ... x T[n]
554  // The first (0) dimenson of the Narray is used for the Coindex.
555  // Example: Coarray<T[10][5]> ~ NArray<T, 3,...>(team.size(), 10, 5)
556  //
557  // The pattern of the NArray is created in a way, that the offset in the
558  // first (0) dimension selects the unit the data is local to. While the
559  // dimensionality of the local and global parts are always equal, the rank
560  // of the local part is reduced by one (the co-dimension).
561  //
562  // Hence: deref. first dimension and return a view on the remaining ones.
563  // This is logically equivalent to _storage[myid][idx] but uses (faster)
564  // local view types
565  return _storage.local[0][idx];
566  }
local_type local
Local view proxy object.
Definition: Matrix.h:251

◆ operator[]() [4/4]

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<int __valuetype_rank = _valuetype_rank::value>
std::enable_if<( __valuetype_rank > 0 && is_atomic<value_type>::value), local_type>::type dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::operator[] ( const index_type &  idx)
inline

operator for local atomic accesses

Definition at line 575 of file Coarray.h.

575  {
576  // dereference first dimension and return a view on the remaining ones
577  return operator()(_myid())[idx];
578  }
view_type< __valuetype_rank > operator()(const team_unit_t &unit)
Operator to select remote unit.
Definition: Coarray.h:491

◆ sync_all()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
void dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::sync_all ( )
inline

Blocks until all team members of this container have reached the statement and flushes the memory.

Definition at line 462 of file Coarray.h.

462  {
463  _storage.barrier();
464  }
void barrier() const
Synchronize units associated with the matrix.

◆ sync_images()

template<typename T, typename IndexType = dash::default_index_t, MemArrange Arrangement = ROW_MAJOR, typename LocalMemSpaceT = HostSpace>
template<typename Container >
void dash::Coarray< T, IndexType, Arrangement, LocalMemSpaceT >::sync_images ( const Container &  image_ids)
inline

Blocks until all selected team members of this container have reached the statement and flushes the memory.

Definition at line 471 of file Coarray.h.

References dash::coarray::sync_images().

471  {
472  _storage.flush();
473  dash::coarray::sync_images(image_ids);
474  }
void flush()
Complete all outstanding non-blocking operations to all units on the container&#39;s underlying global me...
void sync_images(const Container &image_ids)
Blocks until all selected units reach this statement.
Definition: Utils.h:75

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