/* * On src: m(0:9,0:9) * send section m(2:6,4:9) * * On dest m(0:11,0:7) * recv section m(7:11,2:7) * * NOTE: this code emulates Fortran style indexing */ #include #include "mpi.h" #define IND(i,j) j*mx+i void main( int argc, char *argv[] ) { int *m; int mx, my, nx, ny; int ierr, rank, size; int src = 1, dest = 0; MPI_Datatype section; MPI_Status status; int i,j; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank==src) { mx = 10; my = 10; m = (int *) malloc(mx*my*sizeof(int)); printf("Source array:\n"); for(j=0; j