#include #include #include double PI25DT = 3.141592653589793238462643; long n = 10000; inline double f(double x) { return (4.0 / (1.0 + x*x)); } int main(int argc, char *argv[]) { int myid, np, i; double mypi, pi, h, sum, x; double startwtime, endwtime; int namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &np); MPI_Comm_rank(MPI_COMM_WORLD, &myid); MPI_Get_processor_name(processor_name, &namelen); // printf("Process %d on %s\n", myid, processor_name); if (myid == 0) startwtime = MPI_Wtime(); h = 1.0/n; sum = 0.0; for (i=myid; i