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

From HPC Wiki
OpenMP in Small Bites/Overview
Jump to navigation Jump to search
m (Use new syllabus template)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Tutorials]]
+
[[Category:Tutorials]]<nowiki />
{{Syllabus OpenMP in Small Bites}}
+
{{DISPLAYTITLE:OpenMP Overview}}
 +
{{Syllabus OpenMP in Small Bites}}<nowiki />
 
__TOC__
 
__TOC__
 +
 +
This video provides a brief history of OpenMP and then introduces the parallel region, one of the most fundamental concepts of OpenMP, used to mark code regions that are meant to be processed by multiple threads in parallel. How the code region is processed and by which threads is then controlled by other OpenMP constructs introduced in the part on [[OpenMP in Small Bites/Worksharing | Worksharing]].
  
 
=== Video === <!--T:5-->
 
=== Video === <!--T:5-->
  
<youtube width="600" height="400" right>NrgLrOxyLgU</youtube>
+
<youtube width="600" height="340" right>NrgLrOxyLgU</youtube>
 +
 
 +
([[Media:hpc.nrw_01_Introduction-Overview.pdf | Slides as pdf]])
  
 
=== Quiz === <!--T:5-->   
 
=== Quiz === <!--T:5-->   
Line 11: Line 16:
  
 
{{hidden begin  
 
{{hidden begin  
|title = 1. Out of which three components the OpenMP interface consists?
+
|title = 1. Out of which three components does the OpenMP interface consist?
 
}}
 
}}
 
<quiz display=simple>
 
<quiz display=simple>
 
{
 
{
 
|type="()"}
 
|type="()"}
+ Click and submit to see the answer
+
+ Compiler directives, runtime routines, environment variables
|| compiler directives, runtime routines, environment variables
+
|| Correct
 +
- Compiler directives, host language extensions, runtime routines
 +
|| While compiler support is needed, OpenMP does comprise host language extensions, yet also uses environment variables.
 +
- Host language extensions, runtime routines, environment variables.
 +
|| OpenMP does not comprise host language extensions, but rather uses compiler directives to insert .
 
</quiz>
 
</quiz>
 
{{hidden end}}
 
{{hidden end}}
Line 27: Line 36:
 
{
 
{
 
|type="()"}
 
|type="()"}
+ Click and submit to see the answer
+
+ Fork-Join
|| Fork-Join: An OpenMP program starts with just one worker thread (<code>master</code>). The <code>worker</code> threads are spawned in the parallel region and form a <code>team</code> of threads together with the <code>master</code>. They all join at the end of a parallel region.  
+
||  An OpenMP program starts with just one worker thread (<code>master</code>). The <code>worker</code> threads are spawned in the parallel region and form a <code>team</code> of threads together with the <code>master</code>. They all join at the end of a parallel region.
 +
- Create-Release
 +
|| An OpenMP program starts with just one worker thread (<code>master</code>). The <code>worker</code> threads are spawned in the parallel region and form a <code>team</code> of threads together with the <code>master</code>. They all join at the end of a parallel region.
 +
- Start-Wait
 +
|| An OpenMP program starts with just one worker thread (<code>master</code>). The <code>worker</code> threads are spawned in the parallel region and form a <code>team</code> of threads together with the <code>master</code>. They all join at the end of a parallel region.  
 
</quiz>
 
</quiz>
 
{{hidden end}}
 
{{hidden end}}
Line 37: Line 50:
 
<quiz display=simple>
 
<quiz display=simple>
 
{
 
{
|type="()"}
+
|type="[]"}
+ Click and submit to see the answer
+
+ Set environment variable <code>OMP_NUM_THREADS</code>.
|| a. Set environment variable <code>OMP_NUM_THREADS</code>. <br /> b. Use <code>num_threads</code> clause on a parallel construct.
+
|| True
 +
+ Use <code>num_threads</code> clause on a parallel construct.
 +
|| True
 +
- Number of threads are fixed at compile time
 +
|| False
 +
- All of the above
 +
|| False
 
</quiz>
 
</quiz>
 
{{hidden end}}
 
{{hidden end}}

Latest revision as of 09:58, 4 April 2022


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 provides a brief history of OpenMP and then introduces the parallel region, one of the most fundamental concepts of OpenMP, used to mark code regions that are meant to be processed by multiple threads in parallel. How the code region is processed and by which threads is then controlled by other OpenMP constructs introduced in the part on Worksharing.

Video

( Slides as pdf)

Quiz

1. Out of which three components does the OpenMP interface consist?

Compiler directives, runtime routines, environment variables
Compiler directives, host language extensions, runtime routines
Host language extensions, runtime routines, environment variables.

2. What is one of the key concepts of the OpenMP execution model?

Fork-Join
Create-Release
Start-Wait

3. How can you control the number of threads?

Set environment variable OMP_NUM_THREADS.
Use num_threads clause on a parallel construct.
Number of threads are fixed at compile time
All of the above