Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29270 Discussions

Processing a passed auto-array sizing argument greater that 1000 crashes at runtime

peter_stevens
Beginner
1,209 Views
We have found by trial that passing an array size argument that exceeds 1000 will cause a runtime exception. The added sample f90 file attachment shows the basic issue. Under a debug run, the crash appears to be from within the microsoft chkstk.asm pagesize probing. Our environment is VS2005 SP1 and IF10.1.
Is this a problem or a configuration issue. Thanks.
Pete
0 Kudos
1 Solution
Les_Neilson
Valued Contributor II
1,209 Views

The arrays are being allocated on the stack by default. To allocate on the heap :
Under Project=>Fortran=>Optimizaton set Heap Arrays to 0 (zero)

Les

View solution in original post

0 Kudos
5 Replies
Les_Neilson
Valued Contributor II
1,210 Views

The arrays are being allocated on the stack by default. To allocate on the heap :
Under Project=>Fortran=>Optimizaton set Heap Arrays to 0 (zero)

Les
0 Kudos
peter_stevens
Beginner
1,209 Views
Quoting - Les Neilson

The arrays are being allocated on the stack by default. To allocate on the heap :
Under Project=>Fortran=>Optimizaton set Heap Arrays to 0 (zero)

Les

Thanks Les, your suggestion worked a treat - it does take a while to work thru the arrays (around 18 seconds in the coded example) but maybe that is the cost of using the heap. Pete
0 Kudos
TimP
Honored Contributor III
1,209 Views
Quoting - peter.stevens

Thanks Les, your suggestion worked a treat - it does take a while to work thru the arrays (around 18 seconds in the coded example) but maybe that is the cost of using the heap. Pete
If you didn't try increased stack size (e.g. /link /stack:800000000) that might present an alternative to heap-arrays.
0 Kudos
peter_stevens
Beginner
1,210 Views
Quoting - tim18
If you didn't try increased stack size (e.g. /link /stack:800000000) that might present an alternative to heap-arrays.

Thanks tim18, I had not tried this approach but setting the /stack (and also tested with setting the stack commit) to 800000000, it did allow the test code to complete but took 25 seconds; repeat of the Heap approach yielded a faster outcome with no noticable resource hit.
0 Kudos
nvaneck
New Contributor I
1,210 Views
Quoting - peter.stevens

Thanks tim18, I had not tried this approach but setting the /stack (and also tested with setting the stack commit) to 800000000, it did allow the test code to complete but took 25 seconds; repeat of the Heap approach yielded a faster outcome with no noticable resource hit.

Doesn't it work to SAVE the array where it's allocated?
0 Kudos
Reply