where [clause1, clause2, ...] indicates that the clauses are optional. There can be zero or more clauses.

clause may be one of the following:

if (scalar-expression))

untied

default (shared none)

private (list)

firstprivate (list)

shared (list)

The TASK directive defines an explicit task.

OMP TASKWAIT Pragma

#pragma omp taskwait new-line

The TASKWAIT directive specifies a wait on the completion of child tasks generated since the beginning of the current task.

Because the TASKWAIT construct does not have a C language statement as part of its syntax, there are some restrictions on its placement within a program. The TASKWAIT directive may be placed only at a point where a base language statement is allowed. The TASKWAIT directive may not be used in place of the statement following an if, while, do, switch, or label.

OMP THREADPRIVATE Pragma

#pragma omp threadprivate (list)

where (list) is a comma-separated list of variables that do not have an incomplete type.

The threadprivate directive makes the named file-scope, namescope-scope, or static block-scopevariables private to a thread.

OpenMP Clauses

Clauses on directives may be repeated as needed, subject to the restrictions listed in the description of each clause. The order in which clauses appear in directives is not significant. If variable-list appears in a clause, it must specify only variables. The following is the list of clauses in OpenMP directives:

private

private(list)

The private clause declares the variables in the list to be private to each thread in a team. A new object with automatic storage duration is allocated within the associated structured block for each thread in the stream.

firstprivate

firstprivate(list)

The firstprivate clause provides a superset of the functionality provided by the private clause. Variables specified in the list have private clause semantics described earlier. The new private object is initialized, as if there is an implied declaration inside the structured block and the initializer is the value of the original object.

lastprivate

lastprivate(list)

114 Pragma Directives and Attributes

Page 114
Image 114
HP C/aC++ for PA-RISC Software manual OpenMP Clauses