|
|
| RandomPartitioner ()=default |
| | default constructor
|
| |
|
| RandomPartitioner (size_t sz) |
| | construct a dynamic partitioner with the given chunk size
|
| |
|
| RandomPartitioner (size_t sz, C &&closure) |
| | construct a random partitioner with the given chunk size and the closure
|
| |
|
| RandomPartitioner (float alpha, float beta) |
| | constructs a random partitioner with the given parameters
|
| |
|
| RandomPartitioner (float alpha, float beta, C &&closure) |
| | constructs a random partitioner with the given parameters and the closure
|
| |
|
float | alpha () const |
| | queries the alpha value
|
| |
|
float | beta () const |
| | queries the beta value
|
| |
| std::pair< size_t, size_t > | chunk_size_range (size_t N, size_t W) const |
| | queries the range of chunk size
|
| |
|
| 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
|
| |
template<typename C = DefaultClosureWrapper>
class tf::RandomPartitioner< C >
class to construct a random partitioner for scheduling parallel algorithms
- Template Parameters
-
Similar to tf::DynamicPartitioner, the partitioner splits iterations into many partitions but each with a random chunk size in the range, c = [alpha * N * W, beta * N * W]. By default, alpha is 0.01 and beta is 0.5, respectively.
In addition to partition size, the application can specify a closure wrapper for a random 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;
[](){
printf("%d\n", i);
},
closure();
}
);
executor.run(taskflow).wait();
Task for_each_index(B first, E last, S step, C callable, P part=P())
constructs an index-based parallel-for task
class to construct a random partitioner for scheduling parallel algorithms
Definition partitioner.hpp:671
class to create a taskflow object
Definition taskflow.hpp:64