Template Function shad::rt::asyncForEachOnAll(Handle&, FunT&&, const std::shared_ptr<uint8_t>&, const uint32_t, const size_t)¶
- Defined in File runtime.h
Function Documentation¶
-
template <typename FunT>
voidshad::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:where the itrNum is the n-th iteration of the loop.void(Handle &, const uint8_t *, const uint32_t, size_t itrNum);
- 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.