Dear all,
I have been puzzled by the heap-arrays flag in intel Fortran for some years. Like below,
I usually always set heap arrays size as 0, so always heap arrays, so that I can prevent stack overflow issue without change the code, and without too much thinking.
But recently, I more and more feel that there is something I am missing. Because sometime my code with or without this /heap-arrays0 flag, speed will change a lot.
As @dwwork points out in below thread
https://fortran-lang.discourse.group/t/why-stack-is-faster-than-heap-and-what-exactly-is-stack/2130/3?u=crquantum
that,
So perhaps no need to use this heap-array flag, just leave it blank as system default. Because enabling heap-arrays sometimes will cause some strange performance loss issue.
But then my question is, do I then have to put all the arrays allocable to prevent stack overflow?
Like, what do you guys do, if you do not use heap-arrays0 flag, and also want to prevent stack overflow?
Do you just put all the arrays as allocable?
If so, will you have a lot of allocate and deallocate stuff in your code?
Will that be very cumbersome and also slow down your code a lot? Especially if there are many allocate and deallocate in a big loop.
Thanks a lot in advance!