I’m upgrading some code from older R versions to 4.4 and encountered some problem with the newer versions.
This used to run perfectly with 4.1 and older versions of future and parallelly.
In another install with R 4.3 and future version 1.33.2 and parallelly 1.34 it still works too.
library(future)
library(doFuture)
registerDoFuture()
plan(list(tweak(multisession, workers = 4), tweak(multisession, workers = 5)), gc = TRUE)
foreach(i = c(1,2,3) %dopar% {
foreach(j = c(3,4,5) %dopar% {
return(i + j)
}
}
In the newer version with parallelly 1.38 it fails with the following error:
Error in checkNumberOfLocalWorkers(workers) :
Attempting to set up 5 localhost parallel workers with only 1 CPU cores available for this R process (per 'mc.cores'), which could result in a 500% load. The hard limit is set to 300%. Overusing the CPUs has negative impact on the current R process, but also on all other processes of yours and others running on the same machine. See help("parallelly.options", package = "parallelly") for how to override the soft and hard limits
When using
foreach(i = c(1,2,3)) %dopar% {
future::nrofWorkers()
}
it correctly returns 5 so this seems to be a bug in the package?
I have tried setting the parallelly.availableCores.methods option but didn’t have any success.
Any ideas on how to fix this for now?
Horstenson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.