Reputation: 133
I need to select one processor from my Comm to do some works ( I don`t want other processors do the work ). Since I split my Comm to the groups, I cannot always pick one specific rank ( for example 0) as my master. I need to choose it from my current comm. Any suggestion?
Thank you.
Upvotes: 0
Views: 316
Reputation: 22670
The accepted answer by suszterpatt is correct and this is what you should normally do. Nevertheless, I'd like to address the title of the question of randomly selecting a master process. To do that
MPI_Allreduce
with MPI_MAXLOC
.Upvotes: 0
Reputation: 8273
The rank of a process is always relative to a communicator. After you split your processes, you can just take process 0 in the new communicator to perform the work you want.
Upvotes: 3