#
#include <taskflow/algorithm/partitioner.hpp>
template<typename C = DefaultClosureWrapper>
tf::RandomPartitioner class

class to construct a random partitioner for scheduling parallel algorithms

Template parameters
C | closure wrapper type (default tf::DefaultClosureWrapper)

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 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::RandomPartitioner(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

RandomPartitioner() defaulted
  default constructor
RandomPartitioner(size_t sz) explicit
  construct a dynamic partitioner with the given chunk size
RandomPartitioner(size_t sz, C&& closure) explicit
  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

## Public functions

auto alpha() const -> float
  queries the `alpha` value
auto beta() const -> float
  queries the `beta` value
auto chunk_size_range(size_t N, size_t W) const -> std::pair<size_t, size_t>
  queries the range of chunk size

## Function documentation

###
template<typename C>
std::pair<size_t, size_t> tf::RandomPartitioner<C>::chunk_size_range(size_t N, size_t W) const

queries the range of chunk size

Parameters
N | number of iterations
W | number of workers

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.