Difference between revisions of "OpenMP in Small Bites/False Sharing"

From HPC Wiki
OpenMP in Small Bites/False Sharing
Jump to navigation Jump to search
(Created page with "{{Infobox OpenMP in Small Bites}}")
 
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Infobox OpenMP in Small Bites}}
+
[[Category:Tutorials|False Sharing (OpenMP)]]<nowiki />
 +
{{DISPLAYTITLE:False Sharing (OpenMP)}}<nowiki />
 +
{{Syllabus OpenMP in Small Bites}}<nowiki />
 +
__TOC__
 +
 
 +
This video explains the concept of caches in parallel computer architectures, discusses the problem of false sharing, shows how it influences the performance of OpenMP programs and how to avoid it. Further hardware-specific topics which influence the way to develop scalable OpenMP programs is discussed in the part about [[OpenMP_in_Small_Bites/NUMA|Non-Uniform Memory Access]].
 +
 
 +
== Video ==
 +
 
 +
<youtube width="600" height="340" right>CMJXvTF-gJk</youtube>
 +
 
 +
([[Media:hpc.nrw_04_Introduction-FalseSharing.pdf | Slides as pdf]])
 +
 
 +
== Quiz ==
 +
{{hidden begin
 +
|title = 1. What causes the introduction of caches in parallel architectures?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+ Caches can decrease the performance gap between the cores and the memory.
 +
|| Correct
 +
- Caches can be used to accelerate the computation in the cores for parallel programs
 +
|| Wrong
 +
- Since higher clock frequencies would cause to much heat on the chip, caches are the only way to accelerate the core.
 +
|| Wrong
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = 2. Why is false sharing a problem in OpenMP programs?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
- Correctness: The parallel program will deliver non-deterministic results.
 +
|| Wrong. False sharing is pure performance problem. Even with false-sharing the results will be determinstic in cache coherent systems.
 +
+ Performance: The scalabilty of a parallel program might suffer significantly.
 +
|| Correct.
 +
- Compiler: The compiler cannot generate optimal code.
 +
|| Wrong. False sharing is caused by the used hardware, not the compiler.
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
 
 +
{{hidden begin
 +
|title = 3. What might cause a false sharing effect?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+ Two different memory adresses on the same cache line are accessed by different threads.
 +
|| Correct.
 +
- Two different memory adresses on different cache lines are accessed by the same thread.
 +
|| Wrong.
 +
- One memory address is accessed by different threads.
 +
|| Wrong.
 +
</quiz>
 +
{{hidden end}}

Latest revision as of 11:14, 18 January 2021

Tutorial
Title: OpenMP in Small Bites
Provider: HPC.NRW

Contact: tutorials@hpc.nrw
Type: Multi-part video
Topic Area: Programming Paradigms
License: CC-BY-SA
Syllabus

1. Overview
2. Worksharing
3. Data Scoping
4. False Sharing
5. Tasking
6. Tasking and Data Scoping
7. Tasking and Synchronization
8. Loops and Tasks
9. Tasking Example: Sudoku Solver
10. Task Scheduling
11. Non-Uniform Memory Access

This video explains the concept of caches in parallel computer architectures, discusses the problem of false sharing, shows how it influences the performance of OpenMP programs and how to avoid it. Further hardware-specific topics which influence the way to develop scalable OpenMP programs is discussed in the part about Non-Uniform Memory Access.

Video

( Slides as pdf)

Quiz

1. What causes the introduction of caches in parallel architectures?

Caches can decrease the performance gap between the cores and the memory.
Caches can be used to accelerate the computation in the cores for parallel programs
Since higher clock frequencies would cause to much heat on the chip, caches are the only way to accelerate the core.

2. Why is false sharing a problem in OpenMP programs?

Correctness: The parallel program will deliver non-deterministic results.
Performance: The scalabilty of a parallel program might suffer significantly.
Compiler: The compiler cannot generate optimal code.


3. What might cause a false sharing effect?

Two different memory adresses on the same cache line are accessed by different threads.
Two different memory adresses on different cache lines are accessed by the same thread.
One memory address is accessed by different threads.