Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::TBBDeterministicParallelFor Class Reference

Deterministic implementation of ParallelFor. More...

Public Member Functions

 TBBDeterministicParallelFor (TBBTaskImplementation *impl, const TBBParallelFor &tbb_for, Integer begin_index, Integer size, Integer grain_size, Integer nb_thread)
void operator() (tbb::blocked_range< Integer > &range) const
 Operator for a given thread.
void _doBlock (Integer task_id, Integer block_id) const

Detailed Description

Deterministic implementation of ParallelFor.

The implementation is deterministic in the sense that it only depends on the iteration interval (m_begin_index and m_size), the specified number of threads (m_nb_thread), and the grain size (m_grain_size).

The algorithm used is similar to the one used by OpenMP for a parallel for with the static option: the iteration interval is divided into several blocks and each block is assigned to a task based on a round-robin algorithm. To determine the number of blocks, two cases are possible:

  • if m_grain_size is not specified, the iteration interval is divided into a number of blocks equal to the number of threads used.
  • if m_grain_size is specified, the number of blocks will be equal to m_size divided by m_grain_size.

Definition at line 773 of file TBBTaskImplementation.cc.

Constructor & Destructor Documentation

◆ TBBDeterministicParallelFor()

Arcane::TBBDeterministicParallelFor::TBBDeterministicParallelFor ( TBBTaskImplementation * impl,
const TBBParallelFor & tbb_for,
Integer begin_index,
Integer size,
Integer grain_size,
Integer nb_thread )
inline

Definition at line 777 of file TBBTaskImplementation.cc.

Member Function Documentation

◆ _doBlock()

void Arcane::TBBDeterministicParallelFor::_doBlock ( Integer task_id,
Integer block_id ) const
inline

Definition at line 842 of file TBBTaskImplementation.cc.

◆ operator()()

void Arcane::TBBDeterministicParallelFor::operator() ( tbb::blocked_range< Integer > & range) const
inline

Operator for a given thread.

Generally, range.size() will be one, because a thread will only process one iteration, but this is not guaranteed by TBB.

Definition at line 829 of file TBBTaskImplementation.cc.


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