![]() |
Hex
1.0
Hydrogen-electron collision solver
|
MPI info. More...
#include <parallel.h>
Public Member Functions | |
Parallel (int *argc, char ***argv, bool active) | |
Constructor. More... | |
~Parallel () | |
bool | IamMaster () const |
Returns true if this process is the master process. More... | |
bool | isMyWork (int i) const |
Returns true if the work item is assigned to this process. More... | |
bool | active () const |
Returns true if the MPI is active. More... | |
int | iproc () const |
Returns the rank of the communicator (process is). More... | |
int | Nproc () const |
Returns the size of the communicator (process count). More... | |
template<class T > | |
void | sync (ArrayView< T > array, size_t chunksize, size_t Nchunk) const |
Synchronize across processes. More... | |
void | wait () const |
Wait for completition of all running tasks. More... | |
The class Parallel holds some useful MPI data, like the rank and size of the communicator. This class should be used for all parallel communication using MPI.
|
inline |
|
inline |
|
inline |
|
inline |
This function returns true if this process is the master process, i.e. it has ID zero.
|
inline |
|
inline |
If there are several work items, i-th one is assigned to the (i % Nproc_)-th process. This function returns true whenever given wirk item (indexed by "i") is to be processed by the current process.
i | Work item ID. |
|
inline |
|
inline |
Synchronize array across processes. It is assumed that i-th chunk of the array is present on the (i % Nproc_)-th process. That process will be used as the broadcast root. This behaviour is compatible with the member function isMyWork.
array | Array to synchronize, |
chunksize | Size of the per-process segment. |
Nchunk | Total number of chunks in the array. Altogether chunksize*Nchunk elements will be synchronized. If there are some elements more, they will be left untouched (and un-broadcast). |
|
inline |
Inserts a MPI BARRIER.