[R] mcmapply should be parallel, but runs serial?

Martin Ivanov tramni at abv.bg
Sat May 11 14:38:50 CEST 2013


 Dear all,

I am running R-3.0 on Slackware64 Linux (Linux marto 2.6.38.4 #1 SMP Thu Apr 21 20:48:11 CDT 2011 x86_64 Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz GenuineIntel GNU/Linux)

Here is a minimal example:

library(parallel);
fun <- function(fileName) { file.create(fileName); Sys.sleep(time=120); }
mcmapply(fileName=c("mcm1", "mcm2"), FUN=fun, mc.cores=2);
mclapply(X=c("mcl1", "mcl2"), FUN=fun, mc.cores=2);

Just compare the time stamps of the mcm* and mcl* files. You will see that
while the mcl* files have equal time stamps, i.e. they have been created simultaneously,
the mcm files are created one after the other, with exactly 120 seconds of difference.
This is what I see on my machine:

bash-4.1$ ls -l mcm*
-rw-r--r-- 1 marto users 0 May 11 14:25 mcm1
-rw-r--r-- 1 marto users 0 May 11 14:27 mcm2
bash-4.1$ ls -l mcl*
-rw-r--r-- 1 marto users 0 May 11 14:29 mcl1
-rw-r--r-- 1 marto users 0 May 11 14:29 mcl2


Any ideas?

Best regards,

Martin



More information about the R-help mailing list