To run the Intel®
Fortran Compiler in OpenMP mode, you need to invoke the Intel compiler
with the
-openmp option:
IA-32 applications:
ifc -openmp input_file(s)
ItaniumŪ-based applications:
efc -openmp input_file(s)
Before you run the multithreaded code, you can set the number of desired threads to the OpenMP environment variable, OMP_NUM_THREADS. See the OpenMP Environment Variables section for further information. The Intel Extensjon Routines topic describes the OpenMP extensions to the specification that have been added by Intel in the IntelŪ Fortran Compiler.
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.
When you use the -openmp option, the compiler sets the -auto option (causes all variables to be allocated on the stack, rather than in local static storage.) for the compiler unless you specified it on the command line.
The OpenMP directives use the following format:
<prefix> <directive> [<clause> [[,] <clause> . . .]]
where the brackets above mean:
<xxx>: the prefix and directive are required
[<xxx>]: if a directive uses one clause or more, the clause(s) is required
[,]: commas between the <clause>s are optional.
For fixed form source input, the prefix is !$omp or c$omp
For free form source input, the prefix is !$omp only.
The prefix is followed by the directive name; for example:
!$omp parallel
Since OpenMP directives begin with an exclamation point, the directives take the form of comments if you omit the -openmp option.
The OpenMP constructs defining a parallel region have one of the following syntax forms:
!$omp <directive>
<structured block of code>
!$omp end <directive>
or
!$omp <directive>
<structured block of code>
or
!$omp <directive>
where <directive> is the name of a particular OpenMP directive.
The -openmp_report{0|1|2} option controls the OpenMP parallelizer's diagnostic levels 0, 1, or 2 as follows:
-openmp_report0 = no diagnostic information is displayed.
-openmp_report1 = display diagnostics indicating loops, regions, and sections successfully parallelized.
-openmp_report2 = same as -openmp_report1 plus diagnostics indicating master constructs, single constructs, critical constructs, ordered constructs, atomic directives, etc. successfully handled.
The default is -openmp_report1.