I was wondering what is the difference between setting the number of cores for R to use via makePSOCKcluster
and explictly in the foreach loop? Should I be setting this seperately in both instances, or is doing so when making the makePSOCKcluster
enough?
cl <- makePSOCKcluster(max(1, detectCores() - 1))
registerDoParallel(cl)
and
mcoptions <- list( preschedule=FALSE, mc.cores = max(1,detectCores()-1) )
stream = foreach(i=1:NROW(stream_sponsored), .inorder=FALSE,
.combine=rbind,
.options.multicore=mcoptions) %dopar% {
#do something
}