The Red/Blue computationsimulates two interactive flows: annbynboard is initialized so cells have one of threecolors: red, white, and blue, where white is empty, red moves right, and blue moves down. (The board may be initialized with roughly 1/3 cells in read, 1/3 in white and 1/3 in blue andcolorsshould be interleaved and spread across the board. You need to write a separate functionboard_initto initialize the board.) In the first half step of an iteration, any redcolorcan move right one cell if the cell to the right is unoccupied (white); on the second half step, any bluecolorcan move down one cell if the cell below it is unoccupied (white); the case where red vacates a cell (first half) and blue moves into it (second half) is okay.Colorswraparound to the opposite side when reaching the edge. Viewing the board as overlaid with atbytgrid of tiles (for simplicitytdividesn,i.e., every tile containsn/tbyn/tcells), the computation terminates if any tilescoloredcells are more thanc%onecolor(blue or red).
Use MPI to write a solution to the Red/Blue computation.
Assume the processes are organized as a one-dimensional linear array.
It is fine to use a square grid, i.e.nbyngrid fornbeing grid size.
Forsimplicity assumenis divisible byt.
Each process will hold a number ofkn/trows fork 0.
For the purpose of load balancing, processes should have roughly the same number of rows and the difference not greater than n/trows.
Your program must produce correct results fornprocsbeing greater than or equal to one.
Your program needs to ask for 4 user defined parameters (integers) as inputs: cell grid sizen, tile grid sizet, terminating thresholdc, and maximum number of iterationsmax_iters.
Your program needs to print out which tile (or tiles if more than one) has thecoloredsquares more thanc%onecolor(blue or red).
After the parallel computation, you main program must conduct a self-checking, i.e., first perform a sequential computation using the same data set and then compare the two results.
Your submissions will be marked on accuracy of results, suitability of the parallelism applied, and quality of your reports.
Thereportshould be concise and clear (2-3 A4 pages) and should contain the following sections:
a.Problem definition and Requirements
b.Parallel algorithm design
c.Implementation and Testing
d.Manual (e.g. how to run the program, input and output)
You MUST attempt this assignment individually.
Submission Requirements
Your submission must be made by11:59pm on Thursday, 13 April, 2017.
1.Createa tar filewhich contains yourreports,makefilesandany source files (e.g., .c and .h files).DO NOT INCLUD ANY OBJECT OR BINARY FILES.
2.Submitonlythe.tarfile.
Reviews
There are no reviews yet.