Vectorization and subscript too complex

Vectorization and subscript too complex

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:


 do i=1,ni
     do j=1,nj
         zz = 0.d0
         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

 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.




2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today