Template Function shad::rt::executeAtWithRet(const Locality&, FunT&&, const InArgsT&, ResT *)

Function Documentation

template <typename FunT, typename InArgsT, typename ResT>
void shad::rt::executeAtWithRet(const Locality &loc, FunT &&func, const InArgsT &args, ResT *result)

Execute a function on a selected locality synchronously and return a result.

Typical Usage:

struct Args {
  int a;
  char b;
};

void task(const Args & args, Args * outArgs) {
  *outArgs = args;
}

Args args { 2, 'a' };
Args out;
for (auto & locality : allLocalities)
  if (static_cast<uint32_t>(locality) % 2)
    // every call will overwrite outbuff
    executeAtWithRet(locality, task, args, out);

Template Parameters
  • FunT: The type of the function to be executed. The function prototype must be:
    void(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
  • loc: The Locality where the function must be executed.
  • func: The function to execute.
  • args: The arguments to be passed to the function.
  • result: The location where to store the result.