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

Deterministic implementation of ParallelFor. More...

Collaboration diagram for Arcane::TBBDeterministicParallelFor:

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

Private Attributes

TBBTaskImplementationm_impl
const TBBParallelForm_tbb_for
Integer m_nb_thread
Integer m_begin_index
Integer m_size
Integer m_grain_size
Integer m_nb_block
Integer m_block_size
Integer m_nb_block_per_thread

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.

Member Data Documentation

◆ m_begin_index

Integer Arcane::TBBDeterministicParallelFor::m_begin_index
private

Definition at line 873 of file TBBTaskImplementation.cc.

◆ m_block_size

Integer Arcane::TBBDeterministicParallelFor::m_block_size
private

Definition at line 877 of file TBBTaskImplementation.cc.

◆ m_grain_size

Integer Arcane::TBBDeterministicParallelFor::m_grain_size
private

Definition at line 875 of file TBBTaskImplementation.cc.

◆ m_impl

TBBTaskImplementation* Arcane::TBBDeterministicParallelFor::m_impl
private

Definition at line 870 of file TBBTaskImplementation.cc.

◆ m_nb_block

Integer Arcane::TBBDeterministicParallelFor::m_nb_block
private

Definition at line 876 of file TBBTaskImplementation.cc.

◆ m_nb_block_per_thread

Integer Arcane::TBBDeterministicParallelFor::m_nb_block_per_thread
private

Definition at line 878 of file TBBTaskImplementation.cc.

◆ m_nb_thread

Integer Arcane::TBBDeterministicParallelFor::m_nb_thread
private

Definition at line 872 of file TBBTaskImplementation.cc.

◆ m_size

Integer Arcane::TBBDeterministicParallelFor::m_size
private

Definition at line 874 of file TBBTaskImplementation.cc.

◆ m_tbb_for

const TBBParallelFor& Arcane::TBBDeterministicParallelFor::m_tbb_for
private

Definition at line 871 of file TBBTaskImplementation.cc.


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