Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Relation between thread and program stack space

$
0
0

Steve, Colleagues,

What is the relationship between the Linker parameter "Stack Reserve Size" as set in Project Properties dropdown, and the value set with kmp_set_stacksize_s()?

It is my understanding that kmp_set_stacksize_s() allocates stack space for each thread. Is this in addition to that allocated for the "program" -- that is the master thread (number zero)? Or "within it"?  I have a very large section of code within a parallel do, and for most projects I can run 4 threads with 32,000,000 used in kmp_set_stacksize_s(). The loop involves reduction of three large arrays. In these cases the linker parameter "Stack Reserve Size" can be set to 400,000,000

I have a larger project that requires 64,000,000 in kmp_set_stacksize_s(), and runs IFF  I run only one thread; that is, use call OMP_SET_NUM_THREADS(1).  [I'm running a series of experiments to see what these parameter settings should be, in general]   If I run with 2 or more threads, I get a stack overflow error at the place in the code where the threads are being established. Altering linker parameter "Stack Reserve Size" doesn't affect this failure.

It is my assumption that the space required for private and reduced variables in the threaded region scales roughly linearly with thread count. No? The shared variables would NOT require more space with more threads -- aside, perhaps, from some minor overhead.

David


Viewing all articles
Browse latest Browse all 5691

Trending Articles