Stack overflow and /Qopenmp: is the stack size smaller when /Qopenmp used?

Stack overflow and /Qopenmp: is the stack size smaller when /Qopenmp used?

I have a Fortran program that has some hardwired arrays via PARAMETER statements. Hence the memory goes on the stack. There is not THAT much memory going on the stack. If I compile without /Qopenmp I have no problems. If I compile with /Qopenmp I get a stack overflow. Why would /Qopenmp make such a difference?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I should add that I am linking with MKL and this is windows 64bit with version 11.1 of the compiler.

I think I have answered my own question by readingthe following... using openmp is pushing hardwired arrays on to the stack...

5.5 Stacks and Stack Sizes

The executing program maintains a main memory stack for the initial thread executing the program, as well as distinct stacks for each slave thread. Stacks are temporary memory address spaces used to hold arguments and automatic variables during invocation of a subprogram or function reference.

In general, the default main stack size is 8 megabytes. Compiling Fortran programs with the f95 -stackvar option forces the allocation of local variables and arrays on the stack as if they were automatic variables. Use of -stackvar with OpenMP programs is implied with explicitly parallelized programs because it improves the optimizer's ability to parallelize calls in loops. (See the Fortran User's Guide for a discussion of the -stackvar flag.) However, this may lead to stack overflow if not enough memory is allocated for the stack.

Leave a Comment

Please sign in to add a comment. Not a member? Join today