Template Function shad::rt::asyncForEachOnAll(Handle&, FunT&&, const std::shared_ptr<uint8_t>&, const uint32_t, const size_t)

Function Documentation

template <typename FunT>
void shad::rt::asyncForEachOnAll(Handle &handle, FunT &&func, const std::shared_ptr<uint8_t> &argsBuffer, const uint32_t bufferSize, const size_t numIters)

Execute a parallel loop on the whole system asynchronously.

Typical Usage:

std::shared_ptr<uint8_t> buffer(new uint8_t[2]{ 5, 5 },
                                std::default_delete<uint8_t[]>());

Handle handle;
shad::rt::asyncForEachOnAll(handle,
    [](Handle &, const uint8_t * input, const uint32_t size,
       size_t itrNum) {
      // Do something
    },
    buffer, 2,
    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 uint8_t *, const uint32_t, size_t itrNum);
    
    where the itrNum is the n-th iteration of the loop.
Parameters
  • handle: An Handle for the associated task-group.
  • func: The function to execute.
  • argsBuffer: A buffer of bytes to be passed to the function.
  • bufferSize: The size of the buffer argsBuffer passed.
  • numIters: The total number of iteration of the loop.