Question: Homework #7 Description: You are to design and write a C program utilizing pthreads to efficiently perform 2D Successive Over-Relaxation (SOR) (often used in 3D

 Homework #7 Description: You are to design and write a C

Homework #7 Description: You are to design and write a C program utilizing pthreads to efficiently perform 2D Successive Over-Relaxation (SOR) (often used in 3D form to solve differential equations such as Navier-Stokes equations for fluid flow) 2D SOR Problem: Initially, the 2D-array val contains 0.0s everywhere, except for the 1.0s down column 0. On each iteration, SOR updates all interior values (i.e., only the white values in the diagram change with the gray boundary values being fixed) by the average of their four nearest neighbors: above, below, to the left, and to the right. Eventually after many iterations the values will stablize. We won't run to complete stablization, but just until the maximum value change across the whole array during an iteration is less than a user specified threshold (e.g., 0.0001) 1.0 00 0.0 0.0 00 0.0 1.0 0.0 0.0 00 00 0.0 1.0 0.0 0.0 0.0 00 0.0 1.0 00 0.0 00 00 00 1.0 0.0 0.0 00 00 0.0 1.0 0.0 00 0.0 00 0.0 r value Boundary value During an iteration use the 2D-array val to compute the updated values in a second 2D- array new. Before the next iteration, flip-flop and reuse these 2D-arrays. This is actually easy and efficient since val and new are really pointers to the arrays, so all we really need to do is swap their pointer vi ter values va new temp = new ; new val; val temp | You'l need to complete the pthread parallelization. The general steps are: * decide how to decompose the work among threads - keep in mind load balancing cache performance * decide how to synchronize the threads so all threads finish an iteration before any start the next iteration * decide how to synchronize the threads so all threads stop if the max. change at any spot during an iteration is less than the threshold * code the threadmain function run by all the threads * test and debug your program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!