Thanks for your tip.
No I did not use mpi_wait. Because when I use it it waits forever. I wrote some example that show this behavior.
Sorry for the ugly coding. But it should show my problem.


When using countR-variable with 800 it works. But when I use 1000 it waits forever...



#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 1000


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;

}