OpenMP - Difference between Directives and Constructs

openmp

Solution

If I'm reading this correctly, a directive is the OpenMP statement, like

#pragma omp for

or

#pragma omp parallel private(th_id) shared(nthreads)

A directive may include clauses, like the `private` statement above or `schedule(dynamic, CHUNKSIZE)`.

Directives combined with code form a construct. That is, a construct is a pattern to accomplish something. So a "parallel construct" is a `parallel` directive, its optional clauses, and any code to be executed:

#pragma omp parallel
  printf("Hello, world.\n");

A "worksharing construct" is a `parallel for` directive followed by the loop's code:

#pragma omp parallel for
for (i = 0; i < N; i++)
    a[i] = 2 * i;

Problem

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

Original source