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 or task_arena. 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 receive a subrange larger than the grain size of the blocked_range. Therefore do not assume that the grain size is an upper bound on the size of a subrange. Use 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. |