#include <MultiHybridParallel.hpp>
Public Member Functions | |
~MultiHybridParallel () | |
void | call (size_t maxIndex, std::function< void(size_t firstIndex, size_t numIndices)> target) override |
![]() | |
virtual | ~Parallel () |
virtual void | call (size_t maxIndex, std::function< void(size_t firstIndex, size_t numIndices)> target)=0 |
Private Member Functions | |
MultiHybridParallel (int threadCount) | |
bool | doSomeWork () override |
Private Attributes | |
ChunkMaker | _chunkMaker |
std::condition_variable | _conditionChildren |
std::condition_variable | _conditionParent |
bool | _done |
size_t | _firstIndex |
std::mutex | _mutex |
size_t | _numIndices |
bool | _ready |
int | _requests |
std::function< void(size_t, size_t)> | _target |
Friends | |
class | ParallelFactory |
Additional Inherited Members | |
![]() | |
void | activateThreads () |
void | constructThreads (int numThreads) |
void | destroyThreads () |
int | numThreads () |
void | waitForThreads () |
![]() | |
Parallel () | |
This class implements the Parallel base class interface using multiple threads in each of multiple processes. In each process, the actual work is performed in child threads created for that purpose, while the parent thread is used for communication among the processes (the MPI functions should be called only from the main thread). In the root process, the parent thread serves chunks of work to the other processes. In the non-root processes, the parent thread requests chunks from the root process for all of the local parallel threads. The extra thread in each process is not counted towards the number of threads specified by the user because the communication does not consume significant resources.
This class uses the facilities offered by the MultiParallel base class.
|
explicitprivate |
Constructs a HybridParallel instance using the specified number of execution threads. The number of processes is retrieved from the ProcessManager. In each process, the specified number of child threads is created (and put on hold) so that the parent thread can be used to communicate with the other processes. This constructor is private; use the ParallelFactory::parallel() function instead.
MultiHybridParallel::~MultiHybridParallel | ( | ) |
Destructs the instance and its parallel child threads.
|
overridevirtual |
|
overrideprivatevirtual |
The function to do the actual work, one chunk at a time.
Implements MultiParallel.