OMP PARALLEL SECTIONS Pragma

#pragma omp parallel sections [clause1, clause2, ...]

{

[#pragma omp section ] structured-block

[#pragma omp section structured-block]

. . .}

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

The parallel sections pragma is a shortcut for specifying a parallel clause containing a single sections pragma. parallel sections admits all the allowable clauses of the parallel pragma and the sections pragma except for the nowait clause.

OMP SECTIONS Pragma

#pragma omp sections [clause1, clause2, ...]

{

#pragma omp section

[ structured-block ] [#pragma omp section

structured-block ]

. . .

}

where [clause1, clause2, ...] indicates that the clauses are optional. There can be zero or more clauses. clause may be one of the following:

private(list)

firstprivate(list)

lastprivate(list)

reduction(op:list)

nowait

The section or sections pragmas identify a construct that specifies a set of constructs to be divided among threads in a team. Each section is executed by one of the threads in the team.

OMP SINGLE Pragma

#pragma omp single [clause1, clause2, . . .] [ structured-block]

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

clause may be one of the following:

private(list)

firstprivate(list)

copyprivate(list)

nowait

The single directive identifies a construct that specifies the associated structured block that is executed by only one thread in the team (not necessarily the master thread).

OMP TASK Pragma

#pragma omp task [clause1, clause2, . . .] new-line [ structured-block]

Other Pragmas 113

Page 113
Image 113
HP C/aC++ for PA-RISC Software manual OMP Parallel Sections Pragma, OMP Sections Pragma, OMP Single Pragma, OMP Task Pragma