简体   繁体   English

接收方未发布接收时标准和非阻塞发送会发生什么

[英]What happens for standard and non-blocking sends when the receiver does not post a receive

What if i send using either MPI_Send or MPI_Isend and the receiving process either not receiving dead or too busy to reply? 如果我发送使用或者MPI_SendMPI_Isend和接收过程中要么不接收死或太忙回复?

How would i know that i should stop sending to the process since it is not receiving/dead or busy 我怎么知道我应该停止发送到进程,因为它没有接收/死或忙

I tried 1: 我尝试了1:

MPI_Send (&destNode, strlen(destNode)+1, MPI_CHAR, nameServer, TAG_NAME_RESOLUTION, MPI_COMM_WORLD, &req);

However when the nameServer is not receiving mode the send is blocking 但是,当nameServer不处于接收模式时,发送将被阻止

I tried 2 using MPI_Isend and testing if msg is sent: 我尝试使用MPI_Isend 2并测试是否发送了味精:

    //Ask nameServer (process 1) to resolve destNode 
    MPI_Isend (&destNode, strlen(destNode)+1, MPI_CHAR, nameServer, TAG_NAME_RESOLUTION, MPI_COMM_WORLD, &req);

    int flag = 0;
    MPI_Test(&req, &flag,  &stat);

However i keep getting flag = 1 even when i know for the fact that MPI_Send hangs because the process is not receiving. 但是,即使我知道MPI_Send因为进程未接收而挂起,我MPI_Send得到flag = 1

Whether or not an MPI_Send returns or an MPI_Isend request completes ( flag==true ) does not necessarily depend on a matching receive being posted. 不论是否MPI_Send返回或MPI_Isend请求完成( flag==true )不一定依赖于匹配接收被张贴。 In both cases, it only means that the send buffer can be reused. 在两种情况下,这仅意味着可以重新使用发送缓冲区。

While the conditions are similar, your MPI implementation may just decide to buffer in the one case and not buffer in the other. 当条件相似时,您的MPI实现可能只决定在一种情况下缓冲而不在另一种情况下缓冲。 Or it may buffer when the during full moon on Wednesdays. 否则可能会在星期三的满月时缓冲。 You cannot assume anything about that. 您不能对此承担任何责任。

If you for some reason need the function return or the operation completion to indicate that the message was actually received, you need to use synchronous mode calls, ie MPI_Ssend or MPI_Issend . 如果出于某种原因需要函数返回或操作完成以指示实际上已接收到消息,则需要使用同步模式调用,即MPI_SsendMPI_Issend

To quote the standard for MPI_Send (3.4) 引用MPI_Send (3.4)的标准

The send call described in Section 3.2.1 uses the standard communication mode. 3.2.1节中描述的发送呼叫使用标准通信模式。 In this mode, it is up to MPI to decide whether outgoing messages will be buffered. 在这种模式下,由MPI决定是否将缓冲传出的消息。 MPI may buffer outgoing messages. MPI可以缓冲传出消息。 In such a case, the send call may complete before a matching receive is invoked. 在这种情况下,发送调用可以在调用匹配的接收之前完成。 On the other hand, buffer space may be unavailable, or MPI may choose not to buffer outgoing messages, for performance reasons. 另一方面,出于性能原因,缓冲区空间可能不可用,或者MPI可能选择不缓存传出消息。 In this case, the send call will not complete until a matching receive has been posted, and the data has been moved to the receiver. 在这种情况下,只有在发送了匹配的接收方并将数据移至接收方之前,发送呼叫才会完成。

If you instead want to ensure that your program can continue despite the message not being received, you keep using MPI_Isend and make sure the buffer and request is not touched until completion is indicated by MPI_Test . 如果您想确保尽管没有收到消息,您的程序仍可以继续,那么请继续使用MPI_Isend并确保直到MPI_Test指示完成为止,才触摸缓冲区和请求。

For MPI_Isend / MPI_Test (3.7.3) 对于MPI_Isend / MPI_Test (3.7.3)

The completion of a send operation indicates that the sender is now free to update the locations in the send buffer (the send operation itself leaves the content of the send buffer unchanged). 发送操作的完成表示发送方现在可以自由更新发送缓冲区中的位置(发送操作本身不更改发送缓冲区的内容)。 It does not indicate that the message has been received, rather, it may have been buffered by the communication subsystem. 它并不表示已接收到该消息,而是可能已被通信子系统缓冲。

PS If your receiver rank is dead , then your MPI program is most probably incorrect. PS:如果您的接收器等级已失效 ,则您的MPI程序很可能不正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM