Ticket #12828: ipanic.cpp

File ipanic.cpp, 496 bytes (added by anonymous, 6 years ago)
Line 
1#include <boost/mpi.hpp>
2#include <chrono>
3#include <string>
4
5namespace mpi = boost::mpi;
6
7int main()
8{
9 mpi::environment env;
10 mpi::communicator world;
11
12 if (world.rank() == 0) {
13 std::string msgs[2] = {"Hello", "World"};
14 world.send(1, 0, msgs[0]);
15 world.send(1, 0, msgs[1]);
16 } else {
17 mpi::request reqs[2];
18 std::string msgs[2];
19 reqs[0] = world.irecv(0, 0, msgs[0]);
20 reqs[1] = world.irecv(0, 0, msgs[1]);
21 mpi::wait_all(std::begin(reqs), std::end(reqs));
22 }
23}