Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

ParallelSorter< T > Class Template Reference

Inheritance diagram for ParallelSorter< T >:
ParallelTask Task NamedObject CallBacker

List of all members.

Public Member Functions

 ParallelSorter (T *vals, int sz)

Protected Member Functions

od_int64 nrIterations () const
int minThreadSize () const
bool doPrepare (int)
bool doFinish (bool)
bool doWork (od_int64, od_int64, int)
od_int64 nrDone () const

Static Protected Member Functions

static bool mergeLists (const T *vals, T *res, int start0, int start1, int start2, int stop, int &totalsz)

Protected Attributes

T * vals_
ArrPtrMan< T > tmpbuffer_
T * curvals_
T * buf_
const int nrvals_
const int totalnr_
Threads::ConditionVar condvar_
TypeSet< int > starts_
TypeSet< int > newstarts_
Threads::Barrier barrier_

Detailed Description

template<class T>
class ParallelSorter< T >

Sorting in parallel. Code is still experimental. The basic principle is: 1. Divide samples into subsets. 2. Sort subsets in parallel 3. Merge pairs of subsets iteratively until there are only one subset left.


Constructor & Destructor Documentation

template<class T >
ParallelSorter< T >::ParallelSorter ( T *  vals,
int  sz 
) [inline]

Member Function Documentation

template<class T >
bool ParallelSorter< T >::doFinish ( bool  success  )  [inline, protected, virtual]

Reimplemented from ParallelTask.

template<class T >
bool ParallelSorter< T >::doPrepare ( int  nrthreads  )  [inline, protected, virtual]

Reimplemented from ParallelTask.

template<class T >
bool ParallelSorter< T >::doWork ( od_int64  start,
od_int64  stop,
int  thread 
) [inline, protected]
template<class T >
bool ParallelSorter< T >::mergeLists ( const T *  vals,
T *  res,
int  start0,
int  start1,
int  start2,
int  stop,
int &  totalsz 
) [inline, static, protected]
template<class T >
int ParallelSorter< T >::minThreadSize (  )  const [inline, protected, virtual]

Reimplemented from ParallelTask.

template<class T >
od_int64 ParallelSorter< T >::nrDone (  )  const [inline, protected, virtual]

Reimplemented from ParallelTask.

template<class T >
od_int64 ParallelSorter< T >::nrIterations (  )  const [inline, protected, virtual]

Implements ParallelTask.


Member Data Documentation

template<class T >
Threads::Barrier ParallelSorter< T >::barrier_ [protected]
template<class T >
T* ParallelSorter< T >::buf_ [protected]
template<class T >
Threads::ConditionVar ParallelSorter< T >::condvar_ [protected]
template<class T >
T* ParallelSorter< T >::curvals_ [protected]
template<class T >
TypeSet<int> ParallelSorter< T >::newstarts_ [protected]
template<class T >
const int ParallelSorter< T >::nrvals_ [protected]
template<class T >
TypeSet<int> ParallelSorter< T >::starts_ [protected]
template<class T >
ArrPtrMan<T> ParallelSorter< T >::tmpbuffer_ [protected]
template<class T >
const int ParallelSorter< T >::totalnr_ [protected]
template<class T >
T* ParallelSorter< T >::vals_ [protected]