Reputation: 63
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.
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.
I was looking at the comment on this question
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.
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?
Upvotes: 0
Views: 765
Reputation: 22670
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
.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.
Upvotes: 2