Skip to content

nested parallel_for fails with stack overflow when using getNumThreads rather than hard-coding the number of threads via max_allowed_parallelism #152

@paciorek

Description

@paciorek

The last test in test-threads.R produces:

   Cnc1 <- Cnc$new()
    ## expect_silent(out <- Cnc1$go(100, 100, 10))
    ## Error: C stack usage  14983114845556 is too close to the limit
    ## Error: no more error handlers available (recursive errors?); invoking 'abort' restart
    ## *** longjmp causes uninitialized stack frame ***: terminated

However, if I manually hard-code the number of threads like this: tbb::global_control gc(tbb::global_control::max_allowed_parallelism,4); instead of using getNumThreads(4.0), it is fine. And from earlier versions of the codebase that didn't control the number of threads, nested parallel_for is also fine.

So once we address issue #151, I will experiment with trying to figure out why use of getNumThreads is a problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions