class
StaticPartitionerclass to construct a dynamic partitioner for scheduling parallel algorithms
The partitioner divides iterations into chunks and distributes chunks to workers in order. If the chunk size is not specified (default 0
), the partitioner resorts to a chunk size that equally distributes iterations into workers.
std::vector<int> data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} taskflow.for_each( data.begin(), data.end(), [](int i){}, StaticPartitioner(0) ); executor.run(taskflow).run();
Base classes
- class PartitionerBase
- class to derive a partitioner for scheduling parallel algorithms
Constructors, destructors, conversion operators
- StaticPartitioner()
- default constructor
- StaticPartitioner(size_t sz) explicit
- construct a dynamic partitioner with the given chunk size
Public functions
- auto adjusted_chunk_size(size_t N, size_t W, size_t w) const -> size_t
- queries the adjusted chunk size
Function documentation
size_t tf:: StaticPartitioner:: adjusted_chunk_size(size_t N,
size_t W,
size_t w) const
queries the adjusted chunk size
Returns the given chunk size if it is not zero, or returns N/W + (w < NW)
, where N
is the number of iterations, W
is the number of workers, and w
is the worker ID.