MASTER (TU*X only)

OpenMP Parallel Compiler Directive: Specifies a block of code to be executed by the master thread of the team.

Syntax

c$OMP MASTER
     block
c$OMP END MASTER


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


block
Is a structured block (section) of statements or constructs. You cannot branch into or out of the block.

Rules and Behavior

When the MASTER directive is specified, the other threads in the team skip the enclosed block (section) of code and continue execution. There is no implied barrier, either on entry to or exit from the master section.

See Also: Parallel Directives for Tru64 UNIX Systems, OpenMP Fortran API Compiler Directives (TU*X only), Compaq Fortran Parallel Compiler Directives (TU*X only)

Examples

The following example forces the master thread to execute the routines OUTPUT and INPUT:

  c$OMP PARALLEL DEFAULT(SHARED)
        CALL WORK(X)
  c$OMP MASTER
        CALL OUTPUT(X)
        CALL INPUT(Y)
  c$OMP END MASTER
        CALL WORK(Y)
  c$OMP END PARALLEL