0

I have a question related to r-parallel computing. I am using something like:

cl.tmp = makeCluster(10, type="SOCK")
registerDoParallel(cl.tmp)
AA <- foreach(i = 1:48, .inorder = TRUE, .combine = rbind, .verbose=TRUE) %dopar% {
# A function that depends on some selected objects in current environment
}
stopCluster(cl.tmp)

How to identify some particular objects in the current environment to be distributed into processor cores and so be used for some functions? I do not need R to copy the whole objects in the environment into different cores, but only some selected objects. In my project, I have big R objects and I do not need to copy/distribute them into cores, to avoid ram problems. Is there a solution for that?

Thanks

svick
  • 236,525
  • 50
  • 385
  • 514
Ahmed El-Gabbas
  • 398
  • 3
  • 10

1 Answers1

0

Take a look at this: reading global variables using foreach in R

Only variables referenced inside the foreach loop are copied from the global environment.

Community
  • 1
  • 1
mattdevlin
  • 1,045
  • 2
  • 10
  • 17