A variable in a COPYPRIVATE clause must be marked as PRIVATE or THREADPRIVATE in the enclosing context.
The OpenMP* specification requires that a variable that appears in a COPYPRIVATE clause may not appear in a PRIVATE or FIRSTPRIVATE clause on the SINGLE construct. In C/C++ programs, a variable of class type (or array thereof) that appears in a COPYPRIVATE clause must have an accessible unambiguous assignment operator for the class type. In FORTRAN, assumed-size arrays may not appear in a COPYPRIVATE clause. An array with the ALLOCATABLE attribute must be in an allocated state with the same bounds in all threads affected by the COPYPRIVATE clause.
ID |
Observation |
Description |
---|---|---|
1 |
OpenMP usage error |
The place the variable was used improperly |
module mod contains subroutine sub(priv) !$OMP SINGLE print *, "SING", priv priv = 2 do while (priv == 2) print *, "SINGLE", priv end do !$OMP END SINGLE COPYPRIVATE(priv) end subroutine sub end module mod use mod integer, parameter :: N = 10 integer x priv = N x = 1 !$OMP PARALLEL DEFAULT(SHARED) NUM_THREADS(2) !$OMP MASTER print *, "MAST", priv do while (priv == 10) print *, "MASTER", priv end do priv = 1 !$OMP END MASTER do i = 1, 10000 x = 1 - x end do call sub(priv) !$OMP END PARALLEL end
Copyright © 2010, Intel Corporation. All rights reserved.