Intel® Advisor Help
Before you can
mark the best parallel opportunities by adding
Intel Advisor
annotations
, you need
to
choose likely places to add parallelism. This section provides a
series of topics that explain factors to consider as you examine the candidate
code regions and their execution and choose candidate places.
The operations of a serial program execute one after another in a well-defined order, starting at the beginning, continuing to the end, and then stopping. A parallel program, on the other hand, is made up of tasks - portions of the program that may execute independently on separate cores. Tasks can either be implemented in separate functions or in iterations of a loop.
You mark your proposed code regions by adding Intel Advisor annotations that identify the:
Parallel site: A code region that contains one or more parallel tasks. Execution of a parallel site constrains the time during which the tasks that it contains can execute. Although execution of a parallel site begins when its execution reaches its beginning, tits execution terminates only after all tasks that started within it have completed. In parallel frameworks, this corresponds to the join location in the code where all tasks have completed.
Parallel tasks: Task code regions run independently, at the same time as other tasks within the parallel site and the enclosing parallel site itself. Also, each task can have multiple instances of its code executing. As shown in the table below, there are two forms of task annotations:
Characteristics of Parallel Site Code |
Parallel Site and Task Annotations |
Comments and Limitations |
---|---|---|
A loop that requires only a single task. For simple loops, begin with the type of task annotation, unless the task does not include the entire loop body. Example code: nqueens_Advisor C/C++ sample and nqueens Fortran and C# samples |
Add three annotations to mark:
|
Based on the Suitability tool performance predictions, you may want to try using multiple tasks. In this case, remove the single iteration task annotation and replace it with task begin and task end annotations for each task (see the next row). If the loop structure is complex, you may need to mark the task begin and task end region by using the task annotations in the next row. |
Complex loop, code that allows multiple tasks, or non-loop code Example code: stats C++ sample |
Add four annotations to mark:
|
|
After you choose several places to add parallelism, view the data displayed in the Survey Report window. Use this data and your code editor to add annotations to mark the candidate parallel sites and their task(s). Make sure that these annotations are executed by the selected target executable.
The site and task annotations enable the Intel Advisor Suitability and Dependencies tools to predict your serial program's execution as a parallel program. These tools perform extensive analysis of your running serial program to provide data needed to help you decide the best place(s) to add parallelism.
To take advantage of the Intel Advisor parallel design capabilities, experiment with different possible parallel code regions by modifying the site and task annotations and their locations, rebuilding your application's target, and running the Suitability and Dependencies tools again.
The following figure illustrates the nqueens_Advisor C/C++ sample code to show the task (blue background) and its enclosing parallel site (orange background).
Before you convert your serial program into a parallel program, you need to:
Understand where your program is spending its time.
Decide how to divide that work up into tasks that can execute in parallel.
The following sections describe the process of choosing parallel sites and tasks, including identifying where to add parallelism and guidance about adding parallel sites and tasks.