Hi,
first of all sorry that I write a new thread. I already wrote a messge about "Problem with the receive buffer size?". But I had some problems with my email-provider and the mailinglist. (I do not often use mailing lists).
Here is the link to my old Message: http://www.open-mpi.org/community/lists/users/2010/09/14181.php
I wrote a short programm that show my problem. (The coding ist very ugly. sorry). It send a serialized object(this time a very simple) as a string to the other process.
The problem is that it never gets return of the wait-operation when I using a more data.
If you set the countR to 996 it waits forever. With 995 it works.
Can anyone help me?
Thanks!!!
(used library: boost_serialization)
#include <mpi.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <queue>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/deque.hpp>
#define countS 1
#define countR 996
class expObj{
public:
friend class boost::serialization::access;
char array[countS][countR];
template<class Archive>
void serialize(Archive & ar, const unsigned int version){
ar & array;
}
expObj(){
for (int i = 0; i < countS; i++) {
for (int j = 0; j < countR; j++) {
array[i][j] = 'q';
}
}
}
};
int main(int argc, char* argv[])
{
MPI_Init(&argc, &argv);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
MPI_Request request_bilder_token_ro_multi;
std::deque<expObj> senden;
expObj bild1;
bild1.array[0][0] = 'a';
senden.push_back(bild1);
std::ostringstream archive_stream1;
boost::archive::text_oarchive archive(archive_stream1);
archive << senden;
std::string outbound_data_ = archive_stream1.str();
std::cout << "Send - Size of message: " << outbound_data_.size() << std::endl;
MPI_Issend(&outbound_data_[0], static_cast<int>(outbound_data_.size()), MPI_CHAR, 1, 0, MPI_COMM_WORLD,&request_bilder_token_ro_multi);
while(true){
1/1;
}
}
else if (rank == 1) {
MPI_Request req;
MPI_Status stat;
int flag = 0; //
int msglen = 1;
std::deque<expObj> receive;
expObj obj;
std::string serString;
do {
MPI_Iprobe(0, 0, MPI_COMM_WORLD, &flag, &stat);
} while (!flag);
MPI_Get_count(&stat, MPI_CHAR, &msglen);
std::cout <<"Received size: "<< msglen <<std::endl;
serString.clear();
serString.resize(msglen,'a');
MPI_Irecv(&serString[0], msglen, MPI_CHAR, 0, 0, MPI_COMM_WORLD, &req);
MPI_Wait(&req,&stat);
/*do{
MPI_Test(&req,&flag,&stat);
}while(flag == 0);*/
std::cout << "Receive: <" << serString <<">"<< std::endl;
}
std::cout << "Rank 1 OK!" << std::endl;
MPI_Finalize();
return 0;
}
|