mpi_probe()用于确定消息大小

发布于 2025-01-20 06:40:37 字数 170 浏览 1 评论 0原文

MPI_Probe 的常见用途是确定传入消息的大小,以便为接收缓冲区分配足够的内存。但这也可以通过一对单独的 MPI_Send-MPI_Recv 调用来完成,即发送方进程在不同的消息中将消息大小发送到接收方。是否可以假设 MPI_Probe 通常是更快的选项?为什么?我们可以执行一些测试并比较挂机时间,但结果可能取决于实现。

A common usage of MPI_Probe is in determining the size of an incoming message so that enough memory is allocated for the receive buffer. But this can also be done with a separate pair of MPI_Send-MPI_Recv calls, i.e. the sender process sends the message size to the receiver in a different message. Can it be assumed that MPI_Probe is in general the faster option? Why? We can perform some tests and compare the walltimes, but the results may be implementation-dependent.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想你只要分分秒秒 2025-01-27 06:40:37
  1. 对于短消息,延迟比消息的大小更重要,因此探测小消息可能会更快。
  2. 探测使得作为发送者处理 MPI_ANY_SOURCE 变得更加容易:否则您必须首先确定大小消息的来源,然后从该源执行特定的接收。

人们经常使用 MPI_Iprobe 来代替 MPI_Probe,它会告诉您是否有消息。是的,您可以使用多个 Irecv 来模拟它,但为什么要使代码如此复杂呢?

  1. For short messages the latency is more important than the size of the message, so probing for a small message is probably faster.
  2. Probing makes it easier to deal with MPI_ANY_SOURCE as a sender: otherwise you'd have to first determine where the size msg comes from, and then do a specific receive from that source.

Instead of MPI_Probe, people often do MPI_Iprobe which tells you if there is a message at all. Yes, you can emulate that with multiple Irecvs, but why would you make your code so complicated?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文