The parallel pragma helps the compiler resolve dependencies thereby facilitating auto-parallelization of the immediately following loop. The noparallel pragma prevents auto-parallelization of the immediately following loop.
#pragma parallel [clause[ [,]clause]...] |
where clause can be any of the following:
always[assert] |
private(var[ :expr][ ,var[ :expr]]...) |
lastprivate(var[ :expr][ ,var[ :expr]]...) |
#pragma noparallel |
The parallel pragma instructs the compiler to ignore potential dependencies that it assumes could exist and which would prevent correct parallelization in the immediately following loop. However, if dependencies are proven, they are not ignored.
The noparallel pragma prevents autoparallelization of the immediately following loop.
These pragmas take effect only if autoparallelization is enabled by the option /Qparallel (Windows* operating system) or -parallel (Linux* or Mac OS* X operating systems). Using this option enables parallelization for both Intel® microprocessors and non-Intel microprocessors. The resulting executable may get additional performance gain on Intel® microprocessors than on non-Intel microprocessors. The parallelization can also be affected by certain options, such as /arch or /Qx (Windows* operating system) or -m or -x (Linux* and Mac OS* X operating systems).
Use #pragma parallel with care. If a loop has cross-iteration dependencies, annotating it with this pragma can lead to incorrect program behavior.
Use #pragma parallel always only if it is known that parallelizing the annotated loop will improve its performance.
Copyright © 1996-2010, Intel Corporation. All rights reserved.