Actually the 'B' in MPI_Bsend() specifies that it is a blocking *buffered* 
send.  So if I remember my standards correctly, this call requires:

1) you will have to explicitly manage the send buffers via 
MPI_Buffer_[attach|detach](), and

2) the send will block until a corresponding receive is posted.

The MPI_Ibsend() is the immediate version of the above and will return w/o the 
requirement for the corresponding received.  Since it is a buffered send the 
local data copy should be completed before it returns, allowing you to change 
the contents of the local data buffer.  But there is no guaranty that the 
message has been send, so you should not reuse the send buffer until after 
verifying the completion of the send via MPI_Wait() or similar.

In your example, since MPI_Test() won't block, you can have a problem.  Use 
MPI_Wait() instead or change your send buffer to one that is not being used.

-bill



-----Original Message-----
From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org] On Behalf 
Of Jovana Knezevic
Sent: Thursday, May 06, 2010 4:44 AM
To: us...@open-mpi.org
Subject: [OMPI users] MPI_Bsend vs. MPI_Ibsend

Dear all,

Could anyone please clarify me the difference between MPI_Bsend and
MPI_Ibsend? Or, in other words, what exactly is "blocking" in
MPI_Bsend, when the data is stored in the buffer and we "return"? :-)
Another, but similar, question:

What about the data-buffer - when can it be reused in each of the
cases - simple examples:

for (i=0; i<NUMBER_OF_SLAVES; i++) {

MPI_Bsend (&data_buffer[0], ..., slave_id1...);

}  // Can any problem occur here, since we send the data_buffer several times?

for (i=0; i<NUMBER_OF_SLAVES; i++) {

MPI_Ibsend (&data_buffer[0], ..., slave[i]..., &request);
MPI_Test(&request...)

}  // Any difference to previous example? Concerning the re-use of data_buffer?

Thank you a lot in advance.

Regards
Jovana
_______________________________________________
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users


Reply via email to