Enable OpenMP* in your Build
Environment
Enable
OpenMP* in your Build
EnvironmentOpenMP* is supported by certain versions of the
Microsoft Visual C++* compiler, the GNU* compilers, the
Intel® C++ Compiler Classic
,
Intel® Fortran Compiler Classic
,
and
Intel® oneAPI
:
DPC++/C++
Compiler- Most recent versions of the Microsoft Visual C++* compiler include OpenMP support.
- Certain editions of theIntel® C++ Compiler Classicand theIntel® Fortran Compiler Classicsupport theTASKfeature 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
(for Linux* OS) or
/Qopenmp (for Windows* OS)
option when using the Intel
compilers.
To enable OpenMP on a
Windows OS system
using Microsoft Visual Studio*:
- In Solution Explorer, select (click) the name of one or more projects. To select multiple projects, hold down theCtrlkey.
- Select>Projector right-click the project name and selectPropertiesfrom the pop-up menu.Properties
- Specify the Configuration Properties for your C/C++ or Fortran project(s):>C/C++LanguageSpecifyasOpenMP SupportYes>FortranLanguageSpecifyasOpenMP SupportYes
- Clickto save the specified properties.OK
- Repeat the steps above for other configurations.
- You should check your startup project properties before starting a build.
You have set up your environment
for OpenMP support on a Windows OS system.
After you rewrite your code to use OpenMP* parallel framework, you can analyze its performance with
Intel® Advisor
perspectives. Use the
Vectorization and Code Insights
perspective to analyze how well you OpenMP code is vectorized or use the
Offload Modeling
perspective to model its performance on a GPU.
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 Classic
,
specify the
use omp_lib
statement.