To enable the auto-parallelizer, use the -parallel option. The -parallel option detects parallel loops capable of being executed safely in parallel and automatically generates multithreaded code for these loops. An example of the command using auto-parallelization is as follows:
IA-32 compilations:
prompt>ifc -c -parallel myprog.f
ItaniumŪ-based compilations:
prompt>efc -c -parallel myprog.f
The -parallel option enables the auto-parallelizer if the -O2 (or -O3) optimization option is also on (the default is -O2). The -parallel option detects parallel loops capable of being executed safely in parallel and automatically generates multithreaded code for these loops.
-parallel |
Enables the auto-parallelizer |
-par_threshold{1-100} |
Controls the work threshold needed for auto-parallelization, see later subsection. |
-par_report{1|2|3} |
Controls the diagnostic messages from the auto-parallelizer, see later subsection. |
Auto-parallelization uses two specific directives,
!DIR$ PARALLEL
and !DIR$
NOPARALLEL.
The format of Intel Fortran auto-parallelization compiler directive is:
<prefix> <directive>
where the brackets above mean:
<xxx>: the prefix and directive are required
For fixed form source input, the prefix is !DIR$ or CDIR$
For free form source input, the prefix is !DIR$ only.
The prefix is followed by the directive name; for example:
!DIR$ PARALLEL
Since auto-parallelization directives begin with an exclamation point, the directives take the form of comments if you omit the -parallel option.
Examples
The !DIR$ PARALLEL directive instructs the compiler to ignore dependencies which it assumes may exist and which would prevent correct parallelization in the immediately following loop. However, if dependencies are proven, they are not ignored.
The !DIR$ NOPARALLEL directive disables auto-parallelization for the immediately following loop.
program main |
Option |
Description |
Default |
OMP_NUM_THREADS |
Controls the number of threads used. |
Number of processors currently installed in the system while generating the executable |
OMP_SCHEDULE |
Specifies the type of runtime scheduling. |
static |