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

implied loop for write

Yu__Wenbin
初學者
8,473 檢視

I have a code to write a large array. 

WRITE(EIN,'(1X,i8,2ES20.10)') (i,coord(i,:),i=1,nnode)

it stops at i=63800. Do you know why? Thanks a lot for your help in advance!

0 積分
33 回應
jimdempseyatthecove
榮譽貢獻者 III
2,694 檢視

>>I think the issue is that coord(i,:) creates a stack temp that is not removed on each iteration through the loop.

I presume that this is due to the newer generation of programmers (compiler writers) favoring recursive algorithms as opposed to iterative algorithms....
... the code passes simple tests.... but fails in the users hands.

Hmmm.... wouldn't it be ironic if the cause was old code contained a GOTO that could be removed by recursively calling the procedure....

;)

Jim Dempsey

Steve_Lionel
榮譽貢獻者 III
2,694 檢視

No recursion here - just creation of a stack temp in a loop without cutting it back until the end of the statement.

Yu__Wenbin
初學者
2,694 檢視

Steve, your suggested solution works. 

Steve_Lionel
榮譽貢獻者 III
2,694 檢視

Glad to hear it. 

andrew_4619
榮譽貢獻者 III
2,694 檢視

Has a bug report been filed?

andrew_4619
榮譽貢獻者 III
2,694 檢視

Has a bug report been filed?

Steve_Lionel
榮譽貢獻者 III
2,694 檢視

I submitted this as issue 04460165.

andrew_4619
榮譽貢獻者 III
2,694 檢視

Thanks Steve, I would have done that in no one had because that needs fixing IMO

Ron_Green
主席
2,694 檢視

Intel bug ID is CMPLRIL0-32365

Yu__Wenbin
初學者
2,691 檢視

For windows add /link /stack:100000000 to the end of the ifort command works. However, for Linux, I can use command ulimit -s unlimited, before executing the code to resolve this issue. If I want to resolve it during compiling and linking, what command should I use? 

Yu__Wenbin
初學者
2,691 檢視

I tried to compile using -heap-arrays option, a code runs for 6 seconds using ulimit -s unlimited now runs for 10 seconds. 

Steve_Lionel
榮譽貢獻者 III
2,691 檢視

Linux doesn't allow you to set this during the build (and Windows doesn't allow you to set it during execution.)

 

Steve_Lionel
榮譽貢獻者 III
2,573 檢視

This bug got fixed a while ago - the program now completes normally with the 2021.4 compiler, but I don't know how far back the fix goes. The compiler now properly cuts back the stack on each iteration (the correct fix.)

回覆