Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+1 Is the decision fair to employees?

Answered: 1 week ago