icp/oer/courses/c-openmp/sections/01-introduction/00-parallel/content.md

13 lines
773 B
Markdown
Raw Normal View History

2018-05-05 22:18:02 +00:00
OpenMP is a parallelization framework that allows the programmer to easily do thread-level parallelization.
It provides simple compiler directives, with which you mark up the parts of the code, which you want to execute in parallel.
## Knowledge
The simplest compiler directive is the ``#pragma omp parallel``, which opens a parallel region, where the same code is executed on all threads.
You can find all the important directives in the [quick reference](http://openmp.org/mp-documents/OpenMP3.1-CCard.pdf).
Additional details can be found in the full [OpenMP specification](http://www.openmp.org/mp-documents/OpenMP3.1.pdf). For details on OpenMP compiler directives see section 2.
## Task
Use the omp parallel pragma to print the thread number of multiple threads.