Skip to content

Work is not distributed 'on the fly' #499

Discussion options

You must be logged in to vote

... since for each job, a new R process must be started from scratch.

Actually, this is not correct. If you use plan(multisession, workers = 2), there will be two background workers running in the background processing futures until you switch to another plan. You can see this by the following example:

library(doFuture)
registerDoFuture()
plan(multisession, workers = 2)
y <- foreach(x = 1:6, .options.future = list(scheduling = FALSE)) %dopar% { c(x=x, pid=Sys.getpid()) }
do.call(rbind, y)
#      x   pid
# [1,] 1 28332
# [2,] 2 28363
# [3,] 3 28332
# [4,] 4 28363
# [5,] 5 28332
# [6,] 6 28363

Note how there are only two process IDs: 28332 and 28363. If there would have a new worker star…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by HenrikBengtsson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #470 on May 26, 2021 22:10.