Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Stack Size question in CVF

rahzan
New Contributor I
802 Views
I use the command:
df.exe /check:bounds /arch:host/nologo /threads /warn:all /traceback /dll[file.F90] link [obj files including a error catching c-wrapper]
to compile and link a DLL. On occasion when dealing with large arrays I get a stack-overflow error.
1.Can I simply raise the stack size via the /STACK: switch? or it will not have any effect in this context?
2.What is the format for /STACK, I see no examples of it in the CVF help.
3. Ditto for a LIB/OBJ compile:
df.exe /c /check:bounds /arch:host /libs:dll /nolibdir /nologo /warn:all /traceback
?
Thanks in adv.
Tim
0 Kudos
8 Replies
Steven_L_Intel1
Employee
802 Views
/stack is ignored when building a DLL. The linker reserves the stack size when building an EXE only, so it is the stack size of the EXE that calls your DLL that counts.
You don't even invoke the linker when building a .OBJ or .LIB.
The syntax is /link /stack:n where n is the size in bytes. /link tells DF that all switches following are to be sent to the linker.
If you are routinely running out of stack in your DLL, you may need to make increased use of allocatable arrays. Unfortunately, some stack use is unavoidable.
0 Kudos
rahzan
New Contributor I
802 Views

Thanks,

1. What does this mean? /stack:0x14,0x14 (the caller which is itself a com server seems to have this, does it even apply in a com server?)

2.one more question about allocatable arrays. It seems that the stack overflow (assumingthe codeis returned correctly by the c-wrapper), happens WITH large allocatable arrays.Is it true that the allocatable arrays are not a burden on the stack memory?

Tim

Message Edited by rahzan on 12-02-2003 01:55 PM

0 Kudos
Steven_L_Intel1
Employee
802 Views
1. Look up "/STACK linker option" in the on-disk documentation
2. ALLOCATABLE arrays do not themselves come from the stack, but sometimes expressions involving the arrays cause the compiler to need to create a temporary copy, and currently it uses the stack for that always.
0 Kudos
rahzan
New Contributor I
802 Views

Thanks,

Answer 2 may explain it.

Still, the documentation says:"Specify the reserve and commit values in decimal or C-language notation. (Use the digits 1-9 for decimal values, precede octal values with zero (0), and precede hexadecimal values with zero and x (0x or 0X)."

And you said that the format is a number in bytes So, does /STACK:0x14,0x14 mean twenty bytes or 20Mb??

Tim

0 Kudos
TimP
Honored Contributor III
802 Views

One place you can see /stack documented is in the instructions for building the benchmarks on www.polyhedron.com

/link /stack:90000000 would give 90MB.

0 Kudos
Steven_L_Intel1
Employee
802 Views
0x14 means 20 bytes.
0 Kudos
rahzan
New Contributor I
802 Views

Thanks for answers.

So will it even help if I raise the stack size in the caller, if the caller is itself a com-dll?

The top level caller is VBA and I don't even know if that has a way of increasing its stack size nor what its default is. Any ideas will be appreciated.

Tim

0 Kudos
Steven_L_Intel1
Employee
802 Views
You're out of luck. Only the link of the EXE can set the stack size. You cannot change the stack size in a DLL.
0 Kudos
Reply