[R-sig-hpc] Parallel Linear Model

Stephen Weston stephen.b.weston at gmail.com
Wed Aug 22 17:53:19 CEST 2012


> On Wed, Aug 22, 2012 at 10:47 AM, Patrik Waldmann <
> patrik.waldmann at boku.ac.at> wrote:
>
>> I did not manage to implement this example in foreach, could anyone point
>> me to a similar example?
>>

Here's a version that also uses the parallel package, but supports
multiple nodes:

library(parallel)
cl <- makePSOCKcluster(4)
pval <- parCapply(cl, x, function(xc, y) summary(lm(y ~
xc))$coefficients[2,4], y)

- Steve


>> Patrik
>>
>> >>> Jay Emerson <jayemerson at gmail.com> 22/08/2012 14:05 >>>
>>
>> Patrik,
>>
>> Your question (at least from you example) is really about general parallel
>> computing. Nothing you want to do with your linear model from your short
>> example requires some special type of parallelism. I recommend package
>> 'foreach' with the parallel backends, or else the package 'parallel' that
>> comes with the newer versions of R. You could also have a look at Dirk's
>> HPC page:
>>
>> http://cran.r-project.org/web/views/HighPerformanceComputing.html
>>
>> Jay
>>
>> --
>> John W. Emerson (Jay)
>> Associate Professor of Statistics, Adjunct, and Acting Director of
>> Graduate Studies
>> Department of Statistics
>> Yale University
>> http://www.stat.yale.edu/~jay ( http://www.stat.yale.edu/%7Ejay )
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-hpc mailing list
>> R-sig-hpc at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc



More information about the R-sig-hpc mailing list