HyperspaceExplorer 0.7.1
Namespaces | Functions
Multithreading Namespace Reference

Functions for multithreaded manipulation of data containers. More...

Namespaces

namespace  Private
 

Implementation details for multithreading.


Functions

template<class RandomAccessContainer , typename Function >
RandomAccessContainer mapped (const RandomAccessContainer &container, Function function)
template<class RandomAccessContainer , typename Function >
void partitionedMap (const RandomAccessContainer &container, RandomAccessContainer &output, Function function, unsigned tasks_per_processor=1)
 Run a function concurrently on every element of a random access container, writing every modified element of the container to another container.
template<class RandomAccessContainer , typename Function >
void partitionedMap (RandomAccessContainer &container, Function function, unsigned tasks_per_processor=1)
 Run a function concurrently on every element of a random access container, modifying every element of the container in place.
template<class RandomAccessContainer , typename Function >
RandomAccessContainer partitionedMapped (const RandomAccessContainer &container, Function function, unsigned tasks_per_processor=1)
 Run a function concurrently on every element of a random access container, collecting the results of each operation in another container and returning them.

Detailed Description

Functions for multithreaded manipulation of data containers.

The namespace Multithreading contains functions that run concurrently on a random access container using the minimum necessary number of threads (usually the number of processors available in the system).

Todo:
Also provide an abstraction layer for the threading model that is used to execute threads (currently only QThread and QtConcurrent, but C++11's std::thread is also feasible).

Function Documentation

template<class RandomAccessContainer , typename Function >
void Multithreading::partitionedMap ( const RandomAccessContainer &  container,
RandomAccessContainer &  output,
Function  function,
unsigned  tasks_per_processor = 1 
)

Run a function concurrently on every element of a random access container, writing every modified element of the container to another container.

The number of threads started is controlled by the parameter tasks_per_processor. The container is partitioned so that every thread works on as many elements are necessary so that tasks_per_processor threads are started per available processor.

Template Parameters:
RandomAccessContainerType of the container on which the operation is run. Must support operator[]().
FunctionType of the operation that is run on every element of the container. Either a function with the signature
 T function(const T &argument) 
or a functor class whose operator()() has that signature.
Parameters:
containerThe container on whose elements the Function is run.
outputThe result of the operation run on container.
functionThe Function that is called on every element of container.
tasks_per_processornumber of tasks that is started for every available processor or core.

Referenced by partitionedMap(), and partitionedMapped().

Here is the caller graph for this function:

template<class RandomAccessContainer , typename Function >
void Multithreading::partitionedMap ( RandomAccessContainer &  container,
Function  function,
unsigned  tasks_per_processor = 1 
)

Run a function concurrently on every element of a random access container, modifying every element of the container in place.

The number of threads started is controlled by the parameter tasks_per_processor. The container is partitioned so that every thread works on as many elements are necessary so that tasks_per_processor threads are started per available processor.

Template Parameters:
RandomAccessContainerType of the container on which the operation is run. Must support operator[]().
FunctionType of the operation that is run on every element of the container. Either a function with the signature
 T function(const T &argument) 
or a functor class whose operator()() has that signature.
Parameters:
containerThe container on whose elements the Function is run.
functionThe Function that is called on every element of container.
tasks_per_processornumber of tasks that is started for every available processor or core.

References partitionedMap().

Here is the call graph for this function:

template<class RandomAccessContainer , typename Function >
RandomAccessContainer Multithreading::partitionedMapped ( const RandomAccessContainer &  container,
Function  function,
unsigned  tasks_per_processor = 1 
)

Run a function concurrently on every element of a random access container, collecting the results of each operation in another container and returning them.

The number of threads started is controlled by the parameter tasks_per_processor. The container is partitioned so that every thread works on as many elements are necessary so that tasks_per_processor threads are started per available processor.

Template Parameters:
RandomAccessContainerType of the container on which the operation is run. Must support operator[]().
FunctionType of the operation that is run on every element of the container. Either a function with the signature
 T function(const T &argument) 
or a functor class whose operator()() has that signature.
Parameters:
containerThe container on whose elements the Function is run.
functionThe Function that is called on every element of container.
tasks_per_processornumber of tasks that is started for every available processor or core.
Returns:
The result of the operation run on container.

References partitionedMap().

Referenced by MultithreadedTransformation< N, 1, NUM >::transform().

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:19 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo