#include #include #include #include #include int main(int argc, char *argv[]) { int n, n0, nn, np, me, ier, i; double pi, pi0, x, y; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&np); MPI_Comm_rank(MPI_COMM_WORLD,&me); if ( me == 0 ) { // // Master asks the number of points // printf("Enter N \n"); scanf("%d",&n0); nn = n0/np; n = nn*np; } // // Master broadcasts nn to all others // MPI_Bcast(&nn,1,MPI_INT,0,MPI_COMM_WORLD); printf("me=%d nn=%d\n",me,nn); srand(time(NULL)+me); pi = 0.0; for ( i=0; i