Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Diagnostic 15002: loop was vectorized (Fortran)

$
0
0

 

Cause:

For the Intel® Compiler, vectorization is the unrolling of a loop combined with the generation of packed SIMD instructions. Because the packed instructions operate on more than one data element at a time, the loop can execute more efficiently. The above message indicates that the loop was successfully vectorized using packed SIMD instructions. 

Example:

program d_15002
  implicit none
  integer, parameter :: n=100
  real, dimension(n) :: x = (/(i, i=1,n)/)
  integer              :: i

  do i = 1,n
    x(i) = x(i) * 10.
  enddo

end program d_15002

> ifort -vec-report2 -c d_15002.f90                   (ifort /Qvec-report:2 /c d_15002.f90  on Windows*)

d_15002.f90(8): (col. 3) remark: LOOP WAS VECTORIZED

The loop is vectorized using packed SIMD instructions. These can be seen in the assembly file generated by the option -Fa  or -S, e.g. 

> ifort -vec-report2 -Fa d_15002.f90;   grep mul d_15002.s
d_15002.f90(8): (col. 3) remark: LOOP WAS VECTORIZED
        mulps     %xmm0, %xmm1                                  #9.5

Here, the "p" in mulps indicates that this is a packed SIMD instruction. Compare to building at -O1 :

> ifort -O1 -vec-report2 -Fa d_15002.f90;   grep mul d_15002.s
        mulss     %xmm1, %xmm0                                  #9.5

Here, the first "s" in mulss indicates that this is a scalar multiplication instruction. There is no vectorization message, because the vectorizer is not enabled at -O1, it is enabled only at default optimization (-O2) and above.

 

  • vectorization
  • Diagnostics
  • Apple OS X*
  • Linux*
  • Microsoft Windows* (XP, Vista, 7)
  • Microsoft Windows* 8
  • Fortran
  • Intel® Composer XE
  • Intel® Fortran Compiler
  • Intel® Fortran Composer XE
  • Intel® Visual Fortran Composer XE
  • Intel® Fortran Studio XE
  • Intel® Parallel Studio XE
  • Optimization
  • Vectorization
  • URL

  • Viewing all articles
    Browse latest Browse all 3270

    Trending Articles



    <script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>