Thanks for using Argobots! I believe it's about memory consumption issues regarding ULT stacks.
> What would be ideal for me would be if ABT_thread_create() would defer stack allocation somehow.
I believe
https://github.com/pmodels/argobots/pull/356 (merged) exactly does this. This configuration is disabled by default, so please set --enable-lazy-stack-alloc at configure time.
[Background]
Argobots needs to keep
- "full stacks [*1]" (in this case, 2MB) per "active" (i.e., "executing" + "suspending") ULT
Intuitively, Argobots must have a full ULT stack to save an intermediate ULT execution state, in addition to a stack space for a currently executing ULT. This is the minimum stack requirement for Argobots.
[*1] There was a long discussion in
https://github.com/pmodels/argobots/issues/274, but basically it's not possible to allocate small stack first and expand it later within Argobots)
[Ideas]
A ULT stack is assigned when a ULT is executed (not created). The stack is reclaimed when a ULT is finished (not freed). This can achieve the minimum stack use calculated based on [Background]. See the PR for details. The PR explains it using some figures.
[Reduce More]
1. This does not include the ULT stack pool (=cache), so if you want to further reduce memory usage, please shrink the stack pool size. This pool mechanism just increases the constant amount of memory consumption, so this pool cache won't affect the memory footprint much, I believe. Shrinking this can negatively affect the performance.
2. Even if you allocate a stack in this way, still you need 2MB per "suspended ULT". If most of the ULTs launch and then immediately yield, this "enable-lazy-stack-alloc" method does not reduce memory consumption. If you need to immediately yield, instead of yielding, please create a new ULT for continuation and exit the ULT; if so, Argobots does not need to save a full ULT stack per yielded ULT. (A newly created ULT does not have a ULT stack since it has not started yet).