Developer Guide and Reference

Contents

Enabling Auto-parallelization

To enable the auto-parallelizer, use the
[Q]parallel
option. This option detects parallel loops capable of being executed safely in parallel, and automatically generates multi-threaded code for these loops.
You may need to set the
KMP_STACKSIZE
environment variable to an appropriately large size to enable parallelization with this option.
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
(Windows*),
-m
(Linux*
and
macOS*
), or
[Q]x
.
An example of the command using auto-parallelization is as follows:
Commanding auto-parallelization in Linux*
icc -c -parallel prog.cpp
Commanding auto-parallelization in Windows*
icl /c /Qparallel prog.cpp
Commanding auto-parallelization in
macOS*
icc -c -parallel prog.cpp
Auto-parallelization uses two specific
pragmas:
#pragma parallel
and
#pragma noparallel
.
The format of an auto-parallelization compiler
pragma
is below:
Syntax
<prefix> <pragma>
where
<prefix>
indicates
#pragma
, the
<prefix>
is followed by the pragma name, as in:
Syntax
#pragma parallel
The
#pragma parallel
pragma
instructs the compiler to ignore dependencies that it assumes may exist and that would prevent correct parallelization in the immediately following 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 increases performance. It allows a loop to be parallelized even if the compiler thinks parallelization may not improve performance. If the
ASSERT
keyword is added, as in
#pragma parallel [always [assert]]
, the compiler generates an error-level assertion message saying that the compiler analysis and cost model indicate that the loop cannot be parallelized.
The
#pragma noparallel
pragma
disables auto-parallelization.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804