Skip to content

Latest commit

 

History

History
62 lines (50 loc) · 2.1 KB

c_directive_format.md

File metadata and controls

62 lines (50 loc) · 2.1 KB
layout title release_number author tutorial
tutorial_page
OpenMP Directives: C/C++ Directive Format
UCRL-MI-133316
Blaise Barney, Lawrence Livermore National Laboratory
OpenMP

Format:

<style type="text/css"> .tg {border-collapse:collapse;border-spacing:0;} .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px; overflow:hidden;padding:10px 5px;word-break:normal;} .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px; font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;} .tg .tg-fdm5{background-color:#98ABCE;font-weight:bold;text-align:center;vertical-align:middle} .tg .tg-xq0d{background-color:#98ABCE;font-weight:bold;text-align:center;vertical-align:top} .tg .tg-0lax{text-align:left;vertical-align:top} </style>
#pragma omp directive-name [clause, ...] newline
Required for all OpenMP C/C++ directives. A valid OpenMP directive must appear after the pragma and before any clauses. Optional. Clauses can be in any order, and repeated as necessary unless otherwise restricted. Required. Precedes the structured block which is enclosed by this directive.

Example:

#pragma omp parallel default(shared) private(beta,pi)

General Rules:

  • Case sensitive.

  • Directives follow conventions of the C/C++ standards for compiler directives.

  • Only one directive-name may be specified per directive.

  • Each directive applies to at most one succeeding statement, which must be a structured block.

  • Long directive lines can be "continued" on succeeding lines by escaping the newline character with a backslash ("") at the end of a directive line.

#pragma omp <directive>

    [ structured block of code ]