LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2007-02-24 10:27:54


On Feb 20, 2007, at 3:50 AM, Rajesh vanaparthi wrote:

> Can anyone explain the following command clearly
>
> MPI_cart_shift (MPI_Comm comm., int direction, int displ, int *src,
> int *dest)
>
> Actually this routine finds the resulting source and destination
> ranks given the shift direction and displ

Check this out:

http://www.mpi-forum.org/docs/mpi-11-html/node137.html#Node137

> Please explain me clearly what happens when direction=1 and 0 and
> also disp < 0, >0 or 0

direction is the dimension of the shift. For example, in your 2x2
example below, direction==0 is dimension 0 (in a C 2D array, the
row), and direction==1 is dimension 1 (in a C 2D array, the column).
Per the MPI spec, disp==0 is undefined.

> Take the example (let 4 processors are arranged in a 2 x 2 grid
> with ranks 0 for P(0,0),
> Rank 1 for P(0,1), rank 2 for P(1,0), rank3 for P(1,1))
>
> If rank 0 is the calling process then please explain me the
> following commands
>
> 1) MPI_Cart_shift(comm., 1, -1, &rsrc, &rdest);

It depends if the relevant dimensions in comm were marked as periodic
or not.

Periodic -- both rsrc and rdest will be 1:

                   |----------------------|
                   |-- 0,0:0 <-- 0,1:1 <--|
                       1,0:2 1,1:3

Non-periodic -- rsrc will be 1 and rdest will be MPI_PROC_NULL:

     MPI_PROC_NULL <-- 0,0:0 <-- 0,1:1
                       1,0:2 1,1:3

> 2) MPI_Cart_shift(comm., 0, -1, &rsrc, &rdest);

Periodic -- both will be 2:

                   |-------|
                   | 0,0:0 --> 0,1:1
                   | ^
                   | |
                   | 1,0:2 1,1:3
                   | ^
                   |-------|

Non-periodic -- rsrc will be 2 and rdest will be MPI_PROC_NULL:

                      MPI_PROC_NULL
                           ^
                           |
                       0,0:0 --> 0,1:1
                           ^
                           |
                       1,0:2 1,1:3

> What r the soruce and dest rank in both the cases if rank 0 is the
> calling process in the 2 x 2 grid
>
>
> (0,0)
> 0
>
> (0,1)
> 1
>
> (1,0)
> 2
>
> (1,1)
> 3
>
>
>
>
> Here’s a new way to find what you're looking for - Yahoo! Answers
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/

-- 
Jeff Squyres
Server Virtualization Business Unit
Cisco Systems