#include #include #include #include "mpi.h" #define NPTS 38 #define NPROC 4 #define NRBUF 10 int main(int argc, char **argv) { float *sendbuf, *recvbuf; int sendcounts[NPROC], displs[NPROC]; int recvcount, myrank; int nmin, nextra, k, i; MPI_Datatype sendtype = MPI_FLOAT; MPI_Datatype recvtype = MPI_FLOAT; int root = 0; MPI_Comm comm = MPI_COMM_WORLD; MPI_Init(&argc,&argv); MPI_Comm_rank(comm,&myrank); if (myrank==0) { float a[3] = { 0.60, -0.30, 0.20 }; float w[3] = { 3.25, 1.45, 5.30 }; float x[NPTS]; sendbuf = malloc(sizeof(float)*NPTS); for (i=0;i