General Compiler Directives: PARALLEL facilitates auto-parallelization for the immediately following DO loop. NOPARALLEL prevents this auto-parallelization.
cDEC$ PARALLEL [ALWAYS]
cDEC$ NOPARALLEL
c |
Is one of the following: C (or c), !, or *. (See Syntax Rules for Compiler Directives.) |
PARALLEL helps the compiler to resolve dependencies, facilitating auto-parallelization of the immediately following DO loop. It instructs the compiler to ignore dependencies that it assumes may exist and which would prevent correct parallelization in the loop. However, if dependencies are proven, they are not ignored.
In addition, PARALLEL ALWAYS overrides the compiler heuristics that estimate the likelihood that parallelization of a loop will increase performance. It allows a loop to be parallelized even if the compiler thinks parallelization may not improve performance.
NOPARALLEL prevents auto-parallelization of the immediately following DO loop.
These directives take effect only if you specify the compiler option that enables auto-parallelization.
The directive PARALLEL ALWAYS should be used with care. Overriding the heuristics of the compiler should only be done if you are absolutely sure the parallelization will improve performance.
program main
parameter (n=100)
integer x(n),a(n)
!DEC$ NOPARALLEL
do i=1,n
x(i) = i
enddo
!DEC$ PARALLEL
do i=1,n
a( x(i) ) = i
enddo
end