Diagnostic 15018: loop was not vectorized: not inner loop
Cause:
In nested loop structures, the innermost loop is the one targeted for vectorization. The outer loop, by default, is not a target for vectorization.
Example:
program f15018 implicit none integer, parameter :: N=25 real :: a(N,N)=1.0, b(N) integer :: i, j do j=1,N do i=1,N a(i,j) = a(i,j) * i end do b(j) = 1.0 end do print*, a(3,3), b(3) end program f15018
$ ifort -c -O2 -xhost -vec-report3 f15018.f90
f15018.f90(8): (col. 3) remark: LOOP WAS VECTORIZED
f15018.f90(7): (col. 1) remark: loop was not vectorized: not inner loop
In some cases it is possible to collapse a nested loop structure into a single loop structure using
!dir$ omp simd collapse(2)
or simply
!dir$ simd
before the outer loop (line 7 above)
program f15018 implicit none integer, parameter :: N=25 real :: a(N,N)=1.0, b(N) integer :: i, j !dir$ simd do j=1,N do i=1,N a(i,j) = a(i,j) * i end do b(j) = 1.0 end do write(*,*) a(3,3), b(3) end program f15018
compiling this gives:
$ ifort -c -O2 -xhost -vec-report3 f15018.f90
f15018.f90(7): (col. 1) remark: SIMD LOOP WAS VECTORIZED