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 |
Private Attributes | |
| TBBTaskImplementation * | m_impl |
| const TBBParallelFor & | m_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 |
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:
Definition at line 800 of file TBBTaskImplementation.cc.
|
inline |
Definition at line 804 of file TBBTaskImplementation.cc.
|
inline |
Definition at line 869 of file TBBTaskImplementation.cc.
|
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 856 of file TBBTaskImplementation.cc.
|
private |
Definition at line 900 of file TBBTaskImplementation.cc.
|
private |
Definition at line 904 of file TBBTaskImplementation.cc.
|
private |
Definition at line 902 of file TBBTaskImplementation.cc.
|
private |
Definition at line 897 of file TBBTaskImplementation.cc.
|
private |
Definition at line 903 of file TBBTaskImplementation.cc.
|
private |
Definition at line 905 of file TBBTaskImplementation.cc.
|
private |
Definition at line 899 of file TBBTaskImplementation.cc.
|
private |
Definition at line 901 of file TBBTaskImplementation.cc.
|
private |
Definition at line 898 of file TBBTaskImplementation.cc.