BayesianTools icon indicating copy to clipboard operation
BayesianTools copied to clipboard

bayesianSetup / parallel handling

Open florianhartig opened this issue 7 years ago • 2 comments

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 ...

florianhartig avatar Dec 21 '16 13:12 florianhartig

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.

stefan-paul avatar Dec 21 '16 13:12 stefan-paul

Max, can you have a look at this? I this still a problem with the changes that we made recently?

florianhartig avatar Apr 30 '18 11:04 florianhartig