Template Function shad::rt::asyncForEachOnAll(Handle&, FunT&&, const InArgsT&, const size_t)

Function Documentation

template <typename FunT, typename InArgsT>
void shad::rt::asyncForEachOnAll(Handle &handle, FunT &&func, const InArgsT &args, const size_t numIters)

Execute a parallel loop on the whole system asynchronously.

Typical Usage:

struct Args {
  int a;
  char b;
};

Args args { 2, 'a' };
Handle handle;
shad::rt::asyncForEachOnAll(
    handle,
    [](Handle &, const Args &, size_t itrNum) {
      // Do something.
    },
    args,
    iterations);
/* Do something else */
shad::rt::waitForCompletion(handle);

Template Parameters
  • FunT: The type of the function to be executed. The function prototype must be:
    void(Handle &, const ArgsT &, size_t itrNum);
    
    where the itrNum is the n-th iteration of the loop.
  • 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.
Parameters
  • handle: An Handle for the associated task-group.
  • func: The function to execute.
  • args: The arguments to be passed to the function.
  • numIters: The total number of iteration of the loop.