[mpich-discuss] change the rank ordering

Dorian Krause ddkrause at uni-bonn.de
Sat Jul 4 06:29:36 CDT 2009


A cartesian communicator essentially defines a 1-to-1 mapping

{ 0, ..., numprocs-1} <-> { 0, ..., dim[0]-1} x { 0, ..., dim[1]-1 }

so it should be no problem to define it yourself, e.g.

coord[0] = myrank % dim[0]
coord[1] = myrank - dim[1]*coord[0]

You could then create your own MPI like funktions, i.e.

MyMPI_Cart_get() ...


MPI might also reorder your nodes so that this virtual topology matches
the underlying physical topology (e.g. the Torus network on BG). This
might increase performance, but I suspect that on commodity hardware
this doesn't matter?!

Regards,
Dorian


Rolf Kuiper wrote:
> Sounds great! But how?
> Rolf
>
> Am 04.07.2009 um 04:40 schrieb Rajeev Thakur:
>> As pg 243 of the MPI 2.1 standard says, MPI assumes a row-major 
>> ordering of processes for cartesian topologies. If you need a 
>> different ordering such as column major, you probably don't want to 
>> use the cartesian topology functions. You can do the mapping yourself.
>>  
>> Rajeev
>>
>>     ------------------------------------------------------------------------
>>     *From:* mpich-discuss-bounces at mcs.anl.gov
>>     [mailto:mpich-discuss-bounces at mcs.anl.gov] *On Behalf Of *Rolf Kuiper
>>     *Sent:* Friday, July 03, 2009 3:32 PM
>>     *To:* mpich-discuss at mcs.anl.gov <mailto:mpich-discuss at mcs.anl.gov>
>>     *Subject:* [mpich-discuss] change the rank ordering
>>
>>     Hi MPICH-users,
>>
>>     to merge to applications I have to create a communicator with
>>     coordinates in a reversed ordering of the coordinates than the
>>     default in MPI.
>>     E.g.: The default MPI layout sets the ranks of the communicators
>>     to first in z than in y than in x direction, like:
>>
>>     y
>>     ^
>>     | 2-4-6
>>     | 1-3-5
>>     |--------> x
>>
>>     Now I want to change the ordering to loop first in x than in y, like:
>>
>>     y
>>     ^
>>     | 4-5-6
>>     | 1-2-3
>>     |--------> x
>>
>>     So far I can create a cartesian communicator and test its coords
>>     with 
>>     int dims[3] = {0,0,0};
>>     int ndims=3;
>>     MPI_Dims_create(NumberOfProcessors, ndims, dims);
>>     int false = 0; int true = 1;
>>     int periods[3] = { false, false, true };
>>     int reorder = true;
>>     MPI_Comm MyComm;
>>     MPI_Cart_create(MPI_COMM_WORLD, ndims, dims, periods, reorder,
>>     &MyComm);
>>     MPI_Cart_coords(MyComm, LocalRank, ndims, coords);
>>
>>     But how can I get access to change either the current rank or the
>>     associated coords?
>>
>>     Thanks for your help in advance,
>>     Rolf
>>
>




More information about the mpich-discuss mailing list