Execution options for a parallel loop in multi-threading. More...
Public Types | |
| enum class | Partitioner { Auto = 0 , Static = 1 , Deterministic = 2 } |
| Partitioner type. More... | |
Public Member Functions | |
| Int32 | maxThread () const |
| Maximum number of allowed threads. | |
| void | setMaxThread (Integer v) |
| Sets the maximum number of allowed threads. | |
| bool | hasMaxThread () const |
| Indicates if maxThread() is set. | |
| Integer | grainSize () const |
| Size of an iteration interval. | |
| void | setGrainSize (Integer v) |
| Sets the size (approximate) of an iteration interval. | |
| bool | hasGrainSize () const |
| Indicates if grainSize() is set. | |
| Partitioner | partitioner () const |
| Partitioner type. | |
| void | setPartitioner (Partitioner v) |
| Sets the partitioner type. | |
| bool | hasPartitioner () const |
| Indicates if grainSize() is set. | |
| void | mergeUnsetValues (const ParallelLoopOptions &po) |
| Merges the unmodified values of the instance with those of po. | |
Private Types | |
| enum | SetFlags { SF_MaxThread = 1 , SF_GrainSize = 2 , SF_Partitioner = 4 } |
| Flag to indicate which fields have been set. More... | |
Private Attributes | |
| Int32 | m_grain_size = 0 |
| Size of a loop block. | |
| Int32 | m_max_thread = -1 |
| Partitioner type. | |
| Partitioner | m_partitioner = Partitioner::Auto |
| unsigned int | m_flags = 0 |
Execution options for a parallel loop in multi-threading.
This class allows specifying execution parameters for a parallel loop.
Definition at line 34 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
|
strong |
Partitioner type.
| Enumerator | |
|---|---|
| Auto | Leaves the partitioner to manage partitioning and scheduling (default). |
| Static | Uses static partitioning. In this mode, grainSize() is not used, and partitioning depends only on the number of threads and the iteration interval. Note that the scheduling remains dynamic, so it is not necessarily the same thread that will execute the same iteration block. |
| Deterministic | Uses static partitioning and scheduling. This mode is similar to Partitioner::Static, but the scheduling is deterministic for task assignment: the value returned by TaskFactory::currentTaskIndex() is deterministic.
|
Definition at line 49 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
|
private |
Flag to indicate which fields have been set.
Definition at line 39 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
|
inline |
Definition at line 77 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
|
inline |
Size of an iteration interval.
Definition at line 103 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
References m_grain_size.
Referenced by Arcane::TBBTaskImplementation::_executeMDParallelFor(), Arcane::Accelerator::Impl::RunCommandLaunchInfo::computeParallelLoopOptions(), Arcane::Parallel::Foreach(), Arcane::Parallel::Foreach(), and mergeUnsetValues().
|
inline |
Indicates if grainSize() is set.
Definition at line 111 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
Referenced by mergeUnsetValues().
|
inline |
Indicates if maxThread() is set.
Definition at line 100 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
Referenced by mergeUnsetValues().
|
inline |
Indicates if grainSize() is set.
Definition at line 122 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
Referenced by mergeUnsetValues().
|
inline |
Maximum number of allowed threads.
Definition at line 87 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
References m_max_thread.
Referenced by Arcane::TBBTaskImplementation::_executeMDParallelFor(), Arcane::Accelerator::Impl::RunCommandLaunchInfo::computeParallelLoopOptions(), mergeUnsetValues(), and Arcane::Accelerator::WorkGroupLoopRangeBase< IsCooperativeLaunch, IndexType_ >::setBlockSize().
|
inline |
Merges the unmodified values of the instance with those of po.
Definition at line 127 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
References grainSize(), hasGrainSize(), hasMaxThread(), hasPartitioner(), maxThread(), partitioner(), setGrainSize(), setMaxThread(), and setPartitioner().
Referenced by Arcane::TBBTaskImplementation::_executeMDParallelFor().
|
inline |
Partitioner type.
Definition at line 114 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
Referenced by mergeUnsetValues().
|
inline |
Sets the size (approximate) of an iteration interval.
Definition at line 105 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
References m_grain_size.
Referenced by Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::Accelerator::Impl::RunCommandLaunchInfo::computeParallelLoopOptions(), Arcane::Accelerator::Impl::MultiThreadAlgo::doScan(), Arcane::TBBTaskImplementation::executeParallelFor(), Arcane::Parallel::Foreach(), Arcane::Parallel::Foreach(), mergeUnsetValues(), and Arcane::Accelerator::WorkGroupLoopRangeBase< IsCooperativeLaunch, IndexType_ >::setBlockSize().
|
inline |
Sets the maximum number of allowed threads.
If v is 0 or 1, the execution will be sequential. If v is greater than ConcurrencyBase::maxAllowedThread(), the latter value will be used.
Definition at line 94 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
References m_max_thread.
Referenced by Arcane::TBBTaskImplementation::initialize(), and mergeUnsetValues().
|
inline |
Sets the partitioner type.
Definition at line 116 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
Referenced by mergeUnsetValues().
|
private |
Definition at line 146 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
|
private |
Size of a loop block.
Maximum number of threads for the loop
Definition at line 140 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
Referenced by grainSize(), and setGrainSize().
|
private |
Partitioner type.
Definition at line 142 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.
Referenced by maxThread(), and setMaxThread().
|
private |
Definition at line 144 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.