-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
(disclaim: I'm the author) To minimize the risk of overusing CPUs on multi-tenant and multi-process machines, but also to work in more environments, please consider changing:
Lines 6 to 13 in 57207bf
| get_cores <-function(num_cores){ | |
| if(is.null(num_cores)) { | |
| parallel::detectCores()-1 | |
| } else { | |
| min(num_cores, parallel::detectCores()-1) | |
| } | |
| } |
to
get_cores <-function(num_cores){
min(c(parallelly::availableCores(omit = 1), num_cores))
}This also has the benefit of working on single-core hosts, where detectCores() == 1, e.g. free RStudio Cloud accounts, some k8s/container setups, etc. For more arguments, see https://parallelly.futureverse.org/#availablecores-vs-paralleldetectcores.
Metadata
Metadata
Assignees
Labels
No labels