directive for loop blocking?

directive for loop blocking?

Hi, everyone!

I'm looking for a directive that can tell the compiler to perform "loop blocking" automatically. With -O3 option, the compiler is able to block some simple loops, e.g. the triple loop in a matrix matrix multiplication. However, the compiler may be "puzzled" by more complicated loop structures (DO loop only). Is there any directives can help the compiler to block the loops (DO-loop is enough for my work)?

Thank you in advance!

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

Can you provide an example and describe the problem in additional detail.

Jim Dempsey

for example, a simple matrix matrix multiplication is

do j=1, n
do k=1, n
do i=1, n
c(i,j) = c(i,j) + a(i,k)*b(k,j)
enddo
enddo
enddo

ifort -O3 can do loop blocking automatically.

But, "ifort -O3" fails to block the loops for the follow code.

do j=1, n
do k=1, n
temp=b(k,j) ! temp in register
do i=1, n
c(i,j) = c(i,j) + a(i,k)*t
enddo
enddo
enddo

This example raises the possibility that you mean introduction of an undefined variable suppresses optimization. That should not be surprising.
If you mean you're interested in the directives !dir$ unroll_and_jam or !dir$ simd private, please refer to the ifort documentation, then present a clearer example of your intent.

Leave a Comment

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