Intel® Advisor User Guide

ID 766448
Date 3/22/2024
Public

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

Document Table of Contents

Parallel Frameworks

Before you can add parallel code, you must first choose a parallel framework.

There are two popular mechanisms for using threads - either use high-level parallel frameworks or explicit threading APIs. Intel recommends using parallel frameworks for both ease of use and their ability to optimize for different situations.

For managed code such as C#, use the Microsoft Task Parallel Library* (TPL).

NOTE:
C# and .NET support is deprecated starting Intel® Advisor 2021.1.

This document shows how to use the widely-used parallel frameworks for native code, which are included in the Intel® software developer tools and may be provided with other compilers:

  • Intel® oneAPI Threading Building Blocks (oneTBB)

  • OpenMP*

Intel® oneAPI Threading Building Blocks (oneTBB) is a parallel programming framework for C++ code. oneTBB is structured as a traditional C++ library, consisting of header files and a run-time library, so it can be used with any C++ compiler. Intel recommends that you consider using oneTBB for introducing parallelism into C++ programs. oneTBB programs can be run on any platform (OS/architecture pair) to which the oneTBB library has been ported. For example, the Intel® oneAPI DPC++/C++ Compiler includes oneTBB .

OpenMP is a high-level framework that supports C, C++, and Fortran. OpenMP is provided by compiler support, so you modify your sources by using compiler directives rather than using types, variables, and calls. An OpenMP program can often be changed from parallel execution to serial execution by setting an environment variable or omitting a compiler option so the compiler ignores the directives. OpenMP 2 is supported by the Microsoft, the Intel, and the GNU* C, C++ and Fortran compilers. The OpenMP 3.0 standard adds TASK support and is supported by the Intel compilers, which also support parts of OpenMP 4.0. For Microsoft and GNU compilers, consult your compiler documentation for the current level of OpenMP support.

You can also use a different parallel framework.

Windows* OS: Support for Parallel Frameworks by Microsoft and Intel Compilers

With a Fortran program, the only high-level parallel framework available is OpenMP. The following table summarizes the support by Microsoft and Intel Compilers for the recommended parallel frameworks for C/C++ programs on Windows OS systems.

Language and Compiler

oneTBB

OpenMP

C programs, Intel® C++ Compiler Classic

Supported

C++ programs, Intel® C++ Compiler Classic

Supported

Supported

C programs, Microsoft Visual C++* Compiler

Supported

C++ programs, Microsoft Visual C++ Compiler

Supported

Supported

For more information about oneTBB and OpenMP, see the corresponding sections in this Intel Advisor help system.

Linux* OS: Support for Parallel Frameworks by GNU* and Intel Compilers

With a Fortran program, the only high-level parallel framework available is OpenMP. The following table summarizes the support by GNU gcc* and Intel compilers for the recommended parallel frameworks for C/C++ programs on Linux OS systems.

Language and Compiler

oneTBB

OpenMP

C programs, Intel® C++ Compiler Classic (icc)

Supported

C++ programs, Intel® C++ Compiler Classicicc)

Supported

Supported

C programs, GNU gcc Compiler (gcc)

Supported

C++ programs, GNU gcc Compiler (gxx)

Supported

Supported

For more information about oneTBB and OpenMP, see the following sections in this Intel Advisor help system. For detailed instructions, see your compiler documentation and the resources listed in Related Information.