Auto-parallelization: Enabling, Options, Directives, and Environment Variables

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:

ifort -c -parallel myprog.f

Auto-parallelization Options

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 Directives

Auto-parallelization uses two specific directives,
!DEC$ PARALLEL
and !DEC$ NOPARALLEL.

Auto-parallelization Directives Format and Syntax

The format of Intel Fortran auto-parallelization compiler directive is:

<prefix> <directive>

where the brackets above mean:

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:

!DEC$ 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 !DEC$ 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 !DEC$ NOPARALLEL  directive disables auto-parallelization for the immediately following loop.

program main
parameter (n=100)
integer x(n),a(n)

!DEC$ NOPARALLEL
do i=1,n
x(i) = i
enddo

!DEC$ PARALLEL
do i=1,n
a( x(i) ) = i
enddo
end

Auto-parallelization Environment Variables

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 run-time scheduling.

static