multicore performance question
On 09/07/12 14:01, Rainer M Krug wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/07/12 12:18, Mauricio Zambrano-Bigiarini wrote:
I apologise. In my previous e-mail I did not write the time spent in each function: # No multicore nr<- 500 ; X<- matrix(rnorm(1000), ncol=30, nrow=nr) set.seed(100) system.time( unlist(lapply(1:nr, FUN=fn1, x=X)) ) # user system elapsed # 0.013 0.000 0.013 # multicore nr<- 500 ; X<- matrix(rnorm(1000), ncol=30, nrow=nr) set.seed(100) system.time( unlist(mclapply(1:nr, FUN=fn1, x=X, mc.cores=6)) ) # user system elapsed # 0.030 0.380 0.125 Running on RHEL6 (64) with 8 cores.
Typical for communication: trying to distribute the job to 8 cores, doing the calculations, getting the data back, assemble it -> longer then the calculations on one core.
Thanks for your feedback Rainer. In fact, after doing the same test for a test function with a much longer computation time, the time saving was 43% by using 6 cores, wrt the time spent without the multicore package. All the best, Mauricio
==================================================== Water Resources Unit Institute for Environment and Sustainability (IES) Joint Research Centre (JRC), European Commission webinfo : http://floods.jrc.ec.europa.eu/ ==================================================== DISCLAIMER: "The views expressed are purely those of the writer and may not in any circumstances be regarded as sta- ting an official position of the European Commission" ==================================================== Linux user #454569 -- Ubuntu user #17469 ==================================================== "If you torture any data set long enough, it will confess anything!" (Murray Lark) > > Cheers, > > Rainer > >> >> Thanks in advance, >> >> Mauricio >> > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAk/6yCEACgkQoYgNqgF2egrrmQCcDcYv1V1PXlO+oxHQ7wUbgait > bOoAn0tWYrIVxikHz3a4Ws2eHtJn2ATB > =4IMK > -----END PGP SIGNATURE----- > >