Cartesian Translator Functions



next up previous contents
Next: Cartesian Shift Function Up: Cartesian Topology Functions Previous: Cartesian Inquiry Functions

Cartesian Translator Functions

The functions in this section translate to/from the rank and the Cartesian topology coordinates. These calls are local.

MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank)

MPI_CART_RANK(COMM, COORDS, RANK, IERROR)INTEGER COMM, COORDS(*), RANK, IERROR

For a process group with Cartesian structure, the function MPI_CART_RANK translates the logical process coordinates to process ranks as they are used by the point-to-point routines. coords is an array of size ndims as returned by MPI_CARTDIM_GET. For the example in Figure gif,coords = (1,2) would return rank = 6.

For dimension i with periods(i) = true, if the coordinate, coords(i), is out of range, that is, coords(i) < 0 or coords(i) >= dims(i), it is shifted back to the interval 0 <= coords(i) < dims(i) automatically. If the topology in Figure gif is periodic in both dimensions (torus), then coords = (4,6) would also return rank = 6. Out-of-range coordinates are erroneous for non-periodic dimensions.

MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int *coords)

MPI_CART_COORDS(COMM, RANK, MAXDIMS, COORDS, IERROR)INTEGER COMM, RANK, MAXDIMS, COORDS(*), IERROR

MPI_CART_COORDS is the rank-to-coordinates translator. It is the inverse mapping of MPI_CART_RANK. maxdims is at least as big as ndims as returned by MPI_CARTDIM_GET. For the example in Figure gif, rank = 6 would return coords = (1,2)



Jack Dongarra
Fri Sep 1 06:16:55 EDT 1995