This might seem like a silly question, but I'm learning OpenMP and I am slightly confused with the terminology. Are Directives and Constructs the same thing? Or is directive an all-encompassing word that includes constructs as well as orphaned directives?
I've seen words like
PARALLEL Directive
but also PARALLEL Region Construct
And in some tutorials Work Sharing Constructs
are listed under OpenMP Directives
.
The Microsoft page makes me think that potentially the entire next line is a directive:
#pragma omp directive-name [clause[ [,] clause]...] new-line
Because of the statement, "Each directive starts with #pragma omp". And this would imply that the words parallel
and for
(and the others) are constructs. Yet, at the same time, in the exact same line above, they put directive-name
right after the pragma.
If someone could clarify, that would be great :D
There is no shame in actually reading the OpenMP specification. §1.2.2 is dedicated entirely to the OpenMP terminology. One can find various definitions in it, including:
directive - In C/C++, a
#pragma
, and in Fortran, a comment, that specifies OpenMP program behavior. COMMENT: See Section 2.1 on page 22 for a description of OpenMP directive syntax.
Section 2.1 on page 22 reads:
OpenMP directives for C/C++ are specified with the
pragma
preprocessing directive. The syntax of an OpenMP directive is formally specified by the grammar in Appendix C, and informally as follows:
#pragma omp
directive-name [clause[ [,] clause]...] new-lineEach directive starts with
#pragma omp
. The remainder of the directive follows the conventions of the C and C++ standards for compiler directives. In particular, white space can be used before and after the#
, and sometimes white space must be used to separate the words in a directive. Preprocessing tokens following the#pragma omp
are subject to macro replacement.Directives are case-sensitive.
An OpenMP executable directive applies to at most one succeeding statement, which must be a structured block.
Another handy definition:
executable directive - An OpenMP directive that is not declarative. That is, it may be placed in an executable context. COMMENT: All directives except the
threadprivate
directive are executable directives.
Then comes the construct, explained in the terms of the previous two:
construct - An OpenMP executable directive (and for Fortran, the paired end directive, if any) and the associated statement, loop or structured block, if any, not including the code in any called routines. That is, in the lexical extent of an executable directive.
Microsoft's pages simply cite parts of an (much) earlier OpenMP specification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With