Template Function shad::rt::asyncExecuteAtWithRet(Handle&, const Locality&, FunT&&, const InArgsT&, ResT *)¶
- Defined in File runtime.h
Function Documentation¶
-
template <typename FunT, typename InArgsT, typename ResT>
voidshad::rt
::
asyncExecuteAtWithRet
(Handle &handle, const Locality &loc, FunT &&func, const InArgsT &args, ResT *result) Execute a function on a selected locality asynchronously and return a result.
Typical Usage:
struct Args { int a; char b; }; void task(Handle & handle, const Args & args, Args * res) { // Do something. } Args args { 2, 'a' }; /* Args doesn't need a dynamic allocated buffer but * more complicated data structure might need it */ std::vector<Args> outBuffers(numLocalities()); Handle handle; for (auto & locality : allLocalities()) { uint32_t localityID = static_cast<uint32_t>(locality); asyncExecuteAtWithRet( handle, locality, task, args, &outBuffers[localityID]); } waitForCompletion(handle);
- Template Parameters
FunT
: The type of the function to be executed. The function prototype must be:void(Handle &, const InArgsT &, ResT *);
InArgsT
: The type of the argument accepted by the function. The type can be a structure or a class but with the restriction that must be memcopy-able.ResT
: The type of the result value. The type can be a structure or a class but with the restriction that must be memcopy-able.
- Parameters