Skip to content

Commit

Permalink
Integrating strict random-access semantics on global address range
Browse files Browse the repository at this point in the history
  • Loading branch information
fuchsto committed Mar 25, 2017
1 parent c270dda commit a26b27e
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 232 deletions.
2 changes: 0 additions & 2 deletions dash/include/dash/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ class AsyncArrayRef
*/
constexpr const_async_reference operator[](const size_t n) const {
return async_reference(
_array->m_globmem,
(*(_array->begin() + n)).dart_gptr());
}

Expand All @@ -360,7 +359,6 @@ class AsyncArrayRef
*/
async_reference operator[](const size_t n) {
return async_reference(
_array->m_globmem,
(*(_array->begin() + n)).dart_gptr());
}

Expand Down
90 changes: 18 additions & 72 deletions dash/include/dash/GlobAsyncRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ class GlobAsyncRef
std::ostream & os,
const GlobAsyncRef<U> & gar);

template <
typename ElementT >
friend class GlobAsyncRef;

private:
typedef GlobAsyncRef<T>
self_t;
typedef GlobStaticMem<T, dash::allocator::SymmetricAllocator<T> >
GlobMem_t;
typedef typename std::remove_const<T>::type
nonconst_value_type;

private:
/// Instance of GlobStaticMem that issued this global reference
GlobMem_t * _globmem;
/// Value of the referenced element, initially not loaded
mutable T _value;
/// Pointer to referenced element in global memory
Expand All @@ -67,26 +69,11 @@ class GlobAsyncRef
mutable bool _has_value = false;

public:
/**
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
*/
GlobAsyncRef(
/// Instance of GlobStaticMem that issued this global reference
GlobMem_t * globmem,
/// Pointer to referenced object in global memory
T * lptr)
: _value(*lptr),
_lptr(lptr),
_is_local(true),
_has_value(true)
{ }

/**
* Conctructor, creates an GlobRefAsync object referencing an element in
* local memory.
*/
GlobAsyncRef(
explicit GlobAsyncRef(
/// Pointer to referenced object in local memory
T * lptr)
: _value(*lptr),
Expand All @@ -99,30 +86,10 @@ class GlobAsyncRef
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
*/
template<class MemSpaceT>
GlobAsyncRef(
/// Instance of GlobStaticMem that issued this global reference
GlobMem_t * globmem,
/// Pointer to referenced object in global memory
GlobPtr<T, MemSpaceT> & gptr)
: _gptr(gptr.dart_gptr())
{
_is_local = gptr.is_local();
if (_is_local) {
_value = *gptr;
_lptr = (T*)(gptr);
_has_value = true;
}
}

/**
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
*/
template<class MemSpaceT>
GlobAsyncRef(
template<class ElementT, class MemSpaceT>
explicit GlobAsyncRef(
/// Pointer to referenced object in global memory
GlobPtr<T, MemSpaceT> & gptr)
GlobPtr<ElementT, MemSpaceT> & gptr)
: _gptr(gptr.dart_gptr())
{
_is_local = gptr.is_local();
Expand All @@ -137,9 +104,7 @@ class GlobAsyncRef
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
*/
GlobAsyncRef(
/// Instance of GlobStaticMem that issued this global reference
GlobMem_t * globmem,
explicit GlobAsyncRef(
/// Pointer to referenced object in global memory
dart_gptr_t dart_gptr)
: _gptr(dart_gptr)
Expand All @@ -154,40 +119,21 @@ class GlobAsyncRef
}

/**
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
* Constructor, creates an GlobRef object referencing an element in global
* memory.
*/
GlobAsyncRef(
template<class ElementT>
explicit GlobAsyncRef(
/// Pointer to referenced object in global memory
dart_gptr_t dart_gptr)
: _gptr(dart_gptr)
{
GlobConstPtr<T> gptr(dart_gptr);
_is_local = gptr.is_local();
if (_is_local) {
_value = *gptr;
_lptr = (T*)(gptr);
_has_value = true;
}
}

/**
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
*/
GlobAsyncRef(
/// Instance of GlobStaticMem that issued this global reference
GlobMem_t * globmem,
/// Pointer to referenced object in global memory
GlobRef<T> & gref)
: GlobAsyncRef(globmem, gref.gptr())
const GlobConstPtr<ElementT> & gptr)
: GlobAsyncRef(gptr.dart_gptr())
{ }

/**
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
*/
GlobAsyncRef(
explicit GlobAsyncRef(
/// Pointer to referenced object in global memory
GlobRef<T> & gref)
: GlobAsyncRef(gref.dart_gptr())
Expand Down
Loading

0 comments on commit a26b27e

Please sign in to comment.