General Compiler Directives: PARALLEL facilitates auto-parallelization for the immediately following DO loop. NOPARALLEL prevents this auto-parallelization.
cDEC$ PARALLEL [clause[[,] clause] ... ]
cDEC$ NOPARALLEL
c |
Is one of the following: C (or c), !, or *. (See Syntax Rules for Compiler Directives.) |
clause |
Is one of the following:
|
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. If the ASSERT keyword is added, the compiler will generate an error-level assertion message saying that the compiler analysis and cost model indicate that the loop cannot be parallelized.
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), k
!DEC$ NOPARALLEL
do i=1,n
x(i) = i
enddo
!DEC$ PARALLEL LASTPRIVATE (k)
do i=1,n
a( x(i) ) = i
k = x(i)
enddo
print *, k ! print 100, the value of x(n)
end
Copyright © 1996-2010, Intel Corporation. All rights reserved.