#include #include #include #include #define SIZE 4 int main (int argc, char *argv[]) { int numtasks, rank, source; int sendcounts[4] = {2, 4, 5, 5}; int recvcounts[4] = {2, 4, 5, 5}; int displs[4] = {0, 2, 6, 11}; float recvbuf[SIZE * SIZE]; float * sendbuf; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &numtasks); sendbuf = malloc(sizeof(float) * sendcounts[rank]); if (numtasks == SIZE) { source = 1; //init sendbuf for(int i=0; i