From 68eca2d39c4a4276bc37f514347b1323b4e7ea4c Mon Sep 17 00:00:00 2001 From: ms609-agent <313734811+ms609-agent@users.noreply.github.com> Date: Fri, 16 Oct 2026 13:04:58 +0100 Subject: [PATCH 1/3] Suggest parallelly::availableCores() in mc.cores docs parallel::detectCores() reports the hardware count; availableCores() respects scheduler and cgroup allocations, R CMD check's core limit and MC_CORES, so "use all cores" no longer oversubscribes a shared machine or HPC job. Prose snippets only; no new dependency. Co-Authored-By: Claude Opus 5.5 --- R/parallel.R | 4 ++-- R/tree_distance_info.R | 4 ++-- man/StartParallel.Rd | 4 ++-- man/TreeDistance.Rd | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/parallel.R b/R/parallel.R index 9c835b064..5f81d2e16 100644 --- a/R/parallel.R +++ b/R/parallel.R @@ -22,8 +22,8 @@ #' `"mc.cores"` option: #' #' ```r -#' options(mc.cores = parallel::detectCores()) # use all available cores -#' options(mc.cores = 4L) # or a fixed number +#' options(mc.cores = parallelly::availableCores()) # use all available cores +#' options(mc.cores = 4L) # or a fixed number #' ``` #' #' The default is `1` (single-threaded). diff --git a/R/tree_distance_info.R b/R/tree_distance_info.R index 3cfe8c69f..a6ad95d47 100644 --- a/R/tree_distance_info.R +++ b/R/tree_distance_info.R @@ -128,8 +128,8 @@ #' automatically. Control the number of threads with the `"mc.cores"` option: #' #' ```r -#' options(mc.cores = parallel::detectCores()) # use all cores -#' options(mc.cores = 4L) # or a fixed number +#' options(mc.cores = parallelly::availableCores()) # use all cores +#' options(mc.cores = 4L) # or a fixed number #' ``` #' #' Do **not** call [`StartParallel()`] for these functions: a registered diff --git a/man/StartParallel.Rd b/man/StartParallel.Rd index 1a918897e..0cbf7a106 100644 --- a/man/StartParallel.Rd +++ b/man/StartParallel.Rd @@ -54,8 +54,8 @@ no cluster setup is required. The affected functions are: The number of \acronym{OpenMP} threads is controlled by the standard \code{"mc.cores"} option: -\if{html}{\out{
}}\preformatted{options(mc.cores = parallel::detectCores()) # use all available cores -options(mc.cores = 4L) # or a fixed number +\if{html}{\out{
}}\preformatted{options(mc.cores = parallelly::availableCores()) # use all available cores +options(mc.cores = 4L) # or a fixed number }\if{html}{\out{
}} The default is \code{1} (single-threaded). diff --git a/man/TreeDistance.Rd b/man/TreeDistance.Rd index f753909c9..dd0fdce5b 100644 --- a/man/TreeDistance.Rd +++ b/man/TreeDistance.Rd @@ -263,8 +263,8 @@ When \code{tree2 = NULL} and all trees share the same tip labels, pairwise distance calculation uses a multi-threaded \acronym{OpenMP} batch path automatically. Control the number of threads with the \code{"mc.cores"} option: -\if{html}{\out{
}}\preformatted{options(mc.cores = parallel::detectCores()) # use all cores -options(mc.cores = 4L) # or a fixed number +\if{html}{\out{
}}\preformatted{options(mc.cores = parallelly::availableCores()) # use all cores +options(mc.cores = 4L) # or a fixed number }\if{html}{\out{
}} Do \strong{not} call \code{\link[=StartParallel]{StartParallel()}} for these functions: a registered From a5ff64fa9f8138706efa9fbf39c65c252a579da6 Mon Sep 17 00:00:00 2001 From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:19:27 +0100 Subject: [PATCH 2/3] alignment --- R/parallel.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/parallel.R b/R/parallel.R index 5f81d2e16..c36ef7983 100644 --- a/R/parallel.R +++ b/R/parallel.R @@ -23,7 +23,7 @@ #' #' ```r #' options(mc.cores = parallelly::availableCores()) # use all available cores -#' options(mc.cores = 4L) # or a fixed number +#' options(mc.cores = 4L) # or a fixed number #' ``` #' #' The default is `1` (single-threaded). From a6a119901662592885b9197559dd9eb0cafc930d Mon Sep 17 00:00:00 2001 From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:19:51 +0100 Subject: [PATCH 3/3] Alignment --- R/tree_distance_info.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tree_distance_info.R b/R/tree_distance_info.R index a6ad95d47..296be5419 100644 --- a/R/tree_distance_info.R +++ b/R/tree_distance_info.R @@ -129,7 +129,7 @@ #' #' ```r #' options(mc.cores = parallelly::availableCores()) # use all cores -#' options(mc.cores = 4L) # or a fixed number +#' options(mc.cores = 4L) # or a fixed number #' ``` #' #' Do **not** call [`StartParallel()`] for these functions: a registered