Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28508 Discussions

Vectorization and subscript too complex

esatel
Beginner
262 Views

Hi, I am trying to understand better the data dependence and  "subscript too complex" rules on vectorization. Here is an example of what I don't understand:

  [fortran]

 do i=1,ni
     do j=1,nj
         zz = 0.d0
!DIR$ IVDEP 
         do k=1,nk
             !!zz(k)=zz(k)+ arr(k,j,i)           ! vectorizes along with line below
             !! zz(k)=zz(k)+ arr(k,j-1,i)      ! vectorizes along with line above
             zz(k)=zz(k)+ arr(k,j,i)+ arr(k,j-1,i)    !subscript too complex

        end do
      end do
  end do

[/fortran]

 I found that (under ifort 2012 -O2) the line involving zz gives the subscript too complex error. If I swap this for the commented lines, they vectorize. Can someone explain what I am not grasping? The array arr is allocatable.

Thanks,

Eli

 

0 Kudos
1 Reply
TimP
Honored Contributor III
262 Views

Why are you zeroing out the entire array each time you are about to enter the inner loop?

If you meant to zero out some section of the array which you are about to modify, write it that way.

0 Kudos
Reply