docs/classtf_1_1DynamicPartitioner.html
| | Taskflow: A General-purpose Task-parallel Programming System |
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
tf::DynamicPartitioner< C > Class Template Reference
class to create a dynamic partitioner for scheduling parallel algorithms More...
#include <taskflow/algorithm/partitioner.hpp>
Inheritance diagram for tf::DynamicPartitioner< C >:
[Embedded content](classtf_1_1DynamicPartitioner inherit graph.svg)
[legend]
Collaboration diagram for tf::DynamicPartitioner< C >:
[Embedded content](classtf_1_1DynamicPartitioner coll graph.svg)
[legend]
|
|
| | DynamicPartitioner ()=default |
| | default constructor
|
| |
| | DynamicPartitioner (size_t sz) |
| | construct a dynamic partitioner with the given chunk size
|
| |
| | DynamicPartitioner (size_t sz, C &&closure) |
| | construct a dynamic 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 constexpr PartitionerType | type () |
| | queries the partition type (dynamic)
|
| |
|
|
| 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)
|
| |
template<typename C = DefaultClosureWrapper>
class tf::DynamicPartitioner< C >
class to create a dynamic partitioner for scheduling parallel algorithms
Template Parameters
| C | closure wrapper type (default tf::DefaultClosureWrapper) |
The partitioner splits iterations into many partitions each of size equal to the given chunk size. Different partitions are distributed dynamically to workers without any specific order.
In addition to partition size, the application can specify a closure wrapper for a dynamic 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:
std::atomic<int> count = 0;
tf::Taskflow taskflow;
taskflow.for_each_index(0, 100, 1,
printf("%d\n", i);
},
tf::DynamicPartitioner(0, [](auto&& closure){
// do something before invoking the partitioned task
// ...
// invoke the partitioned task
closure();
// do something else after invoking the partitioned task
// ...
}
);
executor.run(taskflow).wait();
class to create a dynamic partitioner for scheduling parallel algorithms
Definition partitioner.hpp:597
tf::FlowBuilder::for_each_index
Task for_each_index(B first, E last, S step, C callable, P part=P())
constructs an index-based parallel-for task
class to create a taskflow object
Definition taskflow.hpp:64
The documentation for this class was generated from the following file:
taskflow/algorithm/partitioner.hpp
Maintained by Dr. Tsung-Wei Huang — Generated by 1.13.1