Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Classes | Functions

Classes to support parallelization. More...

Collaboration diagram for Concurrency:


class  ForkJoinQueue< TaskType >
 Isomorphic fork-join multithreading (stack and queue). More...
class  ForkJoinStack< TaskType >
 Isomorphic fork-join multithreading (stack). More...
class  CtxForkJoinQueue< TaskType, Context >
 Isomorphic multithreading using thread-specific context. More...
class  LockedQueue< Item >
 Mutex-protected queue. More...
class  Logger
 Interface layer for monitoring long computations. More...
class  ParallelFilter
 Parallel filter. More...
class  Semaphore
 Two-level semaphore. More...
class  SpinBarrier
class  Mutex
 Mutex. More...
class  ScopedLock
 Scoped lock. More...
class  Condition
 Condition variable. More...
class  Barrier
 Reuseable counting barrier. More...
class  ThreadGroup
 Handles a group of threads (boost, C++98) More...
class  LockfreePool< Container >
 Lock-free task container. More...
class  WorkStack< TaskType >
 Last-in, first-out task stack. More...
class  FunctionQueue
 Simple task queue. More...
class  TaskScheduler
 Task-stealing thread pool. More...
class  TlsCounter
 Helper class for managing thread-local containers. More...


template<typename Iterator , typename Compare >
void parallel::sort (Iterator begin, Iterator end, const Compare &cmp)
 Parallel Quicksort.
template<typename Iterator , typename Functor >
void parallel::for_each (Iterator begin, Iterator end, Functor f)
 Parallel Foreach.
template<class RangeFunctor , typename IntegerType >
void parallel::block_loop (RangeFunctor &f, IntegerType begin, IntegerType end, IntegerType chunk=0)
 Parallel blocked loop. More...

Detailed Description

Classes to support parallelization.

This module defines task groups and queues which can be used to implement more advanced parallel algorithms which cannot be expressed as simple data-parallel loops.

Some of the contents of this module predate std::thread and are obsolete when C++ 2011 is available. They are still compiled into libgenua in order to support legacy code which still makes use of these features.

Note: If available, the Thread Building Blocks library does likely provide alternatives which are better tested and more flexible than this module.

Function Documentation

template<class RangeFunctor , typename IntegerType >
void parallel::block_loop ( RangeFunctor &  f,
IntegerType  begin,
IntegerType  end,
IntegerType  chunk = 0 

Parallel blocked loop.

This function template executes a functor which maps a blocked loop. In order to use this mechanism, define a data-parallel loop inside a function object (or lambda) of the following form:

* struct LoopFunction {
* void operator() (int a, int b) const {
*     for (int i=a; i<b; ++i)
*        work_on(i);
*   }
* };

Prefer this form over a plain loop or parallel::for_each whenever the work in a single iteration is too small to warrant creation of a task. The same mechanism is also used to implement plain data-parallel loops on platforms without OpenMP.