WORKSHARE

OpenMP* Fortran Compiler Directive: Divides the work of executing a block of statements or constructs into separate units. It also distributes the work of executing the units to threads of the team so each unit is only executed once.

Syntax

c$OMP WORKSHARE

   block

c$OMP END WORKSHARE[ NOWAIT]

c

Is one of the following: C (or c), !, or * (see Syntax Rules for Compiler Directives).

block

Is a structured block (section) of statements or constructs. No branching into or out of the block of code is allowed.

The block is executed so that each statement is completed before the next statement is started and the evaluation of the right hand side of an assignment is completed before the effects of assigning to the left hand side occur.

The following are additional rules for this argument:

  • block may contain statements which bind to lexically enclosed PARALLEL constructs. Statements in these PARALLEL constructs are not restricted.

  • block may contain ATOMIC directives and CRITICAL constructs.

  • block must only contain array assignment statements, scalar assignment statements, FORALL statements, FORALL constructs, WHERE statements, or WHERE constructs.

  • block must not contain any user defined function calls unless the function is ELEMENTAL.

If you do not specify the NOWAIT keyword, synchronization is implied following the code.

See Also