class to create a guided partitioner for scheduling parallel algorithms More...
#include <taskflow/algorithm/partitioner.hpp>
Public Member Functions | |
| GuidedPartitioner ()=default | |
| default constructor | |
| GuidedPartitioner (size_t sz) | |
| construct a guided partitioner with the given chunk size | |
| GuidedPartitioner (size_t sz, C &&closure) | |
| construct a guided partitioner with the given chunk size and the closure | |
Public Member Functions inherited from tf::PartitionerBase< DefaultClosureWrapper > | |
| PartitionerBase ()=default | |
| default constructor | |
| PartitionerBase (size_t chunk_size) | |
| construct a partitioner with the given chunk size | |
| PartitionerBase (size_t chunk_size, DefaultClosureWrapper &&closure_wrapper) | |
| construct a partitioner with the given chunk size and closure wrapper | |
| size_t | chunk_size () const |
| query the chunk size of this partitioner | |
| void | chunk_size (size_t cz) |
| update the chunk size of this partitioner | |
| const DefaultClosureWrapper & | closure_wrapper () const |
| acquire an immutable access to the closure wrapper object | |
| DefaultClosureWrapper & | closure_wrapper () |
| acquire a mutable access to the closure wrapper object | |
| void | closure_wrapper (F &&fn) |
| modify the closure wrapper object | |
| TF_FORCE_INLINE decltype(auto) | operator() (F &&callable) |
| wraps the given callable with the associated closure wrapper | |
Static Public Member Functions | |
| static constexpr PartitionerType | type () |
| queries the partition type (dynamic) | |
Additional Inherited Members | |
Public Types inherited from tf::PartitionerBase< DefaultClosureWrapper > | |
| using | closure_wrapper_type |
| the closure type | |
Static Public Attributes inherited from tf::PartitionerBase< DefaultClosureWrapper > | |
| static constexpr bool | is_default_wrapper_v |
| indicating if the given closure wrapper is a default wrapper (i.e., empty) | |
Protected Attributes inherited from tf::PartitionerBase< DefaultClosureWrapper > | |
| size_t | _chunk_size |
| chunk size | |
| DefaultClosureWrapper | _closure_wrapper |
| closure wrapper | |
class to create a guided partitioner for scheduling parallel algorithms
| C | closure wrapper type (default tf::DefaultClosureWrapper) |
The size of a partition is proportional to the number of unassigned iterations divided by the number of workers, and the size will gradually decrease to the given chunk size. The last partition may be smaller than the chunk size.
In addition to partition size, the application can specify a closure wrapper for a guided partitioner. A closure wrapper allows the application to wrap a partitioned task (i.e., closure) with a custom function object that performs additional tasks. For example: