Template Function shad::rt::asyncExecuteAt(Handle&, const Locality&, FunT&&, const std::shared_ptr<uint8_t>&, const uint32_t)¶
- Defined in File runtime.h
Function Documentation¶
-
template <typename FunT>
voidshad::rt
::
asyncExecuteAt
(Handle &handle, const Locality &loc, FunT &&func, const std::shared_ptr<uint8_t> &argsBuffer, const uint32_t bufferSize)¶ Execute a function on a selected locality asynchronously.
Typical Usage:
struct Args { int a; char b; }; void task(Handle & handle, const uint8_t * buff, const uint32_t size) { /* do something */ } Args args { 2, 'a' }; /* Args doesn't need a dynamic allocated buffer but * more complicated data structure might need it */ std::shared_ptr<uint8_t> ptr(new uint8_t[sizeof(Args)], std::default_delete<uint8_t[]>()); memcpy(ptr.get(), &args, sizeof(Args)); Handle handle; for (auto & locality : allLocalities) if (static_cast<uint32_t>(locality) % 2) executeAt(handle, locality, task, ptr.get(), sizeof(Args)); waitForCompletion(handle)
- Template Parameters
FunT
: The type of the function to be executed. The function prototype must be:void(Handle &, const uint8_t *, const uint32_t);
- Parameters