OpenMP Compiler Directives and Clauses
- Updated2023-02-21
- 1 minute(s) read
OpenMP Compiler Directives and Clauses
OpenMP provides compiler directives and clauses that used together control the parallelism of regions of code. The directive keyword specifies the parallel action you want to take place. The optional clause following the keyword specifies the additional behavior you want to occur; for example, you might want the parallel region to execute only if a certain number of threads are available on a machine.
The format for OpenMP compiler directives and clauses is as follows:
#pragma omp directive [clause[[.] clause]...] newline
You can use the following OpenMP directives:
- parallel
- for
- sections
- single
- parallel for
- parallel sections
- barrier
- flush
- master
- critical
- atomic
- ordered
- threadprivate
You can use the following OpenMP clauses in conjunction with the OpenMP directives:
![]() |
Note Refer to the OpenMP Directive and Clause Usage topic for more information about valid combinations of directives and clauses. |