Basic HTML version of Foils prepared 19 September 98

Foil 61 Who are my neighbors?

From MPI Message Passing Interface Computational Science for Simulations -- Fall Semester 1998. by Geoffrey C. Fox, Nancy McCracken


The routine MPI_Cart_shift finds the neighbors in each direction of the new communicator.
dir = 0; // in C 0 for columns, 1 for rows
// in Fortran, it's 1 and 2
disp = 1; // specifies first neighbor to the right and left
ierr = MPI_Cart_shift (comm2d, dir, disp, &nbrbottom,
&nbrtop):
This returns the process numbers (ranks) for a communication of the bottom and top neighbors.
If a process in a non-periodic mesh is on the border and has no neighbor, then the value MPI_PROCNULL is returned. This process value can be used in a send/recv, but it will have no effect.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Apr 11 1999