I’m doing multiple recursive computations (Welzl’s algorithm) in parallel using Threads.@threads, producing a stack overflow. This is on latest Linux and Julia 1.7.0-rc2.
How do increase the size of a thread’s stack?
(It turns out that in this particular case the stack overflow is my fault and can’t be fixed by having larger stacks, but I’m still interested in how to change stack size.)
I know this thread is old but I’ve found it multiple times now searching for the same answer, so here is what I did, in case it helps others who find this:
with_stacksize(f, n) = fetch(schedule(Task(f, n)))
Threads.@threads for ...
with_stacksize(8*1024*1024) do # execute with 8MiB stack size
foo()
end
end