MPI缓冲的发送/接收顺序 [英] MPI buffered send/receive order

查看:219
本文介绍了MPI缓冲的发送/接收顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MPI(与fortran一起使用,但问题是MPI标准比任何给定语言都更具体),特别是使用缓冲的发送/接收功能isend和irecv.现在,如果我们想象以下情形:

I'm using MPI (with fortran but the question is more specific to the MPI standard than any given language), and specifically using the buffered send/receive functions isend and irecv. Now if we imagine the following scenario:

进程0:

isend(stuff1, ...)
isend(stuff2, ...)

过程1:

wait 10 seconds
irecv(in1, ...)
irecv(in2, ...)

是否按照发送顺序将消息传递到进程1,即如果在所有情况下使用的标签都相同,我是否可以确定in1 == stuff1和in2 == stuff2 ?

Are the messages delivered to Process 1 in the order they were sent, i.e. can I be sure that in1 == stuff1 and in2 == stuff2 if the tag used is the same in all cases?

推荐答案

是的,按照发送顺序接收消息.该标准将其描述为非超车消息.有关更多详细信息,请参见 MPI标准部分.摘录:

Yes, the messages are received in the order they are sent. This is described by the standard as non-overtaking messages. See this MPI Standard section for more details, here's an excerpt:

订单消息不超载:如果发件人连续向相同的目的地发送两个消息,并且都匹配相同的接收,则如果第一个消息仍在等待处理,则此操作无法接收第二个消息.如果一个接收者连续发布两个接收者,并且都匹配相同的消息,那么如果第一个接收者仍未决,则该消息将无法满足第二个接收操作.此要求有助于将发送与接收进行匹配.如果进程是单线程的,并且接收中未使用通配符MPI_ANY_SOURCE,则它保证消息传递代码是确定性的. (稍后描述的某些调用,例如MPI_CANCEL或MPI_WAITANY,是不确定性的其他来源.)

Order Messages are non-overtaking: If a sender sends two messages in succession to the same destination, and both match the same receive, then this operation cannot receive the second message if the first one is still pending. If a receiver posts two receives in succession, and both match the same message, then the second receive operation cannot be satisfied by this message, if the first one is still pending. This requirement facilitates matching of sends to receives. It guarantees that message-passing code is deterministic, if processes are single-threaded and the wildcard MPI_ANY_SOURCE is not used in receives. (Some of the calls described later, such as MPI_CANCEL or MPI_WAITANY, are additional sources of nondeterminism.)

这篇关于MPI缓冲的发送/接收顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆