Compiling with OpenMP, Directive Format, and Diagnostics

To run the Intel® C++ Compiler in OpenMP* mode, invoke the compiler with the -openmp option:

prompt>icpc -openmp file.cpp

Before you run the multithreaded code, you can set the number of desired threads in the OpenMP environment variable, OMP_NUM_THREADS. See OpenMP Environment Variables for further information.

-openmp Option

The -openmp option enables the parallelizer to generate multithreaded code based on the OpenMP directives. The code can be executed in parallel on both uniprocessor and multiprocessor systems. The -openmp option works with both -O0 (no optimization) and any optimization level of -O1, -O2 (default) and -O3. Specifying -O0 with -openmp helps to debug OpenMP applications.

OpenMP Directive Format and Syntax

An OpenMP directive has the form:

#pragma omp directive-name [clause, ...] newline

where:

OpenMP Diagnostics

The -openmp_report{0|1|2} option controls the OpenMP parallelizer's diagnostic levels 0, 1, or 2 as follows:

The default is -openmp_report1.