Now we can also use the CART functions to define processor neighbors in the 2D grid of processors. |
MPI_CART_shift(comm2d, dir=0,disp=-1,sourceproc, top_neighbor) |
For each processor, this takes a direction (given here as 0 for columns in C, but would be 1 for columns in Fortran) and a displacement, which is here -1 to go to next highest index. |
This returns the two processor ranks for the source and destination of a communication function. |