generateParallelExecuter {BayesianTools}R Documentation

Factory to generate a parallel executer of an existing function


Factory to generate a parallel executer of an existing function


generateParallelExecuter(fun, parallel = F,
  parallelOptions = list(variables = "all", packages = "all", dlls =



function to be changed to parallel exectution


should a parallel R cluster be used or not. If set to T, cores will be detected automatically and n-1 of the available n cores of the machine will be used. Alternatively, you can set the number of cores used by hand


list containing three lists. First "packages" determines the R packages necessary to run the likelihood function. Second "variables" the objects in the global envirnment needed to run the likelihood function and third "dlls" the DLLs needed to run the likelihood function (see Details).


For parallelization, option T means that an automatic parallelization via R is attempted, or "external", in which case it is assumed that the likelihood is already parallelized. In this case it needs to accept a matrix with parameters as columns. Further you can specify the packages, objects and DLLs that are exported to the cluster. By default a copy of your workspace is exported. However, depending on your workspace this can be very inefficient.

Alternatively you can specify the environments and packages in the likelihood function (e.g. BayesianTools::VSEM() instead of VSEM()).


Can also be used to make functions compatible with library sensitivity


Florian Hartig


testDensityMultiNormal <- generateTestDensityMultiNormal()

parDen <- generateParallelExecuter(testDensityMultiNormal)$parallelFun
x = matrix(runif(9,0,1), nrow = 3)

[Package BayesianTools version 0.1.7 Index]