Helpers. More...
Namespaces | |
Grappa::delegate | |
Classes | |
class | Grappa::delegate::Promise< R > |
A 'Promise' is a wrapper around a FullEmpty for async delegates with return values. More... | |
class | Grappa::delegate::FetchAddCombiner< T, U > |
Flat combines fetch_and_add to a single global address. More... | |
Macros | |
#define | AUTO_INVOKE(expr) decltype(expr) { return expr; } |
Functions | |
template<SyncMode S = SyncMode::Blocking, GlobalCompletionEvent * C = &impl::local_gce, typename F = decltype(nullptr)> | |
auto | Grappa::delegate::call (Core dest, F f) -> AUTO_INVOKE((impl::Specializer< S, C, F >::call(dest, f,&F::operator()))) |
template<SyncMode S = SyncMode::Blocking, GlobalCompletionEvent * C = &impl::local_gce, typename T = decltype(nullptr), typename F = decltype(nullptr)> | |
auto | Grappa::delegate::call (GlobalAddress< T > t, F func) -> AUTO_INVOKE((impl::call< S, C >(t, func,&F::operator()))) |
Helper that makes it easier to implement custom delegate operations specifically on global addresses. More... | |
template<typename M , typename F > | |
auto | Grappa::delegate::call (Core dest, M mutex, F func) -> decltype(func(mutex())) |
Try lock on remote mutex. More... | |
template<typename F > | |
auto | Grappa::delegate::call_suspendable (Core dest, F func) -> decltype(func()) |
Alternative version of delegate::call that spawns a privateTask to allow the delegate to perform suspending actions. More... | |
template<SyncMode S = SyncMode::Blocking, GlobalCompletionEvent * C = &impl::local_gce, typename T = decltype(nullptr)> | |
T | Grappa::delegate::read (GlobalAddress< T > target) |
Read the value (potentially remote) at the given GlobalAddress, blocks the calling task until round-trip communication is complete. More... | |
template<SyncMode S = SyncMode::Blocking, GlobalCompletionEvent * C = &impl::local_gce, typename T = decltype(nullptr), typename U = decltype(nullptr)> | |
void | Grappa::delegate::write (GlobalAddress< T > target, U value) |
Blocking remote write. More... | |
template<SyncMode S = SyncMode::Blocking, GlobalCompletionEvent * C = &impl::local_gce, typename T = decltype(nullptr), typename U = decltype(nullptr)> | |
T | Grappa::delegate::fetch_and_add (GlobalAddress< T > target, U inc) |
Fetch the value at target , increment the value stored there with inc and return the original value to blocking thread. More... | |
Grappa::delegate::FetchAddCombiner< T, U >::FetchAddCombiner (GlobalAddress< T > target, uint64_t flush_threshold, U initVal) | |
void | Grappa::delegate::FetchAddCombiner< T, U >::promise () |
Promise that in the future you will call fetch_and_add . More... | |
T | Grappa::delegate::FetchAddCombiner< T, U >::fetch_and_add (U inc) |
template<SyncMode S = SyncMode::Blocking, GlobalCompletionEvent * C = &impl::local_gce, typename T = decltype(nullptr), typename U = decltype(nullptr), typename V = decltype(nullptr)> | |
bool | Grappa::delegate::compare_and_swap (GlobalAddress< T > target, U cmp_val, V new_val) |
If value at target equals cmp_val , set the value to new_val and return true , otherwise do nothing and return false . More... | |
template<SyncMode S = SyncMode::Blocking, GlobalCompletionEvent * C = &impl::local_gce, typename T = decltype(nullptr), typename U = decltype(nullptr)> | |
void | Grappa::delegate::increment (GlobalAddress< T > target, U inc) |
template<TaskMode B = TaskMode::Bound, GlobalCompletionEvent * C = &impl::local_gce, typename F = decltype(nullptr)> | |
void | Grappa::spawnRemote (Core dest, F f) |
Synchronizing remote private task spawn. More... | |
Worker * | Grappa::current_worker () |
Helpers.
#define AUTO_INVOKE | ( | expr | ) | decltype(expr) { return expr; } |
Definition at line 112 of file Delegate.hpp.
auto Grappa::delegate::call | ( | Core | dest, |
F | f | ||
) | -> AUTO_INVOKE((impl::Specializer< S, C, F >::call(dest, f,&F::operator()))) |
|
inline |
Helper that makes it easier to implement custom delegate operations specifically on global addresses.
Does specialization based on return type of the lambda.
Example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GlobalAddress<int> xa; bool is_zero = delegate::call(xa, [](int* x){ return *x == 0; });
// or by reference: bool is_zero = delegate::call(xa, [](int& x){ return x == 0; });
|
inline |
Try lock on remote mutex.
Does not lock or unlock, creates a SuspendedDelegate if lock has already been taken, which is triggered on unlocking of the Mutex.
Definition at line 159 of file Delegate.hpp.
|
inline |
Alternative version of delegate::call that spawns a privateTask to allow the delegate to perform suspending actions.
Definition at line 207 of file Delegate.hpp.
bool Grappa::delegate::compare_and_swap | ( | GlobalAddress< T > | target, |
U | cmp_val, | ||
V | new_val | ||
) |
If value at target
equals cmp_val
, set the value to new_val
and return true
, otherwise do nothing and return false
.
Definition at line 421 of file Delegate.hpp.
|
inline |
Definition at line 605 of file TaskingScheduler.hpp.
T Grappa::delegate::fetch_and_add | ( | GlobalAddress< T > | target, |
U | inc | ||
) |
Fetch the value at target
, increment the value stored there with inc
and return the original value to blocking thread.
Definition at line 287 of file Delegate.hpp.
|
inline |
Definition at line 369 of file Delegate.hpp.
|
inline |
Definition at line 339 of file Delegate.hpp.
void Grappa::delegate::increment | ( | GlobalAddress< T > | target, |
U | inc | ||
) |
Definition at line 442 of file Delegate.hpp.
|
inline |
Promise that in the future you will call fetch_and_add
.
Must be called before a call to fetch_and_add
After calling promise, this task must NOT have a dependence on any fetch_and_add
occurring before it calls fetch_and_add
itself or deadlock may occur.
For good performance, should allow other tasks to run before calling fetch_and_add
Definition at line 364 of file Delegate.hpp.
T Grappa::delegate::read | ( | GlobalAddress< T > | target | ) |
Read the value (potentially remote) at the given GlobalAddress, blocks the calling task until round-trip communication is complete.
Remove 'const' qualifier to do read.
Definition at line 247 of file Delegate.hpp.
void Grappa::spawnRemote | ( | Core | dest, |
F | f | ||
) |
Synchronizing remote private task spawn.
Automatically enrolls task with GlobalCompletionEvent and sends complete
message when done (if C is non-null).
Definition at line 457 of file Delegate.hpp.
void Grappa::delegate::write | ( | GlobalAddress< T > | target, |
U | value | ||
) |
Blocking remote write.
Definition at line 270 of file Delegate.hpp.