nested_sampling icon indicating copy to clipboard operation
nested_sampling copied to clipboard

NestedSampling: make mc_walker optional or change the way workers are set up

Open smcantab opened this issue 11 years ago • 1 comments

When using the distributed parallelisation we build an mc_walker for each worker but are then also required to pass the mcwalker to the NestedSampling class. This particular instance of the mc_walker will not be used, because it is up to the workers to do the MCMC.

I find it confusing that the nested sampling object takes something that it doesn't need. So we could either make the mc_walker an optional parameter or we could pass the mc_walker to the workers from the master. Although dependency injection in this case would be more elegant, this solution is more cumbersome to implement and we would have to deal with making the mc_walker pickable.

@js850 any ideas?

smcantab avatar Dec 09 '14 10:12 smcantab

I would just put in the documentation that mc_walker will be ignored if we use distributed parallelization.

I was just looking over the NestedSampling class and it's a bit of a mess with the three different versions of how to do mc walking. Would it make sense to have a simple non parallel class with the rest inheriting from it and overloading certain functions?

class NestedSampling(object):
class NestedSamplingMP(NestedSampling):
class NestedSamplingPyro(NestedSampling):
class NestedSamplingMPI(NestedSampling):

Then they would all be independent. And they would only have to overload the function they need (e.g. _do_monte_carlo_chain().

js850 avatar Dec 09 '14 12:12 js850