Dear members, I want to send the same function with different arguments to different processors. This solution was provided in Stack Overflow https://stackoverflow.com/questions/25045998/send-function-calls-with-different-arguments-to-different-processors-in-r-using [https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-i...@2.png?v=73d79a89bded]<https://stackoverflow.com/questions/25045998/send-function-calls-with-different-arguments-to-different-processors-in-r-using> Send function calls with different arguments to different processors in R using parallel package - Stack Overflow<https://stackoverflow.com/questions/25045998/send-function-calls-with-different-arguments-to-different-processors-in-r-using> Teams. Q&A for work. Connect and share knowledge within a single location that is structured and easy to search. Learn more about Teams stackoverflow.com I have a 48 core processor. My question is, how do i loop through the cores without explicitly mentioning the core numbers? Will this work?
library(parallel) cl <- makeCluster(4) clusterExport(cl, "foo") cores <- seq_along(cl) r <- clusterApply(cl[cores], cores, function(core) { for(i in 1:48) { if (core ==i) { foo( x[i] ) } } }) Many thanks in advance...... Thanking you, Your sincerely, AKSHAY M KULKARNI [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.