HOME
| OPENMP API Specification: "Version 5.2 -- GIT rev 95b2e3a44"

5.7.2  copyprivate Clause

Name: copyprivate

Properties: end-clause, data copying

Arguments

Name

Type

Properties

list

list of variable list item type

default

Directives

single

Semantics

The copyprivate clause provides a mechanism to use a private variable to broadcast a value from the data environment of one implicit task to the data environments of the other implicit tasks that belong to the parallel region. The effect of the copyprivate clause on the specified list items occurs after the execution of the structured block associated with the associated construct, and before any of the threads in the team have left the barrier at the end of the construct. To avoid data races, concurrent reads or updates of the list item must be synchronized with the update of the list item that occurs as a result of the copyprivate clause if, for example, the nowait clause is used to remove the barrier.

In all other implicit tasks that belong to the parallel region, each specified list item becomes defined with the value of the corresponding list item in the implicit task associated with the thread that executed the structured block. For variables of non-array type, the definition occurs by copy assignment. For an array of elements of non-array type, each element is copied by copy assignment from an element of the array in the data environment of the implicit task that is associated with the thread that executed the structured block to the corresponding element of the array in the data environment of the other implicit tasks.
For class types, a copy assignment operator is invoked. The order in which copy assignment operators for different variables of class type are called is unspecified.
If a list item does not have the POINTER attribute, then in all other implicit tasks that belong to the parallel region, the list item becomes defined as if by intrinsic assignment with the value of the corresponding list item in the implicit task that is associated with the thread that executed the structured block. If the list item has a type bound procedure as a defined assignment, the assignment is performed by the defined assignment. If the list item has the POINTER attribute then in all other implicit tasks that belong to the parallel region the list item receives, as if by pointer assignment, the same association status as the corresponding list item in the implicit task that is associated with the thread that executed the structured block.

The order in which any final subroutines for different variables of a finalizable type are called is unspecified.

Restrictions

Restrictions to the copyprivate clause are as follows:

Cross References