[R] on parallel processing...

akshay kulkarni @k@h@y_e4 @end|ng |rom hotm@||@com
Fri Nov 4 21:12:12 CET 2022


dear Jeff,
                 Yeah, you are right.....just went through the documentation and found out that clusterApplyLB() from parallel package does the job... Thanks again....

THanking you,
Yours sincerely
AKSHAY M KULKARNI
________________________________
From: Jeff Newmiller <jdnewmil using dcn.davis.ca.us>
Sent: Saturday, November 5, 2022 1:24 AM
To: r-help using r-project.org <r-help using r-project.org>; akshay kulkarni <akshay_e4 using hotmail.com>; R help Mailing list <r-help using r-project.org>
Subject: Re: [R] on parallel processing...

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.

	[[alternative HTML version deleted]]



More information about the R-help mailing list