pymc-devs / pymc-devs/pytensor

BUG: Multiprocessing and caching with mixed versions

Open
#1,808 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Describe the issue:

This bug appeared using the SMC sampler in pymc. More details about the issue's discovery are here: https://github.com/pymc-devs/pymc/issues/8022#issuecomment-3704239398

The gist of it is that the SMC sampler dispatches multiple parallel chains using multiprocessing, and sometimes those processes would hang. Switching between versions of pymc/pytensor did not resolve the hanging. At least once, the SMC sampler threw an error that pytensor couldn't access a lock file in ~/.pytensor. That led me to deleting ~/.pytensor, which ultimately solved the problem.

@ricardoV94 and I suspect that there is some caching issue in ~/.pytensor that shows up in multiprocessing.

I'm sorry that I can't help more or provide a MWE, since the bug disappeared after deleting ~/.pytensor.

Reproducable code example:
https://www.pymc.io/projects/examples/en/latest/samplers/SMC2_gaussians.html
Error message:

PyTensor version information:

Latest

Context for the issue:

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, failing test, or minimal reproducible example is named. Start by running the linked SMC sampler example with multiprocessing and inspect how ~/.pytensor caching and lock access behave across processes; done means reproducing the hang or lock failure and adding a verified fix with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.