User Guide

Contents

Parallel Programming Implementations

There are two popular approaches for adding parallelism to programs. You can use either:
  • A high-level parallel framework like
    Intel® Threading Building Blocks (Intel® TBB)
    or OpenMP*. Of these parallel frameworks for native code,
    Intel TBB
    supports C++ programs and OpenMP supports C, C++, or Fortran programs. For managed code on Windows* OS such as C#, use the Microsoft Task Parallel Library* (TPL).
  • A low-level threading API like Windows* threads or POSIX* threads. In this case, you directly create and control threads at a low level. These implementations may not be as portable as high-level frameworks.
There are several reasons that Intel recommends using a high-level parallel framework:
  • Simplicity
    : You do not have to code all the detailed operations required by the threading APIs. For example, the OpenMP*
    #pragma omp parallel for
    (or Fortran
    !$OMP PARALLEL DO
    ) and the
    Intel TBB
    parallel_for()
    are designed to make it easy to parallelize a loop (see Reinders Ch. 3). With frameworks, you reason about tasks and the work to be done; with threads, you also need to decide how each thread will do its work.
  • Scalability
    : The frameworks select the best number of threads to use for the available cores, and efficiently assign the tasks to the threads. This makes use of all the cores available on the current system.
  • Loop Scalability
    :
    Intel TBB
    and OpenMP assign contiguous
    chunks
    of loop iterations to existing threads, amortizing the threading overhead across multiple iterations (see
    Intel TBB
    grain size
    : Reinders Ch. 3).
  • Automatic Load Balancing
    :
    Intel TBB
    and OpenMP have features for automatically adjusting the grain size to spread work amongst the cores. In addition, when the loop iterations or parallel tasks do uneven amounts of work, the
    Intel TBB
    scheduler will dynamically reschedule the work to avoid idle cores.
To implement parallelism, you can use any parallel framework you are familiar with.
The high-level parallel frameworks available for each programming language include:
Language
Available High-Level Parallel Frameworks
C
OpenMP
C++
Intel® Threading Building Blocks (Intel® TBB)
OpenMP
C#
Microsoft Task Parallel Library* (Windows* OS only)
Fortran
OpenMP

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