MPI_Bsend的缺点? [英] Disadvantages of MPI_Bsend?

查看:101
本文介绍了MPI_Bsend的缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了一个死锁,我可以通过使用MPI_Bsend而不是MPI_Send来解决该死锁.如果我正确理解MPI_Bsend是非阻塞发送,则可以安全地修改我发送的内容,而不必担心发送操作何时完成,所以

I recently encountered a deadlock that I have been able to resolve by using MPI_Bsend instead of MPI_Send. If I understand correctly MPI_Bsend is a non-blocking send and it is safe to modify the thing I send without worrying about when the send operation it complete, so

double x = 1;
MPI_Bsend(&x,1,MPI_DOUBLE,master,1,MPI_COMM_WORLD);
x = 0;

将始终导致x在1发送.

will always result in x being sent at 1.

在阅读有关MPI发送模式的文档时,我遇到有关MPI_Bsend

When reading the documentation on MPI send modes I encountered this warning about MPI_Bsend

MPI规范的最新附件.仅在绝对必要时使用.

A late add-on to the MPI specification. Should be used only when absolutely necessary.

我的问题是:

  1. 为什么?是因为可能不是所有实现都支持Bsend吗?
  2. 支持MPI_Bsend的Open MPI最早的版本是什么?
  3. 在使用MPI_Bsend时,我还应注意其他注意事项吗?

推荐答案

为什么MPI_BSend有问题?

MPI中的缓冲操作要求用户提供足够大的缓冲区. MPI描述了一个操作模型,每个操作可以使用多少缓冲区-因此理论上您可以计算总共需要多少缓冲区.但是,在足够复杂的应用程序中,正确计算所需的缓冲区数量是不可行的. 无法恢复的错误是缓冲区空间不足的原因.该错误可能是在特定情况下随机发生的非常令人讨厌的heisenbug.

Why is MPI_BSend problematic?

Buffered operations in MPI require the user to provide a large-enough buffer. MPI describes an operational model how much buffer may be used for each operation - so you can theoretically compute how much buffer will be needed in total. However, in in sufficiently complex applications it is not feasible to correctly compute the amount of buffer that is needed. Not having enough buffer space is an unrecoverable error. This error may be a very nasty heisenbug randomly occurring under specific circumstances.

请注意,MPI中的缓冲模式和非阻塞模式是不同的(甚至是正交的).使用非阻塞原语(即使用MPI_Isend)编写正确的MPI程序更加容易.通常建议这样做.

Note that buffered mode and non-blocking mode is different (even orthogonal) in MPI. It is easier to write a correct MPI program using non-blocking primitives, i.e. using MPI_Isend. This is generally recommended.

后期添加"的引用具有误导性. 24年前,它已经是第一个MPI标准.我不用担心图书馆的支持,而只担心我提到的其他问题.

The "late addition" quote is misleading. It was already in the very first MPI standard 24 years ago. I wouldn't worry about support by libraries, but rather the other issues I mentioned.

这篇关于MPI_Bsend的缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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