Search code examples
rparallel-processingcpu-usager-future

R future multisession limiting number of cpus


I'm currently parallellising by using the future package as follows:

plan(multisession, gc = TRUE)
standardised_addresses1 <- future_lapply(1:20000, function(x) x*x) 

The problem is that it uses all the CPUs on the server. I would like to limit the number of CPUs used by setting a parameter like: workers = 18


Solution

  • You can use plan(multisession, gc = TRUE, workers = 18).