Diagnostic 15423: loop has only one iteration

ID 662809
Updated 7/20/2017
Version Latest
Public

author-image

By

Product Version: Intel® Fortran Compiler 15.0 and a later version 

Cause:

The Intel® Fortran Compiler will not vectorize a loop when it knows the loop has only one iteration. If the user requires vectorization by using a SIMD directive, the compiler emits a warning diagnostic.

 

The vectorization report generated using Intel® Fortran Compiler's optimization and vectorization report options:

Windows* OS:  /O2  /Qopt-report:2  /Qopt-report-phase:vec    

Linux OS or OS X:  -O2 -qopt-report2  -qopt-report-phase=vec

Example:

An example below will generate the following  remark in optimization report:

subroutine f15423( a, b, n ) 
  implicit none
  real, dimension(*) :: a, b
  integer            :: i, n
  
  n=1
 
!$omp simd
  do i=1,n 
     b(i) = 1. - a(i)**2
  end do
   
end subroutine f15423

$ ifort -c -qopenmp-simd f15423.f90

f15423.f90(8): (col. 7) remark: simd loop has only one iteration

f15423.f90(8): (col. 7) warning #13379:  was not vectorized with "simd"

Resolution:

If the loop really has only one iteration, don’t use a SIMD directive or don’t code a loop.

If the statement  n=1  was inserted unintentionally, remove it and the loop will vectorize.

See also:

Requirements for Vectorizable Loops

Vectorization Essentials

Vectorization and Optimization Reports

Back to the list of vectorization diagnostics for Intel® Fortran