[R] on parallel processing...

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Fri Nov 4 20:54:10 CET 2022


You don't specify processors. Just invoke the worker functions with the relevant packages and they will be allocated according to how you defined the cluster object... typically automatically. Processors are usually specified (to the cluster object) according to IP address. Cores within the processors are allocated according to how many processes are created.

Maybe you should read some documentation (vignettes), and/or look into R-sig-hpc (https://stat.ethz.ch/mailman/listinfo/r-sig-hpc). This is probably not the best place to pursue this.

On November 4, 2022 12:35:11 PM PDT, akshay kulkarni <akshay_e4 using hotmail.com> wrote:
>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-icon@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 using 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.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list