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
how can I
3 messages · Takatsugu Kobayashi, Martin Morgan
On 08/23/2011 06:08 AM, Takatsugu Kobayashi wrote:
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?
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
Thanks!!! Taka
_______________________________________________ R-sig-hpc mailing list R-sig-hpc at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793
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.
system.time(mclapply(1:4, function(i) Sys.sleep(2)))
user system elapsed
0.000 0.000 8.002
system.time(lapply(1:4, function(i) Sys.sleep(2)))
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:
On 08/23/2011 06:08 AM, Takatsugu Kobayashi wrote:
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?
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
Thanks!!! Taka
_______________________________________________ R-sig-hpc mailing list R-sig-hpc at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
-- Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793