44 : active_(active), iproc_(0), Nproc_(1)
47 MPI_Init (argc, argv);
48 MPI_Comm_size (MPI_COMM_WORLD, &Nproc_);
49 MPI_Comm_rank (MPI_COMM_WORLD, &iproc_);
89 return i % Nproc_ == iproc_;
134 for (
unsigned ichunk = 0; ichunk < Nchunk; ichunk++)
138 array.
data() + ichunk * chunksize,
158 MPI_Barrier(MPI_COMM_WORLD);
Array view.
Definition: arrays.h:186
int iproc() const
Returns the rank of the communicator (process is).
Definition: parallel.h:103
bool active() const
Returns true if the MPI is active.
Definition: parallel.h:95
Parallel(int *argc, char ***argv, bool active)
Constructor.
Definition: parallel.h:43
bool isMyWork(int i) const
Returns true if the work item is assigned to this process.
Definition: parallel.h:87
void sync(ArrayView< T > array, size_t chunksize, size_t Nchunk) const
Synchronize across processes.
Definition: parallel.h:129
MPI info.
Definition: parallel.h:29
~Parallel()
Definition: parallel.h:55
void wait() const
Wait for completition of all running tasks.
Definition: parallel.h:154
virtual T * data()
Pointer to the data.
Definition: arrays.h:280
int Nproc() const
Returns the size of the communicator (process count).
Definition: parallel.h:111
bool IamMaster() const
Returns true if this process is the master process.
Definition: parallel.h:73