Skip to content
Prev 716 / 2152 Next

Cluster R "environment" trouble. Using Rmpi

Hi Paul,

Just got back from two conferences.

First of all, when R slaves are spawned, they are "naked", meaning they
are started with basic R functions/lib even that they are in the same dir
with master. You have to tell slaves to get all necessary objects or to
load libraries specifically. There are a few ways to do so.

Use mpi.bcast.Robj2slave(an Robj) to send "an Robj" from master to all
slaves. If a function to be executed on slaves depends on many
functions/data, those functions/data must be sent to slaves first.

Use mpi.bcast.cmd (cmd()) to tell salves to run cmd() like
source("SimJob.R") (make sure to remove any execution commands in
SimJob.R). I don't know if race condition will be an issue since slaves
are competing for the same file.

mpi.scatter.Robj/mpi.gather.Rojb can also be used to send/receive objects
among master and slaves.

Hao
Paul Johnson wrote: