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 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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...

http://docs.sun.com/source/819-0501/5_compiling.html

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.

发表评论

登录添加评论。还不是成员?立即加入