|
DASH
0.3.0
|
A simple shared counter that allows atomic increment- and decrement operations. More...
#include <SharedCounter.h>
Public Member Functions | |
| SharedCounter () | |
| Constructor. More... | |
| SharedCounter (dash::Team &team) | |
| void | inc (ValueType increment) |
| Increment the shared counter value, atomic operation. More... | |
| void | dec (ValueType increment) |
| Decrement the shared counter value, atomic operation. More... | |
| ValueType | get () const |
| Read the current value of the shared counter. More... | |
A simple shared counter that allows atomic increment- and decrement operations.
TODO: Should probably be based on MPI_ACCUMULATE.
Definition at line 15 of file SharedCounter.h.
|
inline |
Constructor.
Definition at line 23 of file SharedCounter.h.
References dash::Array< ElementType, IndexType, PatternType, LocalMemSpaceT >::barrier(), dash::Array< ElementType, IndexType, PatternType, LocalMemSpaceT >::local, and dash::Team::size().
|
inline |
Decrement the shared counter value, atomic operation.
| increment | Decrement value |
Definition at line 54 of file SharedCounter.h.
|
inline |
Read the current value of the shared counter.
Accumulates increment/decrement values of every unit. Reading a shared is not atomic, use Team::barrier() to synchronize.
u units in the associated team Definition at line 68 of file SharedCounter.h.
References dash::Array< ElementType, IndexType, PatternType, LocalMemSpaceT >::local, and dash::ValueType.
|
inline |
Increment the shared counter value, atomic operation.
| increment | Increment value |
Definition at line 44 of file SharedCounter.h.