tf::DynamicPartitioner class | Taskflow QuickStart

#
template<typename C = DefaultClosureWrapper>
tf::DynamicPartitioner class

class to construct 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 wrapper 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();

## Base classes

template<typename C = DefaultClosureWrapper>
class PartitionerBase<DefaultClosureWrapper>
  class to derive a partitioner for scheduling parallel algorithms

## Public static functions

static auto type() -> PartitionerType constexpr
  queries the partition type (dynamic)

## Constructors, destructors, conversion operators

DynamicPartitioner() defaulted
  default constructor
DynamicPartitioner(size_t sz) explicit
  construct a dynamic partitioner with the given chunk size
DynamicPartitioner(size_t sz, C&& closure) explicit
  construct a dynamic partitioner with the given chunk size and the closure

Tab / T to search, Esc to close
…

Search for symbols, directories, files, pages or modules. You can omit any prefix from the symbol or file path; adding a `:` or `/` suffix lists all members of given symbol or directory.

Use ↓ / ↑ to navigate through the list, Enter to go. Tab autocompletes common prefix, you can copy a link to the result using ⌘ L while ⌘ M produces a Markdown link.

Sorry, nothing was found.