next up previous
Next: Compiling and running Up: Lesson 2 -- Previous: The listing of

The synopsis of second.c

The integral

is calculated by dividing the interval [0,1] into a number of subintervals and approximating the integrated function within each subinterval by a constant value which corresponds to the middle of the subinterval. The master process obtains the number of subdivisions from standard input and broadcasts it to other processes.

The processes perform summations each on its own portion of work. At the end the partial results are added in another collective MPI operation called reduction.

The answer is written on standard output by the master process, which, otherwise, participates equally in all other computations.



Zdzislaw Meglicki
Tue Feb 28 15:07:51 EST 1995