Intel® Advisor User Guide

ID 766448
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Multiple Parallel Sites

You may be able to introduce parallelism independently in more than one place in a program.

For example, consider a C/C++ program with the general structure:

initialize(data);
while (!done) {
    display_on_screen(data);
    update(data);
}

You might be able to parallelize the display and update operations independently:

display_on_screen(data)
{
    ANNOTATE_SITE_BEGIN(site_display);
    for (each block of data) {
        ANNOTATE_ITERATION_TASK(task_display);
        display the block of data;
    }
    ANNOTATE_SITE_END();
}
update(data)
{
    ANNOTATE_SITE_BEGIN(site_update);
    for (each block of data) {
        ANNOTATE_ITERATION_TASK(task_update);
        update the block of data;
    }
    ANNOTATE_SITE_END();
}

Each iteration of the main loop would still do the display and then the update, but the display and update operations could be performed much faster.

Depending on your program, you need to decide whether to implement multiple parallel sites at the same or at different times:

  • When two parallel sites are truly disjoint or have overlapping functions that are purely functional and do not show problems reported by the Dependencies tool, you can consider parallelizing those sites separately at different times.

  • When considering multiple parallel sites that overlap on the same call trees - such as multiple sites that call the same (common) utility functions - consider parallelizing or not parallelizing the entire set of parallel sites at the same time.

You need to determine the cause of each dependency and fix it. If you have multiple parallel sites that overlap on the same call trees - such as multiple sites that call the same utility functions (common code) - read the help topic Fixing Problems in Code Used by Multiple Parallel Sites.