Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Another attempt at simplest possible parallel computation in Windows
myFunction <- function(x){prod(1:x)}
myFunction(10)
system.time(lapply(1:10000, myFunction))
library(parallel)
myCluster <- makeCluster(detectCores())
clusterExport(myCluster, ls())
system.time(parSapply(myCluster, 1:10000, myFunction))
stopCluster(myCluster)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.