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
Beginner
3,369 Views

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 Kudos
33 Replies
jimdempseyatthecove
Honored Contributor III
1,014 Views

>>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

0 Kudos
Steve_Lionel
Honored Contributor III
1,014 Views

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

0 Kudos
Yu__Wenbin
Beginner
1,014 Views

Steve, your suggested solution works. 

0 Kudos
Steve_Lionel
Honored Contributor III
1,014 Views

Glad to hear it. 

0 Kudos
andrew_4619
Honored Contributor II
1,014 Views

Has a bug report been filed?

0 Kudos
andrew_4619
Honored Contributor II
1,014 Views

Has a bug report been filed?

0 Kudos
Steve_Lionel
Honored Contributor III
1,014 Views

I submitted this as issue 04460165.

0 Kudos
andrew_4619
Honored Contributor II
1,014 Views

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

0 Kudos
Ron_Green
Moderator
1,014 Views

Intel bug ID is CMPLRIL0-32365

0 Kudos
Yu__Wenbin
Beginner
1,011 Views

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? 

0 Kudos
Yu__Wenbin
Beginner
1,011 Views

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

0 Kudos
Steve_Lionel
Honored Contributor III
1,011 Views

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

 

0 Kudos
Steve_Lionel
Honored Contributor III
893 Views

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.)

0 Kudos
Reply