Skip to content

Running Future issue #522

Answered by izahn
Tomer9w asked this question in Q&A
Jun 30, 2021 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

The future package is almost like magic, but it won't magically make your for-loop parallel. For that you need https://dofuture.futureverse.org/ and some small modifications (untested) to your code:

library(doFuture)
library(Seurat)

registerDoFuture()
plan(multisession, workers=6)

start_time <- Sys.time()
markers <- foreach (i = 1:3, .export = "CD3") %dopar% {
   FindMarkers(CD3, only.pos = TRUE, ident.1 = i, min.pct = 0.25, logfc.threshold = 0.25, return.thresh = 0.05, verbose = FALSE)
}
end_time <- Sys.time()
end_time-start_time

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Tomer9w
Comment options

@HenrikBengtsson
Comment options

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 #521 on June 30, 2021 14:10.