From a5903e74d9cf54c764d5bbc48e461cecd5f56e72 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 5 Jan 2023 15:03:06 +0100 Subject: Don't preschedule multistart runs Sometimes a lot of them fail, so we were wasting time --- R/multistart.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'R') 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 -- cgit v1.2.1