【发布时间】:2015-08-20 03:34:29
【问题描述】:
我正在尝试使用 boost 库向进程发送一些 MPI 消息。但是,接收方无法正确接收它们。接收者只得到 NULL,而不是真正的消息。我的代码在这里:
// Receiver side, rank = 0
boost::mpi::communicator* world
// initialization of the world, etc...
map<int, string> messageMap;
map<int, boost::mpi::request> requestMap;
for(int j=1; j<world->size(); j++){
requestMap[j] = world->irecv(j, 0, messageMap[j]);
}
for(typename map<int, boost::mpi::request>::iterator it = requestMap.begin(); it != requestMap.end(); it++){
it->second.wait();
cout << "Received message from " << j << " is: " << messageMap[j] << endl;
}
// Sender side, ranks = 1, 2 and 3
boost::mpi::communicator* world
// initialization of the world, etc...
world->isend(0, 0, "1");
现在,问题是接收器的输出类似于:
Received message from 1 is: NULNUL
Received message from 2 is: NULNUL
Received message from 3 is: NULNUL
我不知道问题出在哪里。
【问题讨论】: