Adding Parallelism to Your Program

Once you have completed the previous steps in the Threading Advisorworkflow 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, 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*, Microsoft Task Parallel Library* (TPL), or some other parallel framework. To learn about the parallel framework(s) available for your application's language, see the help topic Parallel Frameworks.

  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.

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

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