DASH
0.3.0
|
Specialization for atomic values. More...
#include <GlobAtomicAsyncRef.h>
Public Types | |
using | value_type = T |
using | const_value_type = typename std::add_const< T >::type |
using | nonconst_value_type = typename std::remove_const< T >::type |
using | atomic_t = dash::Atomic< T > |
using | const_atomic_t = typename dash::Atomic< const_value_type > |
using | nonconst_atomic_t = typename dash::Atomic< nonconst_value_type > |
using | self_t = GlobAsyncRef< atomic_t > |
using | const_type = GlobAsyncRef< const_atomic_t > |
using | nonconst_type = GlobAsyncRef< dash::Atomic< nonconst_value_type > > |
Public Member Functions | |
GlobAsyncRef ()=delete | |
Reference semantics forbid declaration without definition. More... | |
GlobAsyncRef (dart_gptr_t dart_gptr) | |
Constructor, creates an GlobRef object referencing an element in global memory. More... | |
template<typename _T , int = internal::enable_implicit_copy_ctor<value_type, _T>::value> | |
GlobAsyncRef (const GlobAsyncRef< dash::Atomic< _T >> &gref) | |
Copy constructor: Implicit if at least one of the following conditions is satisfied: 1) value_type and _T are exactly the same types (including const and volatile qualifiers 2) value_type and _T are the same types after removing const and volatile qualifiers and value_type itself is const. More... | |
template<typename _T , long = internal::enable_explicit_copy_ctor<value_type, _T>::value> | |
GlobAsyncRef (const GlobAsyncRef< dash::Atomic< _T >> &gref) | |
Copy constructor: Explicit if the following conditions are satisfied. More... | |
template<typename _T , int = internal::enable_implicit_copy_ctor<value_type, _T>::value> | |
GlobAsyncRef (const GlobRef< dash::Atomic< _T >> &gref) | |
template<typename _T , long = internal::enable_explicit_copy_ctor<value_type, _T>::value> | |
GlobAsyncRef (const GlobRef< dash::Atomic< _T >> &gref) | |
GlobAsyncRef (self_t &&other)=default | |
MOVE Constructor: Unlike native reference types, global reference types are moveable. More... | |
self_t & | operator= (const self_t &other)=delete |
Copy Assignment. More... | |
self_t & | operator= (self_t &&other)=default |
Move Assignment. More... | |
bool | operator== (const self_t &other) const noexcept |
bool | operator!= (const self_t &other) const noexcept |
bool | operator== (const T &value) const =delete |
bool | operator!= (const T &value) const =delete |
dart_gptr_t | dart_gptr () const |
bool | is_local () const |
Checks whether the globally referenced element is in the calling unit's local memory. More... | |
T | operator= (const T &value) const |
atomically assigns value More... | |
void | set (const T &value) const |
Set the value of the shared atomic variable. More... | |
void | set (const T *ptr) const |
Set the value of the shared atomic variable. More... | |
void | store (const T &value) const |
Set the value of the shared atomic variable. More... | |
void | store (const T *ptr) const |
Set the value of the shared atomic variable. More... | |
T | get () const |
Atomically fetches the value. More... | |
void | get (T *result) const |
Atomically fetches the value. More... | |
T | load () const |
Load the value of the shared atomic variable. More... | |
template<typename BinaryOp > | |
void | op (BinaryOp binary_op, const T &value) const |
Atomically executes specified operation on the referenced shared value. More... | |
template<typename BinaryOp > | |
void | fetch_op (BinaryOp binary_op, const T &value, T *result) const |
Atomic fetch-and-op operation on the referenced shared value. More... | |
void | exchange (const T &value, T *result) const |
Atomically exchanges value. More... | |
void | compare_exchange (const T &expected, const T &desired, T *result) const |
Atomically compares the value with the value of expected and if thosei are bitwise-equal, replaces the former with desired. More... | |
void | add (const T &value) const |
DASH specific variant which is faster than fetch_add but does not return value. More... | |
void | fetch_add (const T &value, T *result) const |
Atomic fetch-and-add operation on the referenced shared value. More... | |
void | sub (const T &value) const |
DASH specific variant which is faster than fetch_sub but does not return value. More... | |
void | fetch_sub (const T &value, T *result) const |
Atomic fetch-and-sub operation on the referenced shared value. More... | |
void | multiply (const T &value) const |
DASH specific variant which is faster than fetch_mul but does not return value. More... | |
void | fetch_multiply (const T &value, T *result) const |
Atomic fetch-and-multiply operation on the referenced shared value. More... | |
void | flush () const |
Flush all pending asynchronous operations on this asynchronous reference. More... | |
Friends | |
template<typename U > | |
std::ostream & | operator<< (std::ostream &os, const GlobAsyncRef< U > &gref) |
Specialization for atomic values.
All atomic operations are const
as the GlobRef
does not own the atomic values.
Definition at line 25 of file GlobAtomicAsyncRef.h.
|
delete |
Reference semantics forbid declaration without definition.
|
inlineexplicit |
Constructor, creates an GlobRef object referencing an element in global memory.
Definition at line 95 of file GlobAtomicAsyncRef.h.
|
inline |
Copy constructor: Implicit if at least one of the following conditions is satisfied: 1) value_type and _T are exactly the same types (including const and volatile qualifiers 2) value_type and _T are the same types after removing const and volatile qualifiers and value_type itself is const.
Definition at line 111 of file GlobAtomicAsyncRef.h.
|
inlineexplicit |
Copy constructor: Explicit if the following conditions are satisfied.
1) value_type and _T are the same types after excluding const and volatile qualifiers 2) value_type is const and _T is non-const
Definition at line 124 of file GlobAtomicAsyncRef.h.
References dash::GlobAsyncRef< T >::dart_gptr(), dash::GlobAsyncRef< T >::get(), dash::GlobAsyncRef< T >::operator=(), and dash::GlobAsyncRef< T >::operator==().
|
default |
MOVE Constructor: Unlike native reference types, global reference types are moveable.
|
inline |
DASH specific variant which is faster than fetch_add
but does not return value.
Definition at line 407 of file GlobAtomicAsyncRef.h.
|
inline |
Atomically compares the value with the value of expected and if thosei are bitwise-equal, replaces the former with desired.
The value before the operation will be stored to the memory location pointed to by result. The operation was succesful if (expected == *result).
The operation will be completed after a call to flush.
dash::atomic::compare_exchange
Definition at line 383 of file GlobAtomicAsyncRef.h.
References dart_compare_and_swap(), and DART_OK.
|
inline |
Atomically exchanges value.
Definition at line 366 of file GlobAtomicAsyncRef.h.
|
inline |
Atomic fetch-and-add operation on the referenced shared value.
The value before the operation will be stored into the memory location pointed to by result
.
The operation will be completed after a call to flush.
value | Value to be added to global atomic variable. |
result | Pointer to store result to |
Definition at line 420 of file GlobAtomicAsyncRef.h.
|
inline |
Atomic fetch-and-multiply operation on the referenced shared value.
The value before the operation will be stored into the memory location pointed to by result
.
The operation will be completed after a call to flush.
value | Value to be subtracted from global atomic variable. |
result | Pointer to store result to |
Definition at line 472 of file GlobAtomicAsyncRef.h.
|
inline |
Atomic fetch-and-op operation on the referenced shared value.
The value before the operation will be stored in result
. The operation is guaranteed to be completed after a flush.
value | Value to be added to global atomic variable. |
Definition at line 343 of file GlobAtomicAsyncRef.h.
References dart_fetch_and_op(), and DART_OK.
|
inline |
Atomic fetch-and-sub operation on the referenced shared value.
The value before the operation will be stored into the memory location pointed to by result
.
The operation will be completed after a call to flush.
value | Value to be subtracted from global atomic variable. |
result | Pointer to store result to |
Definition at line 446 of file GlobAtomicAsyncRef.h.
|
inline |
Flush all pending asynchronous operations on this asynchronous reference.
Definition at line 484 of file GlobAtomicAsyncRef.h.
References dart_flush(), and DART_OK.
|
inline |
Atomically fetches the value.
The operation blocks until the value is available. However, previous un-flushed operations are not serialized.
Definition at line 264 of file GlobAtomicAsyncRef.h.
References dart_fetch_and_op(), dart_flush_local(), DART_OK, and DART_OP_NO_OP.
|
inline |
Atomically fetches the value.
The operation will return immediately and is guaranteed to be completed after a flush occured. Previous un-flushed operations are not serialized.
Definition at line 289 of file GlobAtomicAsyncRef.h.
References dart_fetch_and_op(), DART_OK, and DART_OP_NO_OP.
|
inline |
Checks whether the globally referenced element is in the calling unit's local memory.
Definition at line 180 of file GlobAtomicAsyncRef.h.
|
inline |
Load the value of the shared atomic variable.
The operation blocks until the value is available. However, previous un-flushed operations are not serialized.
Definition at line 309 of file GlobAtomicAsyncRef.h.
|
inline |
DASH specific variant which is faster than fetch_mul
but does not return value.
Definition at line 459 of file GlobAtomicAsyncRef.h.
|
inline |
Atomically executes specified operation on the referenced shared value.
value | Value to be added to global atomic variable. |
Definition at line 317 of file GlobAtomicAsyncRef.h.
References dart_accumulate_blocking_local(), and DART_OK.
|
delete |
Copy Assignment.
|
default |
Move Assignment.
|
inline |
atomically assigns value
operator=
, see http://en.cppreference.com/w/cpp/atomic/atomic/operator%3D. Definition at line 194 of file GlobAtomicAsyncRef.h.
|
inline |
Set the value of the shared atomic variable.
The operation will block until the local memory can be re-used.
Definition at line 203 of file GlobAtomicAsyncRef.h.
References dart_accumulate_blocking_local(), DART_OK, and DART_OP_REPLACE.
|
inline |
Set the value of the shared atomic variable.
The operation will return immediately and the memory pointed to by ptr
should not be re-used before the operation has been completed.
Definition at line 224 of file GlobAtomicAsyncRef.h.
References dart_accumulate(), DART_OK, and DART_OP_REPLACE.
|
inline |
Set the value of the shared atomic variable.
The operation will block until the local memory can be re-used.
Definition at line 245 of file GlobAtomicAsyncRef.h.
|
inline |
Set the value of the shared atomic variable.
The operation will return immediately and the memory pointed to by ptr
should not be re-used before the operation has been completed.
Definition at line 254 of file GlobAtomicAsyncRef.h.
|
inline |
DASH specific variant which is faster than fetch_sub
but does not return value.
Definition at line 433 of file GlobAtomicAsyncRef.h.