Hi Devendra MPI has no way of knowing how big your receive buffer is - that's why you have to pass the "count" argument, to tell MPI how many items of your data type (in your case many bytes) it may copy to your receive buffer.
When data arrives that is longer than the number you specified in the "count" argument, the data will be cut off after count bytes (and an error will be returned). Any shorter amount of data will be copied to your receive buffer and the call to MPI_Recv will terminate successfully. It is your responsibility to pass the correct value of "count". If you expect data of 160 bytes you have to allocate a buffer with a size greater or equal to 160 and you have to set your "count" parameter to the size you allocated. If you want to receive data in chunks, you have to send it in chunks. I hope this helps Jody On Tue, Aug 21, 2012 at 10:01 AM, devendra rai <rai.deven...@yahoo.co.uk> wrote: > Hello Jeff and Hristo, > > Now I am completely confused: > > So, let's say, the complete reception requires 8192 bytes. And, I have: > > MPI_Irecv( > (void*)this->receivebuffer,/* the receive buffer */ > this->receive_packetsize, /* 80 */ > MPI_BYTE, /* The data type > expected */ > this->transmittingnode, /* The node from which to > receive */ > this->uniquetag, /* Tag */ > MPI_COMM_WORLD, /* Communicator */ > &Irecv_request /* request handle */ > ); > > > That means, the the MPI_Test will tell me that the reception is complete > when I have received the first 80 bytes. Correct? > > Next, let[s say that I have a receive buffer with a capacity of 160 bytes, > then, will overflow error occur here? Even if I have decided to receive a > large payload in chunks of 80 bytes? > > I am sorry, the manual and the API reference was too vague for me. > > Thanks a lot > > Devendra > ________________________________ > From: "Iliev, Hristo" <il...@rz.rwth-aachen.de> > To: Open MPI Users <us...@open-mpi.org> > Cc: devendra rai <rai.deven...@yahoo.co.uk> > Sent: Tuesday, 21 August 2012, 9:48 > Subject: Re: [OMPI users] MPI_Irecv: Confusion with <<int count>> inputy > parameter > > Jeff, > >>> Or is it the number of elements that are expected to be received, and >>> hence MPI_Test will tell me that the receive is not complete untill "count" >>> number of elements have not been received? >> >> Yes. > > Answering "Yes" this question might further the confusion there. The "count" > argument specifies the *capacity* of the receive buffer and the receive > operation (blocking or not) will complete successfully for any matching > message with size up to "count", even for an empty message with 0 elements, > and will produce an overflow error if the received message was longer and > data truncation has to occur. > > On 20.08.2012, at 16:32, Jeff Squyres <jsquy...@cisco.com> wrote: > >> On Aug 20, 2012, at 5:51 AM, devendra rai wrote: >> >>> Is it the number of elements that have been received *thus far* in the >>> buffer? >> >> No. >> >>> Or is it the number of elements that are expected to be received, and >>> hence MPI_Test will tell me that the receive is not complete untill "count" >>> number of elements have not been received? >> >> Yes. >> >>> Here's the reason why I have a problem (and I think I may be completely >>> stupid here, I'd appreciate your patience): >> [snip] >>> Does anyone see what could be going wrong? >> >> Double check that the (sender_rank, tag, communicator) tuple that you >> issued in the MPI_Irecv matches the (rank, tag, communicator) tuple from the >> sender (tag and communicator are arguments on the sending side, and rank is >> the rank of the sender in that communicator). >> >> When receives block like this without completing like this, it usually >> means a mismatch between the tuples. >> >> -- >> Jeff Squyres >> jsquy...@cisco.com >> For corporate legal information go to: >> http://www.cisco.com/web/about/doing_business/legal/cri/ >> >> >> _______________________________________________ >> users mailing list >> us...@open-mpi.org >> http://www.open-mpi.org/mailman/listinfo.cgi/users > > -- > Hristo Iliev, Ph.D. -- High Performance Computing, > RWTH Aachen University, Center for Computing and Communication > Seffenter Weg 23, D 52074 Aachen (Germany) > Tel: +49 241 80 24367 -- Fax/UMS: +49 241 80 624367 > > > > > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users