This topic presents specific Fortran language features that better help to vectorize code.
The SIMD vectorization feature is available for both Intel® microprocessors and non-Intel microprocessors. Vectorization may call library routines that can result in additional performance gain on Intel® microprocessors than on non-Intel microprocessors. The vectorization can also be affected by certain options, such as /arch (Windows* OS), -m (Linux*OS and OS X*), or [Q]x.
!DIR$ ATTRIBUTES ALIGN:N declaration enables you to overcome hardware alignment constraints. The restrict qualifier and the auto-vectorization hints address the stylistic issues due to lexical scope, data dependency, and ambiguity resolution. The SIMD feature's directive allows you to enforce vectorization of loops.
!DIR$ ATTRIBUTES VECTOR::FUNCTION-NAME-LIST and the
!DIR$ ATTRIBUTES VECTOR[:CLAUSES]::FUNCTION-NAME-LIST directives can be used to vectorize user-defined functions and loops. For SIMD usage, the vector function is called from a loop that is being vectorized. The function must be implemented in vector operations as part of the loop.
The usage model of the VECTOR directive option is that the code generated for the function actually takes a small section ( VECTORLENGTH ) of the array, by value, and exploits SIMD parallelism, whereas the implementation of task parallelism is done at the call site.
The following table summarizes the language features that help vectorize code.
These directives are available for both Intel® microprocessors and non-Intel microprocessors, but they may perform additional optimizations for Intel® microprocessors than they perform for non-Intel microprocessors.