Parallelization Using OpenMP*

Published:08/24/2012   Last Updated:08/29/2014


Compiler Methodology for Intel® MIC Architecture

Parallelization Using OpenMP*

This chapter covers the Intel® C++ Compiler and Intel® Fortran Compiler support of OpenMP*.


OpenMP is one of many options available for you to parallelize your application (if it is not already using OpenMP). OpenMP is a popular form of threaded parallelism for shared memory multiprocessors. For the complete language specification for OpenMP, see the OpenMP Application Program Interface Version 3.1 specification, which is available from the OpenMP web site (, click the Specifications link). The descriptions of OpenMP language characteristics in this documentation will often use terms defined in the specifications.

OpenMP provides symmetric multiprocessing (SMP) with the following major features:

  • Relieves the user from having to deal with the low-level details of iteration space partitioning, data sharing, and thread creation, scheduling, and synchronization.
  • Provides benefit of performance available from shared memory multiprocessor and multi-core processor systems on all supported Intel architectures, including those processors with Intel® Hyper-Threading Technology (Intel® HT Technology).

The compiler performs transformations to generate multithreaded code based on a developer's placement of OpenMP directives in the source program making it easy to add threading to existing software. The Intel compiler supports all of the current industry-standard OpenMP directives and compiles parallel programs annotated with OpenMP directives.

Using OpenMP with the Intel Compilers

The Intel Compiler comes with a set of OpenMP samples, documentation on OpenMP usage, and language and library runtime details. Our documentation is not intended to teach OpenMP to the user new to OpenMP. For that please reference the OpenMP web site (, consult various texts available on this technology, or find web based tutorials. Samples are available with the compiler for both C++ and Fortran to help you get started. Samples are installed under the same root path as your compilers. By default, this compiler root path directory is /opt/intel/composerxe/Samples/en_US/[C++ | Fortran].

The Intel Compiler supports OpenMP 4.0 features in the latest releases.

The compiler product User and Reference Guide contains documentation on using OpenMP. Open the "Getting Started" document using the paths and links below:

locate the "Getting Started" document for your compiler (Fortran or C++), these links assume your compiler is installed on the machine, in the default location, from which you are running your browser.

  • Fortran <path to docs>/get_started_lf.htm#tutor
  • C/C++ <path to docs>/get_started_lc.htm#tutor

where <path to docs> is by default in directory /opt/intel/composerxe/Documentation/en_US

If for some reason you cannot access this directory with a web browser, you can also find this information online.  Visit

From here, find the reference to the "User and Reference Guide" document. Open that document. In the Contents navigation, navigate to "Key Features" -> "OpenMP Support".  This chapter in the documentation covers using OpenMP with the Intel compilers. Pay particular attention to the chapter "OpenMP Support" - "OpenMP Library Support" - "Thread Affinity Interface (Linux* and Windows*)". Learn the use of KMP_AFFINITY to control thread affinity. This will be discussed further with specific implications for performance on the Intel® Xeon Phi™ coprocessor in the chapter "OpenMP Affinity".

The information in the compiler User and Reference Guide is information generic to applications running on either Intel® Xeon® processors or Intel® Xeon Phi™ coprocessors. For information unique to use and performance on the Intel® Xeon Phi™ coprocessor, read the remaining subchapters in this guide: "OpenMP Affinity", "OpenMP Scheduling", and "OpenMP Collapse related BKMS". These sub-chapters are linked from the Efficient Parallelization overview chapter (see Next Steps below).

A good quick overview of using OpenMP with Intel® MIC Architecture is this article: Best Known Methods for Using OpenMP on Intel(R) Many Integrated Core (Intel(R) MIC) Architecture

Take Aways

Information on using OpenMP applications with the Intel compiler is covered in the product documentation listed above. General information on OpenMP is available online at ( Familiarize yourself with the -openmp compiler option and OpenMP related environment variables. Before leaving this chapter, make sure you can build and run OpenMP applications such as the Samples on your host platform using the Intel compilers. You should have experience using OMP_NUM_THREADS to control the number of threads. Also before progressing, make sure you understand the concept of thread affinity and use of the KMP_AFFINITY environment variable.


It is essential that you read this guide from start to finish using the built-in hyperlinks to guide you along a path to a successful port and tuning of your application(s) on Intel® Xeon Phi™ coprocessor. The paths provided in this guide reflect the steps necessary to get best possible application performance.

BACK to the chapter Efficient Parallelization

Product and Performance Information


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