Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-threading support for MCMC samplers #39

Merged
merged 6 commits into from
Jul 19, 2018
Merged

Multi-threading support for MCMC samplers #39

merged 6 commits into from
Jul 19, 2018

Conversation

henry-ngo
Copy link
Collaborator

sampler object's initialization can specify nthreads for parallelization.

Since emcee will remove their PT sampler in the next release, I've added the Ensemble Sampler from emcee as an alternative (a good replacement might be ptemcee)

Addresses Issue #30

henry-ngo and others added 6 commits July 4, 2018 22:07
…bject to orbitize's Sampler object (as part of initialization)

emcee v3.0 will no longer support the PT Sampler, using ptemcee instead (designed to be drop-in replacement)

this commit still has some issues...not parallel yet;
…C and PTMCMC classes to allow for parallelization.

Added block to try to do the same for python3, but it doesn't seem to work yet
…objects

- this allows paralellization with DFM's emcee
- run_sampler now returns emcee.sampler object (for both orbitize.sampler MCMC classes)
- test_mcmc.py tests passing in python 2 and 3
@coveralls
Copy link

coveralls commented Jul 17, 2018

Pull Request Test Coverage Report for Build 244

  • 42 of 42 (100.0%) changed or added relevant lines in 1 file are covered.
  • 5 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+1.7%) to 81.974%

Files with Coverage Reduction New Missed Lines %
orbitize/priors.py 1 81.33%
orbitize/sampler.py 1 93.41%
orbitize/init.py 3 42.11%
Totals Coverage Status
Change from base Build 242: 1.7%
Covered Lines: 382
Relevant Lines: 466

💛 - Coveralls

Copy link
Collaborator

@semaphoreP semaphoreP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

We could in the future try importing either emcee.PTSampler or ptemcee and see which one imports successfully and use the one that does. I believe they have the example same interface.

For the affine invariant sampler to be effective, I think it needs to either only run on fits where we limit \omega and \Omega to be < 180 (i.e., posterior is unimodal) or run one sampler for each mode.

@henry-ngo
Copy link
Collaborator Author

Okay, the new version of emcee actually deletes their PTSampler and instead checks if you have ptemcee installed and if so, imports that instead.

@sblunt sblunt merged commit 43ad629 into master Jul 19, 2018
@sblunt
Copy link
Owner

sblunt commented Jul 19, 2018

Thanks, @henry-ngo! Milestone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants