MPI Communicator MPI_Comm_split 无组 [英] MPI Communicator MPI_Comm_split without Groups

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

问题描述

我正在课堂上使用 C 学习 MPI.我目前正试图弄清楚您何时使用 MPI_Comm_split 以及它的优势是什么.如果我不使用组或者我的所有进程都在一个组中,我还试图弄清楚使用它是否比仅使用 MPI_COMM_WORLD 有任何好处.

I'm learning about MPI using C in class. I'm currently trying to get my head around when you'd use MPI_Comm_split and what the advantages are. I'm also trying to figure out if there are any benefits of using this over just using MPI_COMM_WORLD if I don't use groups or if all my processes are in one group.

据我所知,MPI_Comm_split 为每种颜色"提供了一个独特的通信器,这与使用 MPI_COMM_WORLD 不同(不确定这最后一部分是否正确).MPI 组是一组进程和通信器,可帮助您在这些组内部和之间进行通信.

From what I understand, MPI_Comm_split provides a unique communicator to each 'color' which is different from using MPI_COMM_WORLD (not sure if this last part is correct). MPI groups are a set of processes and communicators help you to communicate within and between these groups.

我正在查看关于的评论这个问题

例如,给定一个形状,例如正方形,程序分裂MPI_COMM_WORLD 分为两组 grpArea 和 grpPerimeter,它们计算给定形状的面积和周长.这些团体应该做他们的私人计算并将结果返回到根(等级 0)MPI_COMM_WORLD.

For example, given a shape e.g. square, the program splits MPI_COMM_WORLD into two groups grpArea and grpPerimeter which compute the area and perimeter of the given shape. These groups should do their private computations and return result to root(rank 0) of MPI_COMM_WORLD.

假设我们不计算面积和周长,而是只计算面积,因此不使用组.使用 MPI_Comm_split 拆分通信器是否有任何意义,以便每个处理器都有自己的通信器?这样做有什么好处或坏处吗?

Let's say that instead of calculating the area and perimeter, we only calculated the area and so we don't use groups. Would there be any point in splitting the communicators using MPI_Comm_split so that each processor has its own communicator? Are there any benefits or drawbacks of doing so?

推荐答案

您基本上是在问在没有不同组的情况下使用 MPI_Comm_split 是否有意义.不,不是的.它没有提供任何好处或没有任何意义.

You are basically asking whether it makes sense to use MPI_Comm_split without having different groups. No it does not. It doesn't provide any benefits or make any sense.

使用同一组的不同传播者可能很有用,原因有两个:

It can be useful to use separate communicators of the same group for two reasons:

  • 为应用程序中可能具有重叠标签的不同模块设置专用通信器.这样,您可以确保没有不匹配.对于这种情况,请使用 MPI_Comm_dup.
  • 使用拓扑.在这种情况下,请使用适当的构造函数,例如MPI_Cart_create.

创建多余的传播者可能会有一些开销.此外,您可能会丢失对 MPI_COMM_WORLD 的特定优化.这不应该阻止您在有意义的情况下使用通讯器.

There may be some overhead in creating excess communicators. Further you may lose specific optimizations for MPI_COMM_WORLD. That shouldn't stop you from using communicators when it makes sense.

这篇关于MPI Communicator MPI_Comm_split 无组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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