Annotate Code for Deeper Analysis
- 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 thejoinlocation 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:
- For a loop with only a single task, add a single iteration task annotation within the two site annotations.
- For other code, add a task annotation pair to mark the task region's begin and end within the two site 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.
nqueens_AdvisorC/C++ sample and
nqueensFortran 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
Add four annotations to mark:
- Understand where your program is spending its time.
- Decide how to divide that work up into tasks that can execute in parallel.