# static_partitioner¶

[algorithms.static_partitioner]

Specify that a parallel algorithm should distribute the work uniformly across threads and should not do additional load balancing.

An algorithm with a static_partitioner distributes the range across threads in subranges of approximately equal size. The number of subranges is equal to the number of threads that can possibly participate in task execution, as specified by global_contol or task_arena classes. These subranges are not further split.

Caution

The regularity of subrange sizes is not guaranteed if the range type does not support proportional splitting, or if the grain size is set larger than the size of the range divided by the number of threads participating in task execution.

In addition, static_partitioner uses a deterministic task affinity pattern to hint the task scheduler how the subranges should be assigned to threads.

The static_partitioner class satisfies the CopyConstructibe requirement from ISO C++ [utility.arg.requirements] section.

Tip

Use of static_partitioner is recommended for:

• Porting OpenMP* parallel loops with schedule(static) if deterministic work partitioning across threads is important.

// Defined in header <tbb/partitioner.h>

namespace tbb {

class static_partitioner {
public:
static_partitioner() = default;
~static_partitioner() = default;
};

}