MPI_Cart_sub creates new communicators for subgrids of up to (N-1) dimensions from an N-dimensional cartesian grid.
Often, after we have created a cartesian grid, we wish to further group elements of this grid into subgrids of lower dimensions. For instance, the subgrids of a 2D cartesian grid are 1D grids of the individual rows or columns. Similarly, for a 3D cartesian grid, the subgrids can either be 2D or 1D.
Subroutine MPI_Cart_sub(old_comm, belongs, new_comm, ierr)
int MPI_Cart_sub(MPI_Comm old_comm, int *belongs, MPI_Comm *new_comm)
Example in Fortran
For a 2D cartesian grid, create subgrids of rows and columns. Create cartesian topology for processes.
|
Shown in Figure a below is a 3-by-2 cartesian topology where the index pair "i,j" represents row "i" and column "j". The number in parentheses represents the rank number associated with the 2D cartesian grid. Figure b shows the row subgrids while Figure c shows the column subgrids.
|
|
|
Here is a fortran example demonstrating the column subgrid.
Note that: