42 auto [start_idx, end_idx] =
chunk_range(0, total_size, omp_get_num_threads(), omp_get_thread_num());
sliced< R > slice(R &&rg, std::ptrdiff_t start_idx, std::ptrdiff_t end_idx)
Lazy-slice a given range.
std::pair< std::ptrdiff_t, std::ptrdiff_t > chunk_range(std::ptrdiff_t first, std::ptrdiff_t last, long n_chunks, long rank)
Given an integer range [first, last), divide it as equally as possible into N chunks.
std::iterator_traits< Iter1 >::difference_type distance(Iter1 first, Iter2 last)
Calculate the distance between two iterators.
auto omp_chunk(R &&rg)
Distribute a range as evenly as possible across all OMP threads.