#include <parallel_for.h>
Classes | |
struct | Auto |
struct | Static |
Public Types | |
using | size_type = std::conditional_t< std::is_signed< IntegerT >::value, int64_t, uint64_t > |
Public Member Functions | |
ChunkedRange (IntegerT s, IntegerT e, IntegerT c) | |
ChunkedRange (IntegerT s, IntegerT e, Static) | |
ChunkedRange (IntegerT s, IntegerT e, Auto) | |
bool | isStatic () const |
bool | isAuto () const |
bool | empty () const |
size_type | size () const |
template<typename OtherInt > | |
std::tuple< size_type, size_type > | calcChunkSize (OtherInt numLaunched, bool oneOnCaller, size_type minChunkSize) const |
Public Attributes | |
IntegerT | start |
IntegerT | end |
IntegerT | chunk |
Static Public Attributes | |
static constexpr IntegerT | kStatic = std::numeric_limits<IntegerT>::max() |
A helper class for parallel_for
. It provides various configuration parameters to describe how to break up work for parallel processing. ChunkedRanges can be created with Auto chunking, Static chunking, or specific chunking. Auto chunking makes large chunks for better cache utilization, but tries to make enough chunks to provide some dynamic load balancing. Static chunking makes N chunks given N threads to run the loop on. User-specified chunking can be useful for ensuring e.g. that at least a multiple of SIMD width is provided per chunk. parallel_for
calls that don't accept a ChunkedRange will create a ChunkedRange internally using Auto chunking.
Definition at line 87 of file parallel_for.h.
using dispenso::ChunkedRange< IntegerT >::size_type = std::conditional_t<std::is_signed<IntegerT>::value, int64_t, uint64_t> |
Definition at line 94 of file parallel_for.h.
|
inline |
Create a ChunkedRange with specific chunk size
s | The start of the range. |
e | The end of the range. |
c | The chunk size. |
Definition at line 107 of file parallel_for.h.
|
inline |
Create a ChunkedRange with chunk size equal to total items divided by number of threads.
s | The start of the range. |
e | The end of the range. |
Definition at line 114 of file parallel_for.h.
|
inline |
Create a ChunkedRange with chunk size determined automatically to enable some dynamic load balancing.
s | The start of the range. |
e | The end of the range. |
Definition at line 122 of file parallel_for.h.
|
inline |
Definition at line 142 of file parallel_for.h.
|
inline |
Definition at line 132 of file parallel_for.h.
|
inline |
Definition at line 128 of file parallel_for.h.
|
inline |
Definition at line 124 of file parallel_for.h.
|
inline |
Definition at line 136 of file parallel_for.h.
IntegerT dispenso::ChunkedRange< IntegerT >::chunk |
Definition at line 165 of file parallel_for.h.
IntegerT dispenso::ChunkedRange< IntegerT >::end |
Definition at line 164 of file parallel_for.h.
|
staticconstexpr |
Definition at line 98 of file parallel_for.h.
IntegerT dispenso::ChunkedRange< IntegerT >::start |
Definition at line 163 of file parallel_for.h.