使用 MPI_COMM_split 后进程等级之间的关系
我使用 MPI_Comm_split 来分割默认的 MPI 通信器。如果默认通信器中最初有 10 个进程,MPI_COMM_WORLD 和,比如说,它们的级别由 id_original 标识。新的通信器由 id_original 6,7,8,9 的 4 个进程组成。这些进程将具有由新通信器中的 id_new 定义的等级。这两个通信器中的进程级别之间的关系是什么? id_original 6,7,8,9 的进程在新通信器中将分别具有新的等级 0,1,2,3 0,1,2,3,还是顺序可能不同?
I used MPI_Comm_split to split the default MPI communicator.If initially there were 10 processes in default communicator ,MPI_COMM_WORLD and ,say, their ranks were identified by id_original. The new communicator consisted of 4 processes with id_original 6,7,8,9.These processes will have ranks defined by , say , id_new in the new communicator. What will be the relation between ranks of processes in these two communicators. Will the processes with id_original 6,7,8,9 will have new ranks 0,1,2,3 respectively in the new communicator or the ordering might be different?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用 MPI_Comm_split 控制新通信器中的顺序。例如,您可以使用 MPI_Comm_world (或您的“id_original”)中的排名作为键,如下所示:
You should use the "key" argument to MPI_Comm_split to control the order in the new communicator. For example, you could use the rank in MPI_Comm_world (or your "id_original") as the key, like so:
根据此(我强调):
所以是的,如果进程 6-9 为
key
提供相同的值,那么它们将分别在新通信器中获得排名 0-3。但是,如果这对于程序的正确性至关重要,那么您应该使用 Edric 的方法在代码中明确这种安排。According to this (emphasis by me):
So yes, if processes 6-9 provide the same value for
key
, then they will get ranks 0-3 in the new communicator, respectively. If this is crucial for the correctness of the program, though, then you should make this arrangement explicit in your code using Edric's method.