diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2023-01-05 15:03:06 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2023-01-05 15:03:06 +0100 |
commit | a5903e74d9cf54c764d5bbc48e461cecd5f56e72 (patch) | |
tree | 158308fb452e92b47e56259110febe6ffa63e629 /R/multistart.R | |
parent | a583cd7e3eecef4c70ac09304495c765a84e76ce (diff) |
Don't preschedule multistart runs
Sometimes a lot of them fail, so we were wasting time
Diffstat (limited to 'R/multistart.R')
-rw-r--r-- | R/multistart.R | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/R/multistart.R b/R/multistart.R index 61ef43dc..bdfbfe63 100644 --- a/R/multistart.R +++ b/R/multistart.R @@ -100,9 +100,12 @@ multistart.saem.mmkin <- function(object, n = 50, cores = 1, } if (is.null(cluster)) { - res <- parallel::mclapply(1:n, fit_function, mc.cores = cores) + res <- parallel::mclapply(1:n, fit_function, + mc.cores = cores, mc.preschedule = FALSE) } else { - res <- parallel::parLapply(cluster, 1:n, fit_function) + res <- parallel::parLapplyLB(cluster, 1:n, fit_function, + mc.preschedule = FALSE + ) } attr(res, "orig") <- object attr(res, "start_parms") <- start_parms |