Open CASCADE Technology
7.3.0
|
Simple tool for code parallelization. More...
#include <OSD_Parallel.hxx>
Data Structures | |
class | FunctorInterface |
Interface class representing functor object. Intended to add polymorphic behavour to For and ForEach functionality enabling execution of arbitrary function in parallel mode. More... | |
class | UniversalIterator |
Fixed-type iterator, implementing STL forward iterator interface, used for iteration over objects subject to parallel processing. It stores pointer to instance of polymorphic iterator inheriting from IteratorInterface, which contains actual type-specific iterator. More... | |
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, equivalent to: 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, equivalent to: More... | |
Simple tool for code parallelization.
OSD_Parallel class provides simple interface for parallel processing of tasks that can be formulated in terms of "for" or "foreach" loops.
To use this tool it is necessary to:
Iterators should satisfy requirements of STL forward iterator. Functor
The operator () should be implemented in a thread-safe way so that the same functor object can process different data items in parallel threads.
Iteration by index (For) is expected to be more efficient than using iterators (ForEach).
Implementation uses TBB if OCCT is built with support of TBB; otherwise it uses ad-hoc parallelization tool. In general, if TBB is available, it is more efficient to use it directly instead of using OSD_Parallel.
|
inlinestatic |
Simple primitive for parallelization of "for" loops, equivalent to:
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 |
|
inlinestatic |
Simple primitive for parallelization of "foreach" loops, equivalent to:
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.