Purpose
Partitions a cartesian communicator into lower-dimensional subgroups.
C synopsis
#include <mpi.h> MPI_Cart_sub(MPI_Comm comm,int *remain_dims,MPI_Comm *newcomm);
C++ synopsis
#include mpi.h MPI::Cartcomm MPI::Cartcomm::Sub(const bool remain_dims[]) const;
FORTRAN synopsis
include 'mpif.h' or use mpi MPI_CART_SUB(INTEGER COMM,LOGICAL REMAIN_DIMS(*),INTEGER NEWCOMM, INTEGER IERROR)
Parameters
Description
If a cartesian topology was created with MPI_CART_CREATE, you can use the function MPI_CART_SUB:
This function is closely related to MPI_COMM_SPLIT.
For example, suppose MPI_CART_CREATE (..., comm) defined a 2 × 3 × 4 grid and remain_dims = (true, false, true). A call to:
MPI_CART_SUB(comm,remain_dims,comm_new),
creates three communicators. Each has eight tasks in a 2 × 4 cartesian topology. If remain_dims = (false, false, true), the call to:
MPI_CART_SUB(comm,remain_dims,comm_new),
creates six non-overlapping communicators, each with four tasks in a one-dimensional cartesian topology.
Errors
Related information