Skip to content

how can I

3 messages · Takatsugu Kobayashi, Martin Morgan

#
Hi,

Currently I am trying to see how much parallel processing
packages like multicore and snow can improve computing
times.

Then I would like to ask if I did anything wrong as I don't see
any significant improvement between lapply and mclapply
while following examples shown in "parallel computing in R"
written by Chao and Wee:

library(multicore)
system.time(out <- mclapply(pair, geneCor)
system.time(out <- lapply(pair, geneCor)

I guess the reason would be that only a single core was being
used even with multicore package.

Then, how can I see if all the cores are being used for computation?

Thanks!!!

Taka
#
On 08/23/2011 06:08 AM, Takatsugu Kobayashi wrote:
Hi Taka --

a favorite of mine is

 > library(multicore)
 > system.time(mclapply(1:4, function(i) Sys.sleep(2)))
    user  system elapsed
   0.005   0.006   2.008
 > system.time(lapply(1:4, function(i) Sys.sleep(2)))
    user  system elapsed
   0.002   0.000   8.009

the system utility 'top' is one way of seeing processors in action. If 
there are issues then

 > sessionInfo()
R Under development (unstable) (2011-08-13 r56726)
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=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 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] multicore_0.1-5

loaded via a namespace (and not attached):
[1] tools_2.14.0

can be essential to diagnose problems.

Martin

  
    
#
Hi Morgan

I tried your code, and here is what I got.
It looks like multiple cores are not being allocated/used for
my computation.... I will try to figure out why with the linux
administrator at work.
user        system       elapsed
     0.000      0.000      8.002
user        system    elapsed
     0.000      0.000      8.002

But if you have an idea of why, that would be great if you could
share that with me.

Thanks!!!

Taka
On Wed, Aug 24, 2011 at 1:01 AM, Martin Morgan <mtmorgan at fhcrc.org> wrote: