Future with workers specified takes all my CPU

I'm working with the future package, and I'm having trouble with it taking up all my computing power. I've specified multisession and a number of workers as suggested here:

But it's still taking all my CPU. Reprex:

library(future)
library(caret)

plan(multisession, gc = TRUE, workers = 3L)

size <- 10000

df_reprex <- data.frame(
  country = as.factor(sample(c("01", "02", "03"), size, replace = TRUE)),
  sex = as.factor(sample(c("M", "F"), size, replace = TRUE)),
  rel = as.factor(sample(c("brother", "sister", "father", "mother"), size, replace = TRUE)),
  cost = sample(1:100, size, replace = TRUE)
)

caret_reprex <- future({
  train(
    cost ~ .,
    data = df_reprex,
    method = "ranger"
  )
})

And when I run the call to future, this is what my Task Manager looks like:

I would like it to only use 3 of my logical processors.

sessionInfo()
# R version 3.6.1 (2019-07-05)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows >= 8 x64 (build 9200)
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.