ifort 14.0.0 optimization regression?

ifort 14.0.0 optimization regression?

Steven V.的头像

After installing the new ifort 14.0.0, there is a problem in my program. A small function with a loop (DblFac in the attached source code) is being inlined and somehow stuck in an infinite loop. I managed to extract the relevant source file and attached it as sphere.f.

Compiling with "ifort -i8 sphere.f -mkl", the program is stuck in an infinite loop. Using "-fno-inline" works fine, as does disabling optimization with "-O0". Previous versions of ifort did not have this problem, so could this be some regression?

If anyone can help me, or tell me how to find out more about the problem, that would be great.

greetings,

Steven

environment details:
ifort --version: ifort (IFORT) 14.0.0 20130728
uname -a: Linux arch 3.10.10-1-ARCH #1 SMP PREEMPT Fri Aug 30 11:30:06 CEST 2013 x86_64 GNU/Linux 

附件尺寸
下载 sphere.f43.86 KB
7 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
HeinzB (Intel)的头像

Hello Steven

I will look into it

Heinz

Tim Prince的头像

I see that the option -check bounds suppresses the problem without completely disabling in-lining.  Of course, that's not a solution.

Steven V.的头像

Thanks to you both for looking into it.

FYI: the original code is Fortran 77 and uses some tricks to allocate arrays dynamically, so unfortunately I can't use "-check bounds" there. I did use it once I isolated this single file, to make sure it wasn't a bug on our part (at least, not an obvious bug on our part).

HeinzB (Intel)的头像

I confirm the regression for 14.0  and it is caused by the in-lining as you assumed in your initial post. Different from the 13.x compiler, the 14.0 compiler in-lines routine NrmSph() too - and this seems to cause the fault. Curiously, the bug disappears in case I textually replace the statment function in NrmSph like changing  :

       temp=temp+P(iad(ix,iy,iz),m)*P(iad(jx,jy,jz),m)

to :

       temp=temp+P((iy+iz)*(iy+iz+1)/2+iz+1,m)* P((iy+iz)*(iy+iz+1)/2+iz+1,m)

And the issue disappears too in case I  compile by -O3 ( the default is -O2).  Both might be workarounds for you. A more reliable workaround would be to put DblFac()  into a seperate source file ( and not using -ipo for compilation): this will prevent the in-lining for sure. 

Later I  will add the case number here when I have entered the issue into our bug tracing system.

HeinzB (Intel)的头像

I have reported the problem to engineering: Case numer is DPD200248141. I will let you know, when a fix will be available,

Steven V.的头像

Thank you for your efforts.

Regarding the "-O3" option, I did notice something peculiar. It works indeed on the file I attached, but it doesn't work in the actual program. So, I separated out the "main" program at the top of sphere.f and put it in the file main.f. Then I compiled with:

ifort -i8 -O3 main.f sphere.f -mkl

This works as well. However, if I then remove the write statements in the loop inside DblFac (like in the actual program), it goes into an infinite loop again. Removing the write statements in the original sphere.f has no effect, it always works with "-O3".

附件: 

附件尺寸
下载 sphere.f43.65 KB
下载 main.f110 字节

登陆并发表评论。