Once a Cartesian topology is set up, it may be necessary to inquire about the topology. These functions are given below and are all local calls.
MPI_CARTDIM_GET(comm, ndims) IN comm communicator with Cartesian structure OUT ndims number of dimensions of the Cartesian structureMPI_Cartdim_get(MPI_Comm comm, int *ndims)
MPI_CARTDIM_GET(COMM, NDIMS, IERROR)INTEGER COMM, NDIMS, IERROR
MPI_CARTDIM_GET returns the number of dimensions of the Cartesian structure associated with comm. This can be used to provide the other Cartesian inquiry functions with the correct size of arrays. The communicator with the topology in Figure would return ndims = 2
MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims, int *periods, int *coords)
MPI_CART_GET(COMM, MAXDIMS, DIMS, PERIODS, COORDS, IERROR)INTEGER COMM, MAXDIMS, DIMS(*), COORDS(*), IERROR
LOGICAL PERIODS(*)
MPI_CART_GET returns information on the Cartesian topology associated with comm. maxdims must be at least ndims as returned by MPI_CARTDIM_GET. For the example in Figure , dims = (3,4). The coords are as given for the rank of the calling process as shown, e.g., process 6 returns coords = (1,2).