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

stack overflow error even set heap arrays 0

Haku
Novice
362 Views

I tried a simple fortran code for openmp in visual studio, while the stack overflow error comes up, from the net information, I tried two ways:
1. changed the heap arrays to 0 as the picture below to set memory on heap.

2. increase the reserve size of stack.

as the result, the second method work while the first failed, could anyone explain why? as if I'm concerning that using the dynamic heap setting will be better while it failed.

# even I set the optimization to other level or custom it also failed

Haku_0-1731313083811.png

Haku_1-1731313111925.pngHaku_2-1731313126624.png

 

Labels (2)
0 Kudos
1 Solution
TobiasK
Moderator
301 Views

@Haku You are using static arrays, heap-arrays only affect automatic and temporary arrays. Generally, we recommend to use allocatable arrays instead of relying on -heap-arrays. Since it seems you are trying to measure performance, please also do the initialization of those 3 arrays in a parallel region.

View solution in original post

0 Kudos
2 Replies
TobiasK
Moderator
302 Views

@Haku You are using static arrays, heap-arrays only affect automatic and temporary arrays. Generally, we recommend to use allocatable arrays instead of relying on -heap-arrays. Since it seems you are trying to measure performance, please also do the initialization of those 3 arrays in a parallel region.

0 Kudos
Haku
Novice
146 Views

@TobiasKThank you very much for kind suggestion, now I understand to use allocatable arrays are better than static arrays. And also thanks for your suggestions for parallelization part.

0 Kudos
Reply