Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
Visible to Intel only — GUID: GUID-967D7284-0E6D-4B02-B679-4DEE93D96E49
Visible to Intel only — GUID: GUID-967D7284-0E6D-4B02-B679-4DEE93D96E49
VECTOR and NOVECTOR
General Compiler Directive: Overrides default heuristics for vectorization of DO loops. It can also affect certain optimizations.
Syntax
!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.
Product and Performance Information |
---|
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex. Notice revision #20201201 |
Example
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