Enabling OpenMP* in your Build Environment

OpenMP* is supported by certain versions of the Microsoft Visual C++* compiler, the GNU* compilers, and the Intel compilers:

  • Most recent versions of the Microsoft Visual C++* compiler include OpenMP support.
  • Certain editions of the Intel® Parallel Studio XE software suite includes the Intel® C++ Compiler and the Intel® Fortran Compiler, which supports the TASK feature introduced with OpenMP 3.0.

For information about OpenMP support for the Microsoft compilers, see your Microsoft Visual Studio help. For information about OpenMP support for the GNU compilers, see your compiler help or the appropriate man page, such as gcc(1).

To enable OpenMP on the command line, specify the appropriate compiler option (see your compiler documentation), such as the -openmp/Qopenmp option when using the Intel compilers.

To enable OpenMP on a Windows OS system using Microsoft Visual Studio*:

  1. In Solution Explorer, select (click) the name of one or more projects. To select multiple projects, hold down the Ctrl key.
  2. Select Project > Properties or right-click the project name and select Properties from the pop-up menu.
  3. Specify the Configuration Properties for your C/C++ or Fortran project(s):

    C/C++ > Language

    Specify OpenMP Support as Yes

    Fortran > Language

    Specify OpenMP Support as Yes

  4. Click OK to save the specified properties.
  5. Repeat the steps above for other configurations.
  6. You should check your startup project properties before starting a build.
You have set up your environment for OpenMP support.

Note

Even if you are only using the #pragma omp pragmas within your source, Visual C++ sources compiled with the Microsoft compilers need to #include <omp.h>. Otherwise, running the application will be missing a .dll at load time.

To include the appropriate OpenMP environment when using the Intel Fortran compiler, specify the use omp_lib statement.

For more complete information about compiler optimizations, see our Optimization Notice.