I have an mpi graph structure that is roughly cartesian, but has some extra structure for the top/bottom processes. The top/bottom processes need to receive from all processes just below/above it, but only pass to one of them, for example:
Assuming that I know the neighbours for each process (e.g. for the example I know that rank8 has [up,down,left,right]=[9,7,5,11]; or that rank0 has [up,down,left,right]=[1,-1,-1,-1], where -1 means no neighbour) then how would I go about writing a generic send/receive routine to pass (for example) integers around on this graph? Every processor should be able to pass different values to all of its neighbours and the routine should be general and work for arbitrary domains that follow this structure (i.e. one process on the top and bottom, but with any regular, cartesian grid 'between' them).
I know that the question is quite broad and I don't have much of a starting point, but any help would be really appreciated!
