About Adding Parallelism to Your Program

Once you have completed the previous steps in the Intel® Advisor workflow and have tested and approved a serial version of your application program, you can add parallelism to a selected parallel site. Before you add parallel framework code, you should complete developer/architect design and code reviews about the proposed parallel changes.

To add parallelism to your program, perform the following steps:

  1. Choose one parallel programming framework (threading model) for your application, such as Intel® Threading Building Blocks (Intel® TBB), OpenMP*, Intel® Cilk™ Plus, or some other parallel framework. To learn about the parallel framework(s) available for your application's language, see the help topic Overview of Parallel Frameworks (use the link under See Also below).

  2. Add the parallel framework to your build environment.

  3. Add parallel framework code to synchronize access to the shared data resources, such as Intel TBB or OpenMP locks or Intel Cilk Plus reducers.

  4. Add parallel framework code to create the parallel tasks.

In the last two steps, as you add the appropriate parallel code from the chosen parallel framework, you can keep, comment out, or replace the Intel Advisor annotations.

You should add the synchronization code - such as Intel Cilk Plus reducers or Intel TBB or OpenMP locks or mutexes - before adding the parallelism. Synchronized code without parallelism works correctly. In contrast, parallel code without synchronization works incorrectly.

With the synchronization in place, introduce the parallelism. This will cause the operations of multiple tasks to execute in parallel. If you have any remaining bugs caused by data sharing and synchronization problems, they will begin to appear and must be debugged.

The following sections describe the steps needed to add parallelism to your program (listed above).

For more complete information about compiler optimizations, see our Optimization Notice.