#include stdio.h #include stdlib.h #include math.h #include "mpi,h" main(int argc, char* argv[]) { int my_rank; /* rank of process */ int p; /* number of process */ int source; /* rank of sender */ int dest; /* rank of receiver */ int tag=0; /* tag of message */ char message[100]; /* storage for message */ MPI_Status status /* return status for receive */ double deltax, pi = 3.141592654, integral, fleftx, frightx double rightx, f(); int nintervals=128, i; /* Start up MPI */ MPI_Init(&argc, &argv); /* Find out process rank */ MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); /* Find out number of process */ MPI_Comm_size(MPI_COMM_WORLD, &p); if(my_rank == 0) { total = integral; for (source=1;source