Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Important Update: Community Platform Migration​. Learn more​>
29652 Discussions

stack overflow when calling imsl subroutines

minixos
Beginner
2,621 Views
When calling IMSL subroutine with large arrays, it always encountered stack overflow. But there is no problem to call MKL subroutines with the same size arrays ( even larger). To increase stack size is a way to bypass it but not efficient.
Any idea?
0 Kudos
10 Replies
jim_dempsey
Beginner
2,621 Views

Is the increase in the stack size requirement to call IMSL proportional to the array size?

If the stack size requirement varies with the array size then the problem may be due to one of to situations.

1) The IMSL is using stack temp variables that vary with the array size (bad coding on there part)

2) The array in your code is on the stack instead of in global context.

subroutine foo()

real :: fooArray(123456)

end subroutine foo

Depending on your option switches (and OpenMP) fooArray will either be on the stack or in a foo_private area off the stack.

Jim Dempsey

0 Kudos
minixos
Beginner
2,621 Views
Thanks for reply.
All arrays are allocated by dynamic allocation. So they should be in heap instead of stack. Actually there is no problem when calling MKL subroutines with the same arrays.
I can use MKL libs, but sometimes it is easier to call IMSL library...
0 Kudos
Steven_L_Intel1
Employee
2,621 Views
I suspect the problem is that IMSL, internally, is doing something that requires the compiler to create a temporary copy of the array, which is done on the stack. MKL may be doing things differently, not requiring a temp. All I can suggest is raising the stack size of your executable and see if that helps.
0 Kudos
minixos
Beginner
2,621 Views

Hi Steve,

Thanks. The interesting thing is that f77 has no problem to call imsl with large arrays.

I remembered that there was a solution to overcome the problem. But I forgot it. Probably an interface is required...

Thanks a lot.

Minix

0 Kudos
Steven_L_Intel1
Employee
2,621 Views
Well, that's an interesting twist. Try turning on /warn:arg_temp_created (Warn when temporary dummy argument created) and see what you get. Are you passing a whole array by just the variable name, or an array slice (even A(:))?
0 Kudos
minixos
Beginner
2,621 Views
I passed the whole array.:smileyhappy:
0 Kudos
Steven_L_Intel1
Employee
2,621 Views
Damn, I hate those punctuation smileys...

Please show the statement that makes the call. If you are using MSIE, use the SRC button to include it. If another browser, surround it in
 and 
tags. Also show the declaration of the array.
0 Kudos
jim_dempsey
Beginner
2,621 Views
I hate those smilies too. Have your webmaster turn those damb things off on the programmer's forums. If someone wants a smily then have them poke on the frigg'n smilies button which then inserts or some other html tag. Sign me Grumpy:smileymad:
0 Kudos
Steven_L_Intel1
Employee
2,621 Views
I have requested that they be turned off several times, but I am overridden, as other forum hosts like them. I am told that users should use the SRC button or the pre tags. I have asked that at least the punctuation-based smileys be disabled, as the forum supports another kind with :word:. BTW, the editing buttons are SUPPOSED to appear in Firefox, but they don't. That's being worked on.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
2,621 Views
The current working with Firefox, inadequate in most other aspects, at least has the advantage that it doesn't generate smileys :-).

Jugoslav
0 Kudos
Reply