Specify that a parallel loop should optimize its range subdivision based on work-stealing events.
#include "tbb/partitioner.h"
class auto_partitioner;
A loop template with an auto_partitioner attempts to minimize range splitting while providing ample opportunities for work-stealing.
The range subdivision is initially limited to S subranges, where S is proportional to the number of threads specified by the task_scheduler_init. Each of these subranges is not divided further unless it is stolen by an idle thread. If stolen, it is further subdivided to create additional subranges. Thus a loop template with an auto_partitioner creates additional subranges only when necessary to balance load.
When using auto_partitioner and a blocked_range for a parallel loop, the body may be passed a subrange larger than the blocked_range's grainsize. Therefore do not assume that the grainsize is an upper bound on the size of the subrange. Use a simple_partitioner if an upper bound is required.
namespace tbb {
class auto_partitioner {
public:
auto_partitioner();
~auto_partitioner();
}
}
| Member | Description |
|---|---|
| auto_partitioner() |
Construct an auto_partitioner. |
| ~auto_partitioner() |
Destroy this auto_partitioner. |