[mpich-discuss] MPI_Send and recv

Matthieu Dorier matthieu.dorier at irisa.fr
Tue Jul 2 21:03:29 CDT 2013


Hi, 

These messages piqued my curiosity; 

If I have two processes, process 0 does an MPI_Send to process 1 and eventually, process 1 posts a matching MPI_Recv or MPI_Irecv; does process 0 waits for the MPI_Recv/Irecv to be posted before returning from the MPI_Send? (in other words if process 0 does 2 MPI_Send and process 1 does 2 MPI_Recv, is the linearization "Send; Send; Recv; Recv" possible?) 

Second question: in the situation described by Sufeng, where a process does a MPI_Send to itself, MPI has enough information to see that the process is sending to itself while it has not posted any matching receive, why would MPI block instead of printing an error and aborting? Is it because in a multithreaded program, the matching receive could be posted by another thread? (Yet in that case I always thought it was unsafe to use the same communicator from multiple threads...) 

Thanks, 

Matthieu 

----- Mail original -----

> De: "Sufeng Niu" <sniu at hawk.iit.edu>
> À: "Pavan Balaji" <balaji at mcs.anl.gov>
> Cc: discuss at mpich.org
> Envoyé: Mardi 2 Juillet 2013 17:20:25
> Objet: Re: [mpich-discuss] MPI_Send and recv

> Thank you so much! Now I make sense

> Sufeng

> On Tue, Jul 2, 2013 at 5:19 PM, Pavan Balaji < balaji at mcs.anl.gov >
> wrote:

> > On 07/02/2013 05:18 PM, Sufeng Niu wrote:
> 

> > > Thanks a lot, that is most confusing part for me in MPI. I would
> > > like
> > > to
> > 
> 
> > > clear this type of problems.
> > 
> 

> > > So the blocking begins to send message to itself, but there is no
> > 
> 
> > > receive posted. Thus, the MPI block it. Am I right here?
> > 
> 

> > Correct.
> 

> > > Thus, I need a nonblocking receive to wait the message here. Can
> > > I
> > > use
> > 
> 
> > > blocking receive?
> > 
> 

> > If you use blocking receive, you'll block in the receive; how will
> > you reach the send?
> 

> > -- Pavan
> 

> > --
> 
> > Pavan Balaji
> 
> > http://www.mcs.anl.gov/~balaji
> 

> --
> Best Regards,
> Sufeng Niu
> ECASP lab, ECE department, Illinois Institute of Technology
> Tel: 312-731-7219
> _______________________________________________
> discuss mailing list discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20130703/20165312/attachment.html>


More information about the discuss mailing list