View the step-by-step solution to:

The project consists of implementing a multithreaded version of the Jacobi algorithm to calculate La Place's Equation.

The project consists of implementing a multi‐threaded version of the Jacobi algorithm to
calculate La Place’s Equation. The Algorithm traverses a 2D NxN array, making every
element the average of its 4 surrounding neighbors (left, right, top, down).
The NxN array has initially all zeros and is surrounded by a margin with all 1’s as shown in
the example below. The 1’s never change, and the 0’s increase little by little.
1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1
When running with more than 1 thread, your program will split the array into slices and
assign one slice to each thread: thread 0 handles the first slice, thread 1, handles the second
slice, and so on. The threads need to be synchronized so that the order in which the
elements are updated is the same in which they would with one thread, i.e., thread j only
executes step m after thread j‐1 has finished the same step, and thread j only updates its
last row, k, in step n after thread j+1 has already used row k in step n‐1.
You will execute the algorithm for a large (1000x1000) 2D array for 1000 steps and
measure the execution time for different numbers of threads: 1, 2, 4, and 8.
You will submit the code and a graph showing the execution time for different numbers of
threads with an analysis of the result obtained.
We will run your code in class and measure the time and energy to see if it varies through
execution, so make sure your code runs inside a shell script. If you are running on your
laptop, bring the power cord so that we can measure energy.

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
• -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents