Scattering a Matrix


Up: Datatypes and Heterogenity Next: Exercises - datatypes Previous: An interleaved datatype

We set the displacements for each block as the location of the first element in the block. This works because MPI_Scatterv uses the extents to determine the start of each piece to send.

scdispls[0] = 0; 
scdispls[1] = 4; 
scdispls[2] = 32; 
scdispls[3] = 36; 
MPI_Scatterv( sendbuf, sendcounts, scdispls, block,  
              recvbuf, nx * ny, MPI_DOUBLE, 0, 
               MPI_COMM_WORLD ); 
127 How would use use the topology routines to make this more general?



Up: Datatypes and Heterogenity Next: Exercises - datatypes Previous: An interleaved datatype