BayesianTools
BayesianTools copied to clipboard
bayesianSetup / parallel handling
The treatment of the parallel option is not properly encapsulated, e.g.
tmp <- generateParallelExecuter(likelihood, parallel, parallelOptions)
parallelLikelihood <- tmp$parallelFun
cl <- tmp$cl
-
- }
+ parallel = T
+ }
parallelDensity<- function(x, ...){`
and
}else{
restart <- FALSE
+ if(is.null(settings$parallel)) settings$parallel <- bayesianSetup$parallel
+ if(is.numeric(settings$parallel)) settings$parallel <- TRUE
setup <- checkBayesianSetup(bayesianSetup, parallel = settings$parallel)
settings <- applySettingsDefault(settings = settings, sampler = sampler, check = TRUE)
}
I guess core of the problem is that the user can either provide a class or a function in the setup.
Solution could maybe be to remove the parallel parameter altogether and always read it from the likelihood?
On the other hand, I think the sampler was supposed to be able to overrule the parallel setting in the setup ...
Yes it is definitely a bit hacky... The sampler can still overrule the parallel setting in the setup. But, of course, only for parallel = FALSE even though the setup could access multiple cores.
Max, can you have a look at this? I this still a problem with the changes that we made recently?