User and Reference Guide for the Intel® Fortran Compiler 14.0

OpenMP* Directives and Clauses Summary

This is a summary of the OpenMP* directives and clauses supported in the Intel compiler. For detailed information about the OpenMP API, see the OpenMP Application Program Interface Version 4.0 specification, which is available from the OpenMP web site (http://www.openmp.org/).

PARALLEL Directive

Use this directive to form a team of threads and execute those threads in parallel.

Directive

Description

PARALLEL Directive (OpenMP*)

Defines a parallel region.

WORKSHARING Directives

Use these directives to share work among a team of threads.

Directive

Description

DO Directive

Identifies an iterative worksharing construct in which the iterations of the associated loop should be divided among threads in a team.

SECTIONS

Specifies that the enclosed SECTION directives define blocks of code to be divided among threads in a team. Each section is executed once by a thread in the team.

SINGLE

Specifies that a block of code is to be executed by only one thread in the team at a time.

WORKSHARE

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.

Combined PARALLEL and WORKSHARING Directives

Use these directives as a shortcut for a PARALLEL directive followed by a WORKSHARING directives.

Directive

Description

PARALLEL DO

Provides an abbreviated way to specify a parallel region containing a single DO directive.

PARALLEL SECTIONS

Provides an abbreviated way to specify a parallel region containing a single SECTIONS directive. The semantics are identical to explicitly specifying a PARALLEL directive immediately followed by a SECTIONS directive.

PARALLEL WORKSHARE

Provides an abbreviated way to specify a parallel region containing a single WORKSHARE directive.

TASKING Directives

Use these directives for deferring execution.

Directive

Description

TASK

Defines a task region.

TASKYIELD

Specifies that the current task can be suspended at this point in favor of execution of a different task.

MASTER and SYNCHRONIZATION Directives

Use these directives to synchronize between threads.

Directive

Description

ATOMIC

Ensures that a specific memory location is updated atomically; this prevents the possibility of multiple, simultaneous reading and writing of threads.

BARRIER

Synchronizes all the threads in a team. It causes each thread to wait until all of the other threads in the team have reached the barrier.

CRITICAL Directive

Restricts access to a block of code to only one thread at a time.

FLUSH Directive

Identifies synchronization points at which the threads in a team must provide a consistent view of memory.

MASTER

Specifies a block of code to be executed by the master thread of the team.

ORDERED

Specifies a block of code that the threads in a team must execute in the natural order of the loop iterations.

TASKGROUP

Specifies a wait for the completion of all child tasks of the current task and all of their descendant tasks.

TASKWAIT

Specifies a wait on the completion of child tasks generated since the beginning of the current task.

Data Environment Directive

Use this directive to give threads global private data.

Directive

Description

THREADPRIVATE

Specifies named common blocks to be private (local) to each thread; they are global within the thread.

Coprocessor Control Directives

Use these directives to control execution on one or more coprocessors.

Directive

Description

DECLARE TARGET

Causes the creation of a device-specific version of a named routine that can be called from a target region. This directive only applies to Intel® MIC Architecture.

DISTRIBUTE

Specifies that loop iterations will be shared among the master threads of all thread teams in a league created by a teams construct.

TARGET Directive

Creates a device data environment and executes the construct on the same device. This directive only applies to Intel® MIC Architecture.

TARGET DATA

Creates a device data environment for the extent of the region. This directive only applies to Intel® MIC Architecture.

TARGET UPDATE

Makes the list items in the device data environment consistent with their corresponding original list items. This directive only applies to Intel® MIC Architecture.

TEAMS

Creates a league of thread teams to execute a structured block in the master thread of each team.

Vectorization Directives

Use these directives to control execution on vector hardware.

Directive

Description

SIMD Directive (OpenMP*)

Requires and controls SIMD vectorization of loops.

DECLARE SIMD

Generates a SIMD procedure.

DO SIMD

Specifies a loop that can be executed concurrently using SIMD instructions.

PARALLEL DO SIMD

Specifies a parallel region that contains a loop to execute with Single Instruction Multiple Data (SIMD) instructions.

Specifies a loop that can be executed concurrently using SIMD instructions. It provides a shortcut for specifying a PARALLEL construct containing one SIMD loop construct and no other statement.

OpenMP Clauses

Use these clauses to specify options in the directives.

Clause

Description

COLLAPSE ( n )

Specifies how many nested loops of a for loop associated with the OpenMP* for construct should be collapsed into a single loop for running in parallel.

COPYIN ( list )

Provides a mechanism to copy the data values of the master thread to the THREADPRIVATE copy of the common blocks or variables specified in list, at the beginning of the parallel region.

COPYPRIVATE( list )

Provides a mechanism to use a private variable in list to broadcast a value from the data environment of one implicit task to the data environments of the other implicit tasks belonging to the parallel region.

FINAL (expr )

The expr is evaluated, and if the value is true, then this task and all its descendant tasks are not deferred (not executed in parallel).

FIRSTPRIVATE ( list )

Same as PRIVATE, but the copy of each variable in the list is initialized using the value of the original variable existing before the construct. Each private data object is initialized with the value of the original object.

IF ( expression )

The enclosed code block is executed in parallel only if the expression evaluates to .TRUE., otherwise it is serialized.

The expression must be a scalar of type logical.

LASTPRIVATE ( list )

Same as PRIVATE, but the original variables in list are updated using the values assigned to the corresponding PRIVATE variables in the last iteration in the DO construct loop or the last SECTION construct.

MERGEABLE

Indicates that the task defined by this task directive need not create a private data environment for the task, but if the task execution is deferred, then the private data environment is created.

NOWAIT

Specifies that threads need not wait at the end of worksharing constructs until they have completed execution. The threads may proceed past the end of the worksharing constructs as soon as there is no more work available for them to execute.

PRIVATE ( list )

Declares variables in list to be PRIVATE to each thread in a team. Private copies of the variable are not initialized before they are used.

REDUCTION ({operator | intrinsic}:list)

Performs a reduction on variables that appear in list with the operator operator or the intrinsic procedure name intrinsic; operator is one of the following: +, *, .AND., .OR., .EQV., .NEQV.; intrinsic refers to one of the following: MAX, MIN, IAND, IOR, or IEOR.

SCHEDULE (type[,chunk])

Specifies how iterations of the DO construct are divided among the threads of the team. Possible values for the type argument are STATIC, DYNAMIC, GUIDED, and RUNTIME. The optional chunk argument must be a positive scalar integer expression.

SHARED ( list )

Shares variables in list among all the threads in a team.

UNTIED

Indicates that a resumed task does not have to be executed by same thread executing it before it was suspended.

Directives and Clauses Cross-reference

The following table shows the clauses that you can use with the directives.

Directive

Use these Clauses

PARALLEL
END PARALLEL

  • IF

  • NUM_THREADS

  • DEFAULT

  • PRIVATE

  • FIRSTPRIVATE

  • SHARED

  • COPYIN

  • REDUCTION

DO
END DO

  • SCHEDULE

  • PRIVATE

  • FIRSTPRIVATE

  • LASTPRIVATE

  • REDUCTION

  • ORDERED

  • NOWAIT

  • COLLAPSE

SECTIONS
END SECTIONS

  • PRIVATE

  • FIRSTPRIVATE

  • LASTPRIVATE

  • REDUCTION

  • NOWAIT

SECTION

None

SINGLE
END SINGLE

  • PRIVATE

  • FIRSTPRIVATE

  • COPYPRIVATE

  • NOTWAIT

PARALLEL DO
END PARALLEL DO

  • IF

  • NUM_THREADS

  • SCHEDULE

  • DEFAULT

  • PRIVATE

  • FIRSTPRIVATE

  • LASTPRIVATE

  • SHARED

  • COPYIN

  • REDUCTION

  • ORDERED

  • COLLAPSE

PARALLEL SECTIONS
END PARALLEL SECTIONS

  • IF

  • NUM_THREADS

  • DEFAULT

  • PRIVATE

  • FIRSTPRIVATE

  • LASTPRIVATE

  • SHARED

  • COPYIN

  • REDUCTION

All others

None

See Also


Submit feedback on this help topic