HP C/aC++ for PA-RISC Software manual OMP Master Pragma, OMP Ordered Pragma, OMP Parallel Pragma

Models: C/aC++ for PA-RISC Software

1 230
Download 230 pages 50.97 Kb
Page 112
Image 112

at exit from single

at exit from for

at exit from sections

NOTE: The directive is not implied if a nowait clause is present.

OMP MASTER Pragma

#pragma omp master structured-block

The master pragma directs that the structured-blockfollowing it should be executed by the master thread (thread 0) of the team. Other threads in the team do not execute the associated block.

OMP ORDERED Pragma

#pragma omp ordered structured-block

The ordered pragma indicates that the following structured block should be executed in the same order in which iterations will be executed in a sequential loop.

An ordered directive must be within the dynamic extent of a for or a parallel for construct that has an ordered clause. When the ordered clause is used with schedule which has a chunksize, then the chunksize is ignored by the compiler.

OMP PARALLEL Pragma

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

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

clause can be one or more of the following:

private(list)

firstprivate(list)

default(sharednone)

shared(list)

reduction(op:list)

if (scalar-expression)

copyin (list)

num_threads

The parallel pragma defines a parallel region, which is a region of the program that is executed by multiple threads in parallel. This is the fundamental construct that starts parallel execution.

OMP PARALLEL FOR Pragma

#pragma omp parallel for [clause1, clause2, ... ] for-loop

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

The parallel for pragma is a shortcut for a parallel region that contains a single for pragma. parallel for admits all the allowable clauses of the parallel pragma and the for pragma except for the nowait caluse.

112 Pragma Directives and Attributes

Page 112
Image 112
HP C/aC++ for PA-RISC Software manual OMP Master Pragma, OMP Ordered Pragma, OMP Parallel Pragma, OMP Parallel for Pragma