COPYIN Clause

Use the COPYIN clause on the PARALLEL, PARALLEL DO, and PARALLEL SECTIONS directives to copy the data in the master thread variable or common block to the thread private copies of the variables or common block. The copy occurs at the beginning of the parallel region. The COPYIN clause applies only to variables or common blocks that have been declared THREADPRIVATE.

You do not have to specify a whole common block to be copied in; you can specify named variables that appear in the THREADPRIVATE common block.

Example

INTEGER, SAVE:: X

!OMP THREADPRIVATE(X)

!OMP PARALLEL COPYIN(X)

In the following example, the common blocks BLK1 and FIELDS are specified as thread private, but only one of the variables in common block FIELDS is specified to be copied.

Example

COMMON /BLK1/ SCRATCH

COMMON /FIELDS/ XFIELD, YFIELD, ZFIELD

!$OMP THREADPRIVATE(/BLK1/, /FIELDS/)

!$OMP PARALLEL DEFAULT(PRIVATE),COPYIN(/BLK1/,ZFIELD)