With cores, a cluster from clusters::clusterSetup(), asked for nCoresNeeded workers on cores (booked in clusters' reservations, so other fits see it), with the objective's data (emulatorDataArgs of objArgs) shipped once. FUN(cl) runs on it, and the cluster is stopped and its booking released when this function returns, as runDEoptim()'s is (clusterSetup() ties that to its caller). Without cores (NULL or NA) FUN(NULL) runs here, and the objective's data must go with each evaluation's arguments. Used by the emulator (emulatorStartPopulation()) and the profile of a ledger fit (profileLedgerFit()).

withObjectiveCluster(
  objArgs,
  cores,
  nCoresNeeded,
  libPath = .libPaths(),
  logPath = tempdir(),
  runName = "",
  FUN
)

Arguments

objArgs

emulatorObjectiveArgs().

cores, nCoresNeeded, libPath, logPath

as for the fit (runDEoptim()).

runName

character; labels the cluster's log and its booking.

FUN

a function of the cluster (or NULL).

Value

what FUN returns.