Purpose
Returns shifted source and destination ranks for a task.
C synopsis
#include <mpi.h> MPI_Cart_shift(MPI_Comm comm,int direction,int disp, int *rank_source,int *rank_dest);
C++ synopsis
#include mpi.h void MPI::Cartcomm::Shift(int direction, int disp, int &rank_source, int &rank_dest) const;
FORTRAN synopsis
include 'mpif.h' or use mpi MPI_CART_SHIFT(INTEGER COMM,INTEGER DIRECTION,INTEGER DISP, INTEGER RANK_SOURCE,INTEGER RANK_DEST,INTEGER IERROR)
Parameters
Description
This subroutine shifts the local rank along a specified coordinate dimension to generate source and destination ranks.
rank_source is obtained by subtracting disp from the nth coordinate of the local task, where n is equal to direction. Similarly, rank_dest is obtained by adding disp to the nth coordinate. Coordinate dimensions (direction) are numbered starting with 0.
If the dimension specified by direction is non-periodic, off-end shifts result in the value MPI_PROC_NULL being returned for rank_source or rank_dest or both.
Notes
In C and FORTRAN, the coordinate is identified by counting from 0. For example, FORTRAN A(X,Y) or C A[x] [y] both have x as direction 0.
Errors
Related information