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 773 of file TBBTaskImplementation.cc.
|
inline |
Definition at line 777 of file TBBTaskImplementation.cc.
|
inline |
Definition at line 842 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 829 of file TBBTaskImplementation.cc.
|
private |
Definition at line 873 of file TBBTaskImplementation.cc.
|
private |
Definition at line 877 of file TBBTaskImplementation.cc.
|
private |
Definition at line 875 of file TBBTaskImplementation.cc.
|
private |
Definition at line 870 of file TBBTaskImplementation.cc.
|
private |
Definition at line 876 of file TBBTaskImplementation.cc.
|
private |
Definition at line 878 of file TBBTaskImplementation.cc.
|
private |
Definition at line 872 of file TBBTaskImplementation.cc.
|
private |
Definition at line 874 of file TBBTaskImplementation.cc.
|
private |
Definition at line 871 of file TBBTaskImplementation.cc.