I am looking to find some resources online that show how you might send/recv portions of a 3D array in MPI using C.
Basically, I want to be able to send each 2D layer of the 3D matrix to other processors, do some computes, get that 2D matrix back, and re-assemble it into the whole. I can't seem to find any resources that show how best to send the contiguous block of memory in MPI. In psuedo code, i imagine it being something like this
Has anyone ever done this before?Code:Declare, allocate, initialize 3DGrid[NX][NY][NZ] Loop over Z dimension Send all elements 3DGrid[*][*][NZ] to other processor from main processor Recieve elements 3DGrid[*][*][NZ] on the compute processor Do some computes on 3DGrid[*][*][NZ] on the compute processor Send modified elements 3DGrid[*][*][NZ] back to main processor from Compute processor Receieve 3DGrid[*][*][NZ] on main processor Reassemble 3DGrid[*][*][NZ] back into the main array on main processor end Z loop