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

Function Documentation

template <typename FunT>
void shad::rt::forEachAt(const Locality &loc, FunT &&func, const std::shared_ptr<uint8_t> &argsBuffer, const uint32_t bufferSize, const size_t numIters)

Execute a parallel loop at a specific locality.

Typical Usage:

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

shad::rt::forEachAt(locality,
    [](const uint8_t * input, const uint32_t size, size_t itrNum) {
        // Do something.
    },
    buffer, sizeof(buffer),
    iterations);

Template Parameters
  • FunT: The type of the function to be executed. The function prototype must be:
    void(const uint8_t *, const uint32_t, size_t itrNum);
    
    where the itrNum is the n-th iteration of the loop.
Parameters
  • loc: The Locality where the function must be executed.
  • 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.