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

Function Documentation

template <typename FunT>
void shad::rt::forEachOnAll(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.

Typical Usage:

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

  shad::rt::forEachOnAll(
      [](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
  • 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.