User Guide

  • 2020
  • 06/18/2020
  • Public Content
Contents

Adding Parallelism to Your Program

Once you have completed the previous steps in the
Threading 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, 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) (on Windows* OS systems only), 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.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804