1 | Now we can also use the CART functions to define processor neighbors in the 2D grid of processors. |
2 | MPI_CART_shift(comm2d, dir=0,disp=-1,sourceproc, top_neighbor) |
3 | 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. |
4 | This returns the two processor ranks for the source and destination of a communication function. |