Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::ParallelLoopOptions Class Reference

Execution options for a parallel loop in multi-threading. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/base/arccore/base/ParallelLoopOptions.h>

Inheritance diagram for Arcane::ParallelLoopOptions:
Collaboration diagram for Arcane::ParallelLoopOptions:

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

Detailed Description

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.

Member Enumeration Documentation

◆ Partitioner

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.

Note
Currently, this partitioning mode is only available for 1D loop parallelization.

Definition at line 49 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.

◆ SetFlags

Flag to indicate which fields have been set.

Definition at line 39 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.

Constructor & Destructor Documentation

◆ ParallelLoopOptions()

Arcane::ParallelLoopOptions::ParallelLoopOptions ( )
inline

Member Function Documentation

◆ grainSize()

Integer Arcane::ParallelLoopOptions::grainSize ( ) const
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().

Here is the caller graph for this function:

◆ hasGrainSize()

bool Arcane::ParallelLoopOptions::hasGrainSize ( ) const
inline

Indicates if grainSize() is set.

Definition at line 111 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.

Referenced by mergeUnsetValues().

Here is the caller graph for this function:

◆ hasMaxThread()

bool Arcane::ParallelLoopOptions::hasMaxThread ( ) const
inline

Indicates if maxThread() is set.

Definition at line 100 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.

Referenced by mergeUnsetValues().

Here is the caller graph for this function:

◆ hasPartitioner()

bool Arcane::ParallelLoopOptions::hasPartitioner ( ) const
inline

Indicates if grainSize() is set.

Definition at line 122 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.

Referenced by mergeUnsetValues().

Here is the caller graph for this function:

◆ maxThread()

Int32 Arcane::ParallelLoopOptions::maxThread ( ) const
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().

Here is the caller graph for this function:

◆ mergeUnsetValues()

void Arcane::ParallelLoopOptions::mergeUnsetValues ( const ParallelLoopOptions & po)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ partitioner()

Partitioner Arcane::ParallelLoopOptions::partitioner ( ) const
inline

Partitioner type.

Definition at line 114 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.

Referenced by mergeUnsetValues().

Here is the caller graph for this function:

◆ setGrainSize()

void Arcane::ParallelLoopOptions::setGrainSize ( Integer v)
inline

◆ setMaxThread()

void Arcane::ParallelLoopOptions::setMaxThread ( Integer v)
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().

Here is the caller graph for this function:

◆ setPartitioner()

void Arcane::ParallelLoopOptions::setPartitioner ( Partitioner v)
inline

Sets the partitioner type.

Definition at line 116 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.

Referenced by mergeUnsetValues().

Here is the caller graph for this function:

Member Data Documentation

◆ m_flags

unsigned int Arcane::ParallelLoopOptions::m_flags = 0
private

◆ m_grain_size

Int32 Arcane::ParallelLoopOptions::m_grain_size = 0
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().

◆ m_max_thread

Int32 Arcane::ParallelLoopOptions::m_max_thread = -1
private

Partitioner type.

Definition at line 142 of file arccore/src/base/arccore/base/ParallelLoopOptions.h.

Referenced by maxThread(), and setMaxThread().

◆ m_partitioner

Partitioner Arcane::ParallelLoopOptions::m_partitioner = Partitioner::Auto
private

The documentation for this class was generated from the following file: