Difference between revisions of "OpenMP in Small Bites/NUMA"

From HPC Wiki
OpenMP in Small Bites/NUMA
Jump to navigation Jump to search
(Created page with "{{Infobox OpenMP in Small Bites}}")
 
Line 1: Line 1:
 +
[[Category:Tutorials]]
 +
 +
__TOC__
 +
 
{{Infobox OpenMP in Small Bites}}
 
{{Infobox OpenMP in Small Bites}}
 +
 +
 +
=== Video === <!--T:5-->
 +
 +
<youtube width="600" height="400" right>IfD9IPixgpo</youtube>
 +
 +
=== Quiz === <!--T:5--> 
 +
 +
 +
{{hidden begin
 +
|title = 1. Why is it important to initialize your data in parallel when executing on a NUMA architecture?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+ Click and submit to see the answer
 +
|| Initializing the data in parallel distributes the date amoung the different sockets. When accessing the data in a hotspot region in the same pattern you avoid remote memory accesses.
 +
</quiz>
 +
{{hidden end}}
 +
 +
{{hidden begin
 +
|title = 2. Why is it important to bind the threads?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+ Click and submit to see the answer
 +
|| Otherwise the operating system might decide to migrate the thread from one core to anothers. This results in a performance penalty due to the context switch and a potential remote data access on NUMA architectures.
 +
</quiz>
 +
{{hidden end}}
 +
 +
{{hidden begin
 +
|title = 3. Given a NUMA architecture with to two sockets with six cores each: How can you place the threads of an OpenMP program running with 4 threads among both sockets and bind them to a core?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+ Click and submit to see the answer
 +
|| Set <code>OMP_PROC_BIND=spread</code> and <code>OMP_PLACES=cores</code>
 +
</quiz>
 +
{{hidden end}}
 +
 +
    Why is it important to initialize your data in parallel when executing on a NUMA architecture? (Initializing the data in parallel distributes the date amoung the different sockets. When accessing the data in a hotspot region in the same pattern you avoid remote memory accesses.)
 +
    Why is it important to bind the threads? (Otherwise the operating system might decide to migrate the thread from one core to anothers. This results in a performance penalty due to the context switch and a potential remote data access on NUMA architectures.)
 +
    Given a NUMA architecture with to two sockets with six cores each: How can you place the threads of an OpenMP program running with 4 threads among both sockets and bind them to a core? (Set OMP_PROC_BIND=spread and OMP_PLACES=cores )

Revision as of 11:09, 2 November 2020



HPC.NRW
HPC.NRW
Other HPC Courses
1. Gprof Tutorial
2. Introduction to Linux in HPC
OpenMP in Small Bites
1. Overview
2. Worksharing
3. Data Scoping
4. Non-Uniform Memory Access







Video

Quiz

1. Why is it important to initialize your data in parallel when executing on a NUMA architecture?

Click and submit to see the answer

2. Why is it important to bind the threads?

Click and submit to see the answer

3. Given a NUMA architecture with to two sockets with six cores each: How can you place the threads of an OpenMP program running with 4 threads among both sockets and bind them to a core?

Click and submit to see the answer

   Why is it important to initialize your data in parallel when executing on a NUMA architecture? (Initializing the data in parallel distributes the date amoung the different sockets. When accessing the data in a hotspot region in the same pattern you avoid remote memory accesses.)
   Why is it important to bind the threads? (Otherwise the operating system might decide to migrate the thread from one core to anothers. This results in a performance penalty due to the context switch and a potential remote data access on NUMA architectures.)
   Given a NUMA architecture with to two sockets with six cores each: How can you place the threads of an OpenMP program running with 4 threads among both sockets and bind them to a core? (Set OMP_PROC_BIND=spread and OMP_PLACES=cores )