virtual memory demand and stack/OMP_STACKSIZE

Hi,

I am running a fortran OpenMP application using different number of threads under fixed virtual and stack memory limits (queue system). I am getting the following virtual memory demands:

stack size (kbytes, -s) 262144 (256m)
OMP_STACKSIZE=128m
N threads VIRT
1 1856m
2 2048m
4 2432m
8 3200m

it can be inferred from here a 192m extra virtual memory demand per thread instead of the expected 128m

However in this case:

stack size (kbytes, -s) 131072 (128m)
OMP_STACKSIZE=64m
N threads VIRT
1 1856m
2 1984m
4 2240m
8 2754m

Here we have a 128m extra virtual memory demand per thread.

Any idea about this behaviour and how to infer memory requirements?

Hi APLICACIONS,

OMP_STACKSIZE sets the stack size the system to make available per thread. However, it doesn’t limit the amount of stack each thread uses. Hence, if your program uses more stack then available, it runs the risk of getting a stack overflow error at runtime.

Any idea about this behaviour and how to infer memory requirements?

You need to adjust your stack size to meet the maximum size needed by your program.

  • Mat