28#include <boost/mpi/collectives/gather.hpp>
29#include <boost/mpi/communicator.hpp>
31namespace Utils::Mpi::detail {
34int size_and_offset(std::vector<int> &sizes, std::vector<int> &displ,
35 int n_elem,
const boost::mpi::communicator &comm,
37 auto const world_size =
static_cast<unsigned int>(comm.size());
38 sizes.resize(world_size);
39 displ.resize(world_size);
42 boost::mpi::gather(comm, n_elem, sizes, root);
44 auto const total_size = std::accumulate(sizes.begin(), sizes.end(), 0);
47 for (std::size_t i = 0; i < sizes.size(); i++) {
55inline void size_and_offset(
int n_elem,
const boost::mpi::communicator &comm,
58 boost::mpi::gather(comm, n_elem, root);