Developer Guide and Reference

Contents

Automatic Parallelization

The auto-parallelization feature of the Intel®
C++
Compiler automatically translates serial portions of the input program into equivalent multithreaded code. Automatic parallelization determines the loops that are good worksharing candidates, performs the dataflow analysis to verify correct parallel execution, and partitions the data for threaded code generation as needed
in programming with OpenMP* directives
. The
OpenMP* and
auto-parallelization functionality provides the performance gains from shared memory on multiprocessor and dual core systems.
The auto-parallelizer analyzes the dataflow of the loops in the application source code and generates multithreaded code for those loops which can safely and efficiently be executed in parallel.
This behavior enables the potential exploitation of the parallel architecture found in symmetric multiprocessor (SMP) systems.
The guided auto-parallelization feature of the Intel®
C++
Compiler helps you locate portions in your serial code that can be parallelized further. You can invoke guidance for parallelization, vectorization, or data transformation using specified compiler options of the
[Q]guide
series.
Automatic parallelization frees developers from having to:
  • Find loops that are good worksharing candidates.
  • Perform the dataflow analysis to verify correct parallel execution.
  • Partition the data for threaded code generation as is needed
    in programming with OpenMP* directives
    .
Although OpenMP* directives enable serial applications to transform into parallel applications quickly, you must explicitly identify specific portions of your application code that contain parallelism and add the appropriate compiler directives.
Auto-parallelization, which is triggered by the
[Q]parallel
option, automatically identifies those loop structures that contain parallelism.
During compilation, the compiler automatically attempts to deconstruct the code sequences into separate threads for parallel processing. No other effort is needed.
In order to execute a program that uses auto-parallelization on Linux* or
macOS*
systems, you must include the
-parallel
compiler option when you compile and link your program.
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
.
Serial code can be divided so that the code can execute concurrently on multiple threads. For example, consider the following serial code example.