Open CASCADE Technology
7.2.0
|
Simplifies code parallelization. More...
#include <OSD_Parallel.hxx>
Static Public Member Functions | |
public methods | |
static Standard_Integer | NbLogicalProcessors () |
Returns number of logical proccesrs. More... | |
template<typename InputIterator , typename Functor > | |
static void | ForEach (InputIterator theBegin, InputIterator theEnd, const Functor &theFunctor, const Standard_Boolean isForceSingleThreadExecution=Standard_False) |
Simple primitive for parallelization of "foreach" loops, e.g.: More... | |
template<typename Functor > | |
static void | For (const Standard_Integer theBegin, const Standard_Integer theEnd, const Functor &theFunctor, const Standard_Boolean isForceSingleThreadExecution=Standard_False) |
Simple primitive for parallelization of "for" loops, e.g.: More... | |
Simplifies code parallelization.
The Class provides an interface of parallel processing "for" and "foreach" loops. These primitives encapsulates complete logic for creating and managing parallel context of loops. Moreover the primitives may be a wrapper for some primitives from 3rd-party library - TBB. To use it is necessary to implement TBB like interface which is based on functors.
In the body of the operator () should be implemented thread-safe logic of computations that can be performed in parallel context. If parallelized loop iterates on the collections with direct access by index (such as Vector, Array), it is more efficient to use the primitive ParallelFor (because it has no critical section).
|
static |
Simple primitive for parallelization of "for" loops, e.g.:
theBegin | the first index (incusive) |
theEnd | the last index (exclusive) |
theFunctor | functor providing an interface "void operator(int theIndex){}" performing task for specified index |
isForceSingleThreadExecution | if true, then no threads will be created |
|
static |
Simple primitive for parallelization of "foreach" loops, e.g.:
theBegin | the first index (incusive) |
theEnd | the last index (exclusive) |
theFunctor | functor providing an interface "void operator(InputIterator theIter){}" performing task for specified iterator position |
isForceSingleThreadExecution | if true, then no threads will be created |
|
static |
Returns number of logical proccesrs.