21#ifndef UTILS_MPI_DETAIL_SIZE_AND_OFFSET_HPP
22#define UTILS_MPI_DETAIL_SIZE_AND_OFFSET_HPP
28#include <boost/mpi/collectives.hpp>
29#include <boost/mpi/communicator.hpp>
36int size_and_offset(std::vector<int> &sizes, std::vector<int> &displ,
37 int n_elem,
const boost::mpi::communicator &comm,
39 auto const world_size =
static_cast<unsigned int>(comm.size());
40 sizes.resize(world_size);
41 displ.resize(world_size);
44 boost::mpi::gather(comm, n_elem, sizes, root);
46 auto const total_size = std::accumulate(sizes.begin(), sizes.end(), 0);
49 for (
unsigned int i = 0; i < sizes.size(); i++) {
57inline void size_and_offset(
int n_elem,
const boost::mpi::communicator &comm,
60 boost::mpi::gather(comm, n_elem, root);