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

directive for loop blocking?

woshiwuxin
Novice
1,145 Views

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!

0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
1,145 Views
Can you provide an example and describe the problem in additional detail. Jim Dempsey
0 Kudos
woshiwuxin
Novice
1,145 Views
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
0 Kudos
TimP
Honored Contributor III
1,145 Views
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.
0 Kudos
Reply