是否明确定义了MPI沟通等级的行为? [英] Is the behavior of MPI communication of a rank with itself well-defined?

查看:81
本文介绍了是否明确定义了MPI沟通等级的行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您使用一种MPI通讯方法与自己进行等级通讯,会发生什么?是否有明确定义的行为(例如,保证成功或失败),还是取决于机会/其他无法控制的影响,程序是否会继续运行?

What happens if you use one of the MPI communication methods to have a rank communicate with itself? Is there a well-defined behavior (e.g. guaranteed to succeed or fail), or does it depend on chance/other uncontrollable influences, whether the program will continue to run or not?

一个示例是流体动力学代码,其中每个等级确定需要将哪些网格单元发送到相邻等级才能为计算模具创建必要的光晕.如果仅在一个等级上开始仿真,则等级0本身将无阻塞地发送/接收(发送长度为0的信息).

An example would be a fluid dynamics code, where each rank determines which grid cells need to be sent to the neighboring ranks to create the necessary halo for the computational stencil. If the simulation is started just on one rank, there would be non-blocking send/receive of rank 0 with itself (sending around 0-length information).

推荐答案

尽管您可以按照suszterpatt的回答避免进行自我消息传递,但是自我消息传递将起作用,并且是MPI标准的一部分.甚至还有一个预定义的便捷通讯器MPI_COMM_SELF.只要发送/接收调用不会导致死锁(例如,使用非阻塞调用),发送到self就可以了.当然,发送和接收缓冲区不应重叠.

While you can avoid self-messaging as per suszterpatt's answer, self-messaging will work and is part of the MPI standard. There is even a pre-defined convenience communicator MPI_COMM_SELF. As long as the send/receive calls do not cause deadlock (for example, non-blocking calls are used), sending to self is fine. Of course, the send and receive buffers should not overlap.

请注意,使用OpenMPI,您需要启用self BTL .

Note that with OpenMPI you need to enable the self BTL.

来源: MPI 1.1第3.2.4节

Source =目的地是允许的,也就是说,进程可以向自身发送消息. (但是,使用上述阻塞发送和接收操作这样做是不安全的,因为这可能导致死锁.请参见第3.5节点对点通信的语义".)

Source = destination is allowed, that is, a process can send a message to itself. (However, it is unsafe to do so with the blocking send and receive operations described above, since this may lead to deadlock. See Sec. 3.5. Semantics of point-to-point communication.)

这篇关于是否明确定义了MPI沟通等级的行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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