itertools::chunk_range

#include <itertools.hpp>

Synopsis

std::pair<std::ptrdiff_t, std::ptrdiff_t> chunk_range (std::ptrdiff_t first,
std::ptrdiff_t last,
long n_chunks,
long rank)

Parameters

  • first First value of the range.

  • last Last value of the range (excluded).

  • n_chunks Number of chunks to divide the range into.

  • rank Rank of the calling process.

Returns

Pair of indices specifying the first and last (excluded) value of the chunk assigned to the calling process.