#include #include #include int main(int argc, char *argv[]) { int n; int me, nprocs; /* --------------------------------------------------- */ MPI_Init (&argc, &argv); MPI_Comm_size (MPI_COMM_WORLD, &nprocs); MPI_Comm_rank (MPI_COMM_WORLD, &me); /* --------------------------------------------------- */ if (me == 0) { printf("%s", "Input array length :\n"); scanf ("%d", &n); } /* --------------------------------------------------- */ MPI_Bcast (&n, 1, MPI_INT, 0, MPI_COMM_WORLD); /* --------------------------------------------------- */ MPI_Barrier (MPI_COMM_WORLD); MPI_Status status; double *d; if (me == 0 ) { for (int pe=1; pe