[R] multicore/mcparallel error

R. Michael Weylandt michael.weylandt at gmail.com
Wed Apr 11 19:41:05 CEST 2012


Parallel is one of those packages (like tools or grid) that is not
loaded by default, but comes with the standard installation.

Running library(parallel) will make mclapply() available. Then (at
least for me) it's easy to parallelize some code:

system.time(lapply(1:50000, function(x) max(rnorm(500)))) # ~ 8 seconds

system.time(mclapply(1:50000, function(x) max(rnorm(500)))) # ~ 4.4
seconds [I have two processors]

Michael

On Wed, Apr 11, 2012 at 12:34 PM, Wyatt McMahon <wmcmahon at vbi.vt.edu> wrote:
> Michael,
>
> Thanks for your help!
>
> I may not be understanding you. I've upgraded to 2.15.  From your text
> below, I thought the parallel package was included with R 2.15, but I
> cannot find an mclapply function there.  One exists through the multicore
> package, which I've now installed.  I also went looking for a "parallel"
> package, but was unable to find one.
>
> Is there an mclapply included in 2.15?  Is there a parallel package I'm
> missing?  Or am I completely misunderstanding your response?
>
> Thanks!
>
> Wyatt
>
> -----Original Message-----
> From: R. Michael Weylandt [mailto:michael.weylandt at gmail.com]
> Sent: Tuesday, April 10, 2012 12:07 PM
> To: Wyatt McMahon
> Cc: R-help at r-project.org
> Subject: Re: [R] multicore/mcparallel error
>
> I don't know the multicore package, but if possible, it might be easier to
> upgrade to 2.15 and use the new built-in parallel package that was
> introduced in R 2.14.
>
> Then your syntax would be something like
>
> mclapply(files, illumqc)
>
> Michael
>
> On Tue, Apr 10, 2012 at 11:33 AM, Wyatt McMahon <wmcmahon at vbi.vt.edu>
> wrote:
>> Hello everyone,
>>
>>
>>
>> I'm trying to parallelize an R script I have written.  To do this, I
>> am first trying to use the multicore package, because I've had some
>> previous success with that.
>>
>>
>>
>> The function I'm trying to parallelize is illumqc.  I'd like to create
>> a separate process for each of 8 files, contained in the vector "files".
>>
>>
>>
>> Below is my code:
>>
>>
>>
>> for(i in 1:length(files)){
>>
>> mcparallel(illumqc(files[i]))}
>>
>>
>>
>> I get the following error:
>>
>>
>>
>> Error in sendMaster(serialize(try(eval(expr, env), silent = TRUE),
>> NULL,
>> :
>>
>>  ignoring SIGPIPE signal
>>
>> Calls: mcparallel -> sendMaster -> .Call
>>
>> In addition: Warning message:
>>
>> In min(which(alf != 0)) : no non-missing arguments to min; returning
>> Inf
>>
>>
>>
>>
>>
>> However, if I try and make a simpler example, everything works
>> correctly, so I'm not sure what's going wrong with this function.  Do
>> I need to post the contents of the function as well?  I'm hoping
>> someone can recognize this error and give me a clue as to what is
>> going wrong since the function is fairly long.
>>
>>
>>
>>
>>
>> Thanks in advance,
>>
>>
>>
>> Wyatt
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> sessionInfo()
>>
>> R version 2.13.1 (2011-07-08)
>>
>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>
>>
>>
>> locale:
>>
>> [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>
>> [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>
>> [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
>>
>> [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>
>> [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>
>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>>
>>
>> attached base packages:
>>
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>>
>>
>> other attached packages:
>>
>> [1] ShortRead_1.10.4    Rsamtools_1.4.3     lattice_0.19-30
>>
>> [4] Biostrings_2.20.4   GenomicRanges_1.4.8 IRanges_1.10.6
>>
>> [7] multicore_0.1-7
>>
>>
>>
>> loaded via a namespace (and not attached):
>>
>> [1] Biobase_2.12.2 grid_2.13.1    hwriter_1.3
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> 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.



More information about the R-help mailing list