[R-sig-hpc] multicore:pvec error when length of v is less than number of cores
Cook, Malcolm
MEC at stowers.org
Wed Oct 12 17:19:15 CEST 2011
Hi Simon et al,
I find that the return value of multicore:pvec includes error messages when the length of input vector is less than number of cores.
Additionally, to accomodate the error message being a character, any other non message results wind up being coerced to strings.
Here is an example running on my 16 core computer:
> tail(pvec(1:(multicore:::detectCores()-1),identity))
[1] "11"
[2] "12"
[3] "13"
[4] "14"
[5] "15"
[6] "Error in l[[i]] : subscript out of bounds\n"
Warning message:
In pvec(1:(multicore:::detectCores() - 1), identity) :
some results may be missing, folded or caused an error
The logic of computing the array indices needs revisiting.
I quick-patched it by setting:
cores <- min(cores,n)
right after pvec sets
n <- length(v)
and now I get:
> tail(pvec(1:(multicore:::detectCores()-1),identity))
[1] 10 11 12 13 14 15
Better?
-Malcolm
More information about the R-sig-hpc
mailing list