-heap-arrays

-heap-arrays

I was very happy to see in the new Release Notes a reference to an option -heap-arrays!!! This will save me a lot of trouble.

The release notes don't say what size does for the option. I presume it's some sort of threshold- smaller than size bytes will be allocated on the stack?

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Steve Lionel (Intel)'s picture

Yes, that's what it's for, but it's only when the compiler knows at compile-time what the size is, so the option isn't very useful. Note that in the current release, the -heap-arrays option is not accepted by the ifort driver - oops! That will be fixed in an update later this month. In the meantime, use:

-Qoption,f,"-heap_arrays 0"

Steve

Hm. That's interesting- in VC++ ifort complained about /heap-arrays. But on my Intel iMac I used ifort -O3 -heap-arrays and it didn't complain. On OS X does it just silently do nothing?

Steve Lionel (Intel)'s picture

I don't know for certain. My understanding is that in all of the current (as of today) 9.1 compilers, this option is not recognized by the ifort command. As I mentioned over in the Windows forum, you don't need this option if your program otherwise runs - that is, it doesn't die with a stack overflow error. Enabling this option will reduce performance somewhat due to the overhead of the extra allocate and deallocate.

Steve
Lorri Menard (Intel)'s picture

Ah, alas, no, it doesn't "silently do nothing" ...

I'm guessing your command was actually something like:
ifort -c -O3 -heap-arrays file.f

If you don't have the "-c", the ifort driver tries to pass "-h eap-arrays" to ld.

- Lorri

That's exactly right, Lorri. I'm building a static library of Fortran code to be linked into my Company's product written in C and C++, so I'm only interested in the object files. Since I don't link with ifort, I guess the erroneous linker option just gets tossed.

I will use Steve's work-around for now.

Login to leave a comment.