Intel® Fortran Compiler 18.0 Developer Guide and Reference
General Compiler Directive: Overrides default heuristics for vectorization of DO loops. It can also affect certain optimizations.
!DIR$ VECTOR [clause[[,] clause]...]
!DIR$ NOVECTOR
clause |
Is an optional vectorization or optimizer clause. It can be one or more of the following:
|
The VECTOR and NOVECTOR directives control vectorization of the DO loop that directly follows the directive.
If the MASK_READWRITE clause is specified, the compiler generates masked loads and stores within all conditional branches in the loop. If the NOMASK_READWRITE clause is specified, the compiler generates unmasked loads and stores for increased performance.
The VECTOR directive should be used with care. Overriding the efficiency heuristics of the compiler should only be done if you are absolutely sure the vectorization will improve performance.
The compiler normally does not vectorize DO loops that have a large number of non-unit stride references (compared to the number of unit stride references).
In the following example, vectorization would be disabled by default, but the directive overrides this behavior:
!DIR$ VECTOR ALWAYS
do i = 1, 100, 2
! two references with stride 2 follow
a(i) = b(i)
enddo
There may be cases where you want to explicitly avoid vectorization of a loop; for example, if vectorization would result in a performance regression rather than an improvement. In these cases, you can use the NOVECTOR directive to disable vectorization of the loop.
In the following example, vectorization would be performed by default, but the directive overrides this behavior:
!DIR$ NOVECTOR
do i = 1, 100
a(i) = b(i) + c(i)
enddo