dfm / dfm/emcee

Multiprocessing Tutorial Example Not Working

Open
#365 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.6k
Forks
440
PR merge metrics
No merged PRs in 30d

Description

General information:

  • emcee version: 3.0.2
  • platform: python, jupyter notebook
  • installation method (pip/conda/source/other?): pip

Problem description:

Expected behavior: That the multiprocessing example using "pool" would work in a jupyter notebook for the example shown in the multiprocessing example.
Actual behavior: Using "pool" in the sampler does not converge and continues to run indefinitely. However, the example in the tutorial shows that it should finish running and run faster than the serial code.
What have you tried so far?: Modified the code, tried different notebooks, tried to use pool.close()
Minimal example:
from multiprocessing import Pool

with Pool() as pool:
    sampler = emcee.EnsembleSampler(nwalkers, ndim, log_prob, pool=pool)
    start = time.time()
    sampler.run_mcmc(initial, nsteps, progress=True)
    end = time.time()
    multi_time = end - start
    print("Multiprocessing took {0:.1f} seconds".format(multi_time))
    print("{0:.1f} times faster than serial".format(serial_time / multi_time))

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

Start by reproducing the multiprocessing tutorial's minimal example in a Jupyter notebook with emcee 3.0.2 and compare it with the serial run. Investigate why the sampler does not finish when given a multiprocessing.Pool; the work is done when the documented example completes and reports its runtime.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.