2
0
mirror of https://github.com/boostorg/mpi.git synced 2026-01-19 16:32:11 +00:00
Files
mpi/test/buf_size.cpp
Alain Miniussi 64d373dbfc Add test case from
Francesco Parisen Toldin
refs #122
2020-07-01 12:57:36 +02:00

36 lines
671 B
C++

#include <iostream>
#include <vector>
#include <boost/serialization/vector.hpp>
#include <boost/mpi/collectives.hpp>
struct huge {
std::vector<unsigned char> data;
huge() : data(2ull << 30ull, 0) { }
template <class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & data;
}
};
int main()
{
boost::mpi::environment env;
boost::mpi::communicator world;
huge a{};
std::cout << world.rank() << " huge created " << std::endl;
world.barrier();
if (world.rank() == 0) {
std::vector<huge> all;
boost::mpi::gather(world, a, all, 0);
} else {
boost::mpi::gather(world, a, 0);
}
return 0;
}