MPI_Cart_get retrieves properties such as periodicity and size of a subgrid.
On occasions, a subgrid communicator may be created in one routine and
is subsequently used in another routine. If only the communicator is
available in the latter, this routine, along with MPI_Cartdim_get,
may be used to determine the size and other pertinent information
regarding the subgrid.
Subroutine MPI_Cart_get(subgrid_comm, ndims, dims, period, coords, ierr)
int MPI_Cart_get(MPI_Comm subgrid_comm, int dims, int *ndims, int *periods, int *coords)
Example in Fortran
|
Shown in Figure a below is a 3-by-2 cartesian topology (grid) where the index pair "i,j" represent row "i" and column "j". The number in parentheses represents the rank number associated with the cartesian grid.
| 0,0 (0) | 0,1 (1) |
| 1,0 (2) | 1,1 (3) |
| 2,0 (4) | 2,1 (5) |
We have just demonstrated the use of MPI_Cart_get to retrieve information on
a subgrid communicator. Often, MPI_Cartdim_get needs to be called
first, as ndims, the dimensions of the subgrid, is needed as input
to MPI_Cart_get.