Skip to content

BUG: pytensor config lost in pm.sample(mp_ctx='spawn') #7790

Open
@velochy

Description

@velochy

Describe the issue:

When calling pm.sample(mp_ctx='spawn'), the pytensor.config settings are lost, at least when compiling some functions.

Reproduceable code example:

-

Error message:

PyMC version information:

pymc 5.22.0

Context for the issue:

The situation is as follows: we are working with rather large models, and on OSX, we run into the native compiler's bracket limit. The solution we've used so far is to just add

if platform.system()=='Darwin': 
    pytensor.config.gcc__cxxflags = '-fbracket-depth=4096'

into our framework. Which works if using a single chain. However, when using mp_ctx='spawn', the compilation fails, complaining that it reaches the default depth of 256, i.e. it is clear this flag is not passed on.

The easy workaround is to just set this value in the .pytensorrc

I am, however, wondering why compilation is not shared i.e. done before the process gets split?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions