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
Débutant
14 349 Visites

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 Compliments
33 Réponses
jimdempseyatthecove
Contributeur émérite III
4 070 Visites

>>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 Compliments
Steve_Lionel
Contributeur émérite III
4 070 Visites

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

0 Compliments
Yu__Wenbin
Débutant
4 070 Visites

Steve, your suggested solution works. 

0 Compliments
Steve_Lionel
Contributeur émérite III
4 070 Visites

Glad to hear it. 

0 Compliments
andrew_4619
Contributeur émérite III
4 070 Visites

Has a bug report been filed?

0 Compliments
andrew_4619
Contributeur émérite III
4 070 Visites

Has a bug report been filed?

0 Compliments
Steve_Lionel
Contributeur émérite III
4 070 Visites

I submitted this as issue 04460165.

0 Compliments
andrew_4619
Contributeur émérite III
4 070 Visites

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

0 Compliments
Ron_Green
Modérateur
4 070 Visites

Intel bug ID is CMPLRIL0-32365

0 Compliments
Yu__Wenbin
Débutant
4 067 Visites

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 Compliments
Yu__Wenbin
Débutant
4 067 Visites

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

0 Compliments
Steve_Lionel
Contributeur émérite III
4 067 Visites

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

 

0 Compliments
Steve_Lionel
Contributeur émérite III
3 949 Visites

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 Compliments
Répondre