Newsgroups: comp.parallel.mpi
From: rdaoud@magnus.acs.ohio-state.edu (Raja B Daoud)
Subject: Re: Clarifications on Ready/Sync modes
Organization: Ohio Supercomputer Center
Date: 13 Aug 1995 02:25:30 GMT
Message-ID: <40jnqq$sar@charm.magnus.acs.ohio-state.edu>

Vivek Gupta <guptavi1@cps.msu.edu> wrote:
>However, do you feel that the ready mode can really result in a better
>performance in some case ? Since it is the user's responsibility to guarantee 
>posting of matching receive, I feel that it would involve an extra 
>send-receive

Not necessarily _extra_, the knowledge may be implicit in the application's
protocol.  I don't want to split hairs here, I wouldn't lose sleep if
ready send didn't exist. :-)  Having said that, it doesn't bother me
either because it's trivial for an implementation to handle by just
making it == MPI_Send() (if it doesn't have a better way).

Ok, here's a simple example.  Assume an RPC scenario where the request
sender (client) will get a reply for sure from the server (pseudo-code):

client                            server

MPI_Irecv();   /* reply */
MPI_Send();    /* request */      MPI_Recv();    /* request */
                                  do_service();
MPI_Wait();    /* reply */        MPI_Rsend();   /* reply */

Here, the client's send is also the ready-to-receive hint.

What does a user gain from this?  It depends on the implementation and
its protocols.  In the example above, the difference between the server
calling MPI_Rsend() or MPI_Send() has to do with the way envelopes
(system resources) are buffered.  Note that in both cases the message
body will not be buffered because MPI_Irecv() has already been called
and this fact will be detected when the envelope reaches the receiver.
But ready send may be used to tell MPI not to worry about the availability
of envelope space at the receiver, and to just go ahead and send the
message envelope (and may be the message if a short one).

So in the best case scenario - best case for the relevance of ready send -
let's assume the sender is at the point where it thinks the receiver
doesn't have envelope buffer space left.  MPI_Send() will have to block
until it is notified that it's ok to resume sending.  MPI_Rsend() on the
other hand doesn't have to (assuming MPI_Irecv() reserves an envelope).
If an implementation doesn't do envelope management, (example: the
malloc()-till-you-crash approach), this scenario is moot.

Out of curiosity, I'd be interested to know if you're going to make
MPI_Rsend() == MPI_Send() in your implementation.

Regards,

--Raja

-=-
Raja Daoud				raja@tbag.osc.edu
Ohio Supercomputer Center		http://www.osc.edu/lam.html

