18 MPI_Comm_size(commun, &nproc);
19 MPI_Comm_rank(commun, &mpi_rank);
20 std::vector<int> chunks(nproc), displs(nproc);
21 for (
int i = 0; i < nproc; i++) {
22 displs[i] = distr.
range(i).first;
23 chunks[i] = distr.
range(i).second - distr.
range(i).first;
25 MPI_Allgatherv(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, first_elem, chunks.data(), displs.data(), MPI_DOUBLE, commun);
std::pair< index_type, index_type > range(int chunk) const
Returns [fist, end) indices for section of array assigned to chunk.
Definition Distribution.h:64
void gather_all(const Distribution< size_t > &distr, MPI_Comm commun, double *first_elem)
Replicate data of a full container on all the processes based on distributed pieces.
Definition gather_all.h:16