On Thu, 3 Aug 2006, Kyle Wheeler wrote:
> On Thursday, August 3 at 04:13 PM, quoth Kyle Wheeler:
> > Iâm fiddling with the profiling layer, and I want to convert a
> > communicator-specific rank to global rank. Is there a good way of
> > doing this?
>
> I found the following, which I think does it. Is this the best way?
>
> MPI_Group world, cur;
> int globalrank;
> PMPI_Comm_group(comm, &cur);
> PMPI_Comm_group(MPI_COMM_WORLD, &world);
> PMPI_Group_translate_ranks(cur, 1, &rank, world, &globalrank);
The simplest way is to call MPI_Comm_rank twice.
PMPI_Comm_rank( MPI_COMM_WORLD, &world_rank );
PMPI_Comm_rank( comm, &comm_rank );
PMPI_Group_translate_ranks() becomes more efficient if you have a group
of ranks to be translated (i.e. save you a Comm_group() call).
A.Chan
|