Question: QUESTION 3 Multiple processors need to share data quickly and efficiently to achieve high performance. One way to do this is through shared memory. However,

QUESTION 3
Multiple processors need to share data quickly and efficiently to achieve high performance. One
way to do this is through shared memory. However, shared memory can present a problem when
multiple processors try to access the same memory location simultaneously. Figure Q3 shows
a code segment that updates a shared variable "sum" in a loop written with the OpenMP
programming model.
Figure Q3
(a) Explain in detail the use of OpenMP's "critical" directive to solve the shared memory
problem in an HPC system. Also, identify the problem that might occur by executing
this directive.
[5 marks]
(b) The impact of this overhead can be quantified by measuring the execution time of the
program with and without the "critical" directive. Re-write the program to measure the
performance impact of the "critical" directive by utilising OpenMP's built-in timers.
Explain in detail about your program.
 QUESTION 3 Multiple processors need to share data quickly and efficiently

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!