Skip to content
Snippets Groups Projects

Standardize some common sampler functionality

Merged Colm Talbot requested to merge standardize-pool-handling into master

This MR attempts to standardize a few common features we implement for external samplers.

I had hoped to keep them independent, but they became pretty intertwined, so I wanted to at least share them in this way.

  • saving results to a temporary directory. Several samplers (pymultinest, dnest4, ultranest) had pretty much equivalent definitions of a file transfer mechanism. I'm not entirely sure that they all need it. Originally pymultinest needed it due to a limitation of the underlying fortran code. This way any changes/fixes to one will be applied to the others.
  • opening and closing a pool. We manually set up/tear down the pool used for dynesty, ptemcee, and ptemcee. This typically involves defining some global objects that are then stored and called independently in different threads. I wrapped this in a little class to reduce the number of globals we have floating around. This should again cut down on maintenance. A side effect of this is that emcee, kombine, and zeus now support parallelization using multiprocessing.
  • signal catching. This hit most of the samplers as we set a catch for signals from the system. Currently, we just set the signals when the object is initialized and forget about it. This has lead to some weird behaviour if there is a significant amount of stuff that happens after the sampler finishes, e.g., reconstructing marginalized parameters. The new method just has a decorator that is applied to the run_sampler method if we want it that sets the signal before entering the method and resets them to the previous values when the sampling is done.

Edit (220126): Since this MR already essentially rewrote the entire directory I decided it was time to add this bilby.core.sampler directory to the pre-commits. This involved running, black, isort, and flynt.

Edit (220726): Six months since the last update... I made some slides to explain the different changes.

Edited by Colm Talbot

Merge request reports

Pipeline #430931 passed

Pipeline passed for 03d95481 on standardize-pool-handling

Test coverage 65.00% from 1 job
Approval is optional

Merged by Colm TalbotColm Talbot 2 years ago (Aug 10, 2022 12:05pm UTC)

Pipeline #438327 passed

Pipeline passed for 602eaa64 on master

Test coverage 65.00% from 1 job

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Michael Williams
  • Colm Talbot added 1 commit

    added 1 commit

    Compare with previous version

  • Colm Talbot added 1 commit

    added 1 commit

    • 006d1332 - make sure sampling dump is set

    Compare with previous version

  • Colm Talbot added 1 commit

    added 1 commit

    • e79d587e - add test for likelihood reordering

    Compare with previous version

  • Colm Talbot added 1 commit

    added 1 commit

    • ed63cb7d - make sure sampling time updates without checkpointing

    Compare with previous version

  • Colm Talbot added 1 commit

    added 1 commit

    Compare with previous version

  • Colm Talbot added 11 commits

    added 11 commits

    Compare with previous version

  • Colm Talbot added 9 commits

    added 9 commits

    • 4b6e4853...aca9ee12 - 8 commits from branch master
    • 86e279e4 - Merge remote-tracking branch 'origin/master' into standardize-pool-handling

    Compare with previous version

  • Colm Talbot added 2 commits

    added 2 commits

    Compare with previous version

  • Colm Talbot added 1 commit

    added 1 commit

    Compare with previous version

  • Colm Talbot added 1 commit

    added 1 commit

    • 9602813d - make sure schwimmbad is installed for sampler testing

    Compare with previous version

  • Colm Talbot resolved all threads

    resolved all threads

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading