Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

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.

 


Viewing all articles
Browse latest Browse all 3384

Trending Articles



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