Intel® Advisor Help

Annotating Code for Deeper Analysis

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:

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:

  • The parallel site region by adding site begin and site end annotations.

  • The parallel task loop by adding a single iteration task annotation at the start of the loop body.

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:

  • The parallel site region by adding site begin and site end annotations.

  • Each parallel task region by adding task begin and task end annotations.

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).


nqueens sample showing parallel site and task

Before you convert your serial program into a parallel program, you need to:

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.

See Also