Visible to Intel only — GUID: GUID-7052E835-E43F-483C-A12B-0D458571DEBF
Visible to Intel only — GUID: GUID-7052E835-E43F-483C-A12B-0D458571DEBF
Add Parallelism to Your Program
Once you have completed the previous steps in the Threading perspective 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:
Choose one parallel programming framework (threading model) for your application, such as Intel® oneAPI Threading Building Blocks (oneTBB) , 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.
Add the parallel framework to your build environment.
Add parallel framework code to synchronize access to the shared data resources, such as oneTBB or OpenMP locks.
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 oneTBB 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.