I wonder if there is a way to know the receiver process, the sender process and tag values of an MPI communication in boost.
Now, I have some processes which send/receive a lot of messages to/from each other. And, I have a collection of boost::mpi::request in the receiver side. This collection stores the request items that have been received. After the communication operations are completed, can I extract who the receiver process and the sender process are, from this collection? (I also need to know the tag value.) Or, should I change my strategy? Maybe having a collection of requests does not make sense?
That information is in the status after the request is completed, not in the request itself.
#include <boost/mpi.hpp>
#include <iostream>
#include <string>
#include <boost/serialization/string.hpp>
namespace mpi = boost::mpi;
int main()
{
mpi::environment env;
mpi::communicator world;
if (world.rank() == 0) {
std::string msg, out_msg = "Hello from rank 0.";
world.send(1, 17, out_msg);
} else {
mpi::request req[1];
mpi::status stat[1];
std::string rmsg;
req[0] = world.irecv(mpi::any_source, mpi::any_tag, rmsg);
mpi::wait_all(req, req + 1, stat);
std::cout << "Got " << rmsg << std::endl;
std::cout << "From " << stat[0].source() << std::endl;
std::cout << "Tagged " << stat[0].tag() << std::endl;
}
return 0;
}