Answer to Question #198422 in C for Unknown255319

Question #198422


 float f( float x ) ...


 float area( float xmin, float xmax, int N, float *store )

{

 float h = (xmax-xmin)/N; 9

 // Calculate and store f(x) for each x.

 int i;

 for( i=0; i<N; i++ ) store[i] = f(xmin+i*h);


 // Estimate the area.

 float area = 0.0f;

 for( i=0; i<N; i++ ) area += h * store[i];


 return area;

 }


(a) Consider first the loop at line 12, which calculates f(x) over a range of values of x, and

stores the results in an array store[N].

(i) Identify any data dependencies in this loop. Explain your answer.


(ii) On a shared memory CPU architecture and OpenMP, this loop can be parallelised by using a #pragma omp parallel for directive just before the loop. Provide pseudo- code for the actions performed by each thread in the case that there are p = 3 threads.




1
Expert's answer
2021-05-26T12:56:12-0400
Dear chimmpy1010, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS