Monday May 11, 2015
Your challenge is to take an existing serial program for approximating pi and create two parallel versions of it, both of which use MPI.
Your challenge is to take an existing serial program for approximating pi and create two parallel versions of it, both of which use MPI. In the first one, you should use the MPI_Send() and MPI_Recv() functions. In the second one, you should use the MPI_Reduce() function.

The program approximates pi by summing up the areas of rectangles that are formed using a Left Riemann Sum under the quarter unit circle, similar to the program from a previous challenge problem: http://hpcuniversity.org/students/weeklyChallenge/96/

Starter code is provided to you below in the "MPI Pi starter zip file." You should create two new programs, which should use MPI to split up the rectangles among processes, with each process calculating the areas of its rectangles. The process with rank 0 should receive this sum from each of the other processes and add it to its own sum before multiplying by 4 to calculate pi.

A solution will consist of source code for each of the 2 MPI programs and a modified Makefile.
Show solution
Challenge Resources:
©1994-2024   |   Shodor   |   Privacy Policy   |   NSDL   |   XSEDE   |   Blue Waters   |   ACM SIGHPC   |   feedback  |   facebook   |   twitter   |   rss   |   youtube   |   XSEDE Code of Conduct   |   Not Logged In. Login