To enable the auto-parallelizer, use the -parallel (Linux*) or /Qparallel (Windows*) option. This 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:
Platform |
Description |
---|---|
Linux |
ifort -c -parallel myprog.f |
Windows |
ifort -c /Qparallel myprog.f |
The -parallel (Linux) or /Qparallel (Windows) option enables the auto-parallelizer if the -O2 or -O3 (Linux) or /O2 or /O3 (Windows) optimization option is also specified. This option detects parallel loops capable of being executed safely in parallel and automatically generates multithreaded code for these loops.
Windows |
Linux |
Description |
---|---|---|
/Qparallel |
-parallel |
Enables the auto-parallelizer. See Parallelism Overview for more information. |
/Qpar-threshold |
-par-threshold |
Controls the work threshold needed for auto-parallelization. See Parallelism Overview for more information. |
/Qpar-report |
-par-report |
Controls the diagnostic messages from the auto-parallelizer, see later subsection. See Parallelism Overview for more information. |
Auto-parallelization uses two specific directives, !DEC$ PARALLEL and !DEC$ NO PARALLEL.
The format of an auto-parallelization compiler directive is:
Syntax |
---|
<prefix> <directive> |
where the brackets above mean:
<xxx>: the prefix and directive are required
For fixed form source input, the prefix is !DEC$ or CDEC$
For free form source input, the prefix is !DEC$ only
The prefix is followed by the directive name; for example:
Syntax |
---|
!DEC$ PARALLEL |
Since auto-parallelization directives begin with an exclamation point, the directives take the form of comments if you omit the -parallel (Linux) or /Qparallel (Windows) option.
The !DEC$ PARALLEL directive instructs the compiler to ignore dependencies that 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 !DEC$ NOPARALLEL directive disables auto-parallelization for the following loop:
Example |
---|
program main !DEC$ NOPARALLEL !DEC$ PARALLEL |
Option Variable |
Default |
Description |
---|---|---|
OMP_NUM_THREADS |
Number of processors currently installed in the system while generating the executable |
Controls the number of threads used. |
OMP_SCHEDULE |
Static |
Specifies the type of run-time scheduling. |