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
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 Q shows
a code segment that updates a shared variable "sum" in a loop written with the OpenMP
programming model.
Figure Q
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.
marks
b The impact of this overhead can be quantified by measuring the execution time of the
program with and without the "critical" directive. Rewrite the program to measure the
performance impact of the "critical" directive by utilising OpenMP's builtin timers.
Explain in detail about your program.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
