[R] Syntax for Rmpi cf multicore
Patrick Connolly
p_connolly at slingshot.co.nz
Mon Oct 4 10:54:27 CEST 2010
I'm aiming to compare the workings of Rmpi and multicore on a duel
processor quad core machine with 64 bit R-2.11.1 Kubuntu 10.4.
It's impossible for me to get a small reproducable code segment to
show what I mean, but if I show what works for mclapply, I'd hope it's
possible to be shown what would be the equivalent way with mpi.apply.
The function lr.gbm has variables trees, folds and minob which I use
with mclapply like this:
out <- mclapply(subsets, lr.gbm, mc.cores = 6, trees=trees, folds=folds,
minob=minob)
subsets is simply a vector that looks like this:
[1] "COB_2" "CNJ_2" "COB_3" "CNJ_3" "COB_4" "CNJ_4"
and that works more or less fine to produce a list of length 6 which
I've named with the elements of the subsets vector.
names(out) <- subsets
Now, when I use mpi.apply, I make the trees, folds and minob available
to all slaves thus:
mpi.spawn.Rslaves(nslaves=6)
mpi.bcast.Robj2slave(trees)
mpi.bcast.Robj2slave(folds)
mpi.bcast.Robj2slave(minob)
but, I can't work out what sort of 'array' is required for the first
argument to mpi.apply.
out.mpi <- mpi.apply(subsets.l, lr.gbm)
What should subsets.l look like? I tried a list of length 6 with
elements the same as those in 'subsets', but evidently, something more
array-like is required, but I'm out of ideas.
TIA
--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
___ Patrick Connolly
{~._.~} Great minds discuss ideas
_( Y )_ Average minds discuss events
(:_~*~_:) Small minds discuss people
(_)-(_) ..... Eleanor Roosevelt
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
More information about the R-help
mailing list