Bsend does not guarantee to use the attached buffer, Return from MPI_Ibsend
does not guarantee you can modify the application send buffer.

Maybe the implementation would try to optimize by scheduling a nonblocking
send from the apploication buffer that bypasses the copy to the attach
buffer. When you call WAIT, if the message had gone from the application
send buffer in the interim, the copy cost is saved.  If it has not, the
WAIT could copy into the attach buffer and let the send go from there what
the recv is posted.

I am not aware of an MPI that does this, but it would be a reasonable
optimization.

Dick Treumann  -  MPI Team
IBM Systems & Technology Group
Dept X2ZA / MS P963 -- 2455 South Road -- Poughkeepsie, NY 12601
Tele (845) 433-7846         Fax (845) 433-8363



|------------>
| From:      |
|------------>
  
>----------------------------------------------------------------------------------------------------------------------------------------|
  |Jovana Knezevic <jovana.knezevic...@gmail.com>                               
                                                           |
  
>----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  
>----------------------------------------------------------------------------------------------------------------------------------------|
  |us...@open-mpi.org                                                           
                                                           |
  
>----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  
>----------------------------------------------------------------------------------------------------------------------------------------|
  |05/06/2010 03:36 PM                                                          
                                                           |
  
>----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  
>----------------------------------------------------------------------------------------------------------------------------------------|
  |[OMPI users] MPI_Bsend vs. MPI_Ibsend (2)                                    
                                                           |
  
>----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Sent by:   |
|------------>
  
>----------------------------------------------------------------------------------------------------------------------------------------|
  |users-boun...@open-mpi.org                                                   
                                                           |
  
>----------------------------------------------------------------------------------------------------------------------------------------|





Thank you all!

Regarding the posted Recv, I am aware that neither send nor buffered
send tell the sender if it is posted.
Regarding the distinction between blocking and unblocking calls in
general, everything is clear as well.

On the other hand,  a slight confusion when Buffered send is concerned
remains:
In my understanding, MPI_SEND (standard, blocking) does not return
until the send operation it invoked has completed. Completion can mean
the message was copied into an MPI internal buffer, or it can mean the
sending and receiving processes synchronized on the message. So, if we
decide to use buffered send (Bsend, so blocking), and we say "I want
to allocate a large enough buffer, I want my data to be copied into
the buffer then, because I do not want anyone else to decide if I am
going to syncronize completely my sends and receives on the message -
I know what I'm doing :-)!" then as soon as the data is copied to the
buffer, the call returns and the buffer can be reused.
Is the difference in comparison to Ibsend that with Ibsend the data
doesn't even have to be copied to the buffer when the call returns, or
something like that? Because otherwise, I still do not see the
difference: data copied into buffer-> call returns! Why wouldn't I
reuse my message-buffer then?!

Sorry for bothering you so much, but for the type of applications I am
involved in this is very important issue, thus, it is crucial that
this becomes completely clear to me. Thank you again!

Cheers,
Jovana


> An MPI send (of any kind), is defined by "local completion semantics".
> When a send is complete, the send buffer may be reused. The only kind of
> send that gives any indication whether the receive is posted is the
> synchronous send. Neither standard send nor buffered send tell the sender
> if the recv was posted.
>
> The difference between blocking and nonblocking is that a return from a
> blocking send call indicates the send buffer may be reused. A return from
a
> nonblocking send does not allow the send buffer tpo be reused (but other
> things can be done).  The send buffer becomes available to reuse after a
> wait or successful test.
>
> Dick Treumann  -  MPI Team
> IBM Systems & Technology Group
> Dept X2ZA / MS P963 -- 2455 South Road -- Poughkeepsie, NY 12601
> Tele (845) 433-7846         Fax (845) 433-8363
>
>
>
> |------------>
> | From:      |
> |------------>
>
>----------------------------------------------------------------------------------------------------------------------------------------|

>  |Bill Rankin <bill.ran...@sas.com>
|
>
>----------------------------------------------------------------------------------------------------------------------------------------|

> |------------>
> | To:        |
> |------------>
>
>----------------------------------------------------------------------------------------------------------------------------------------|

>  |Open MPI Users <us...@open-mpi.org>
|
>
>----------------------------------------------------------------------------------------------------------------------------------------|

> |------------>
> | Date:      |
> |------------>
>
>----------------------------------------------------------------------------------------------------------------------------------------|

>  |05/06/2010 10:35 AM
|
>
>----------------------------------------------------------------------------------------------------------------------------------------|

> |------------>
> | Subject:   |
> |------------>
>
>----------------------------------------------------------------------------------------------------------------------------------------|

>  |Re: [OMPI users] MPI_Bsend vs. MPI_Ibsend
|
>
>----------------------------------------------------------------------------------------------------------------------------------------|

> |------------>
> | Sent by:   |
> |------------>
>
>----------------------------------------------------------------------------------------------------------------------------------------|

>  |users-boun...@open-mpi.org
|
>
>----------------------------------------------------------------------------------------------------------------------------------------|

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

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

Reply via email to