[R] Rcpp and mclapply

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Oct 10 16:15:14 CEST 2013

I would bet that you are doing something in C++ that shares some resource between the workers and blocks all but one worker at a time.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

sophie_brugieres at mpipsykl.mpg.de wrote:
>Dear all,
>I have an R script that uses Rcpp, and I have been trying to
>it using mclapply (I tried with the multicore and the parallel library)
>Sometimes (not always, interestingly), the CPU use for each core drops,
>usually so that the total over all cores reaches 100%, i.e., as fast as
>using just one single core fully. I tried my code directly from within
>emacs, and also using a shell command - it happens either way.
>I suspect there might be some interaction between Rcpp and the
>multicore/parallel libraries. Did any R(cpp) user encounter such
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list