Skip to content
Prev 155379 / 398502 Next

RMPI Question

Hi Tolga --

tolga.i.uzuner at jpmorgan.com writes:
mpi.remote.exec can be thought of as evaluating each command in a new
environment. so once mpi.remote.exec returns, the environment (and any
side effects like assignment) disappear.

You could:
X1 X2
1  2  2
X1 X2
1  2  2

the <<- forces assignment to the first 'a' found in the scope of the
invoking function, or in .GlobalEnv if no variable 'a' currently
exists. mpi.remote.exec(a) looks for a variable named a, first in the
environment where the remote request is being evaluated, and
eventually in the global environment. The <<- is dangerous because you
could accidentally clobber other variables named 'a' that exist before
the global environment is found. I think mpi.remote.exec is meant to
be used to evaluate a command that has no side effects (like variable
assignmnet).

On the other hand,
X1 X2
1  1  1

Here mpi.bcast.cmd is arranging to evaluate the expression in the
global environment, and so this is more like interacting at the
command prompt. mpi.remote.exec 'works' because R does not find the
variable 'a' until it reaches the global environment. A more reliable
solution would be
X1 X2
1  1  1

Martin

  
    
Message-ID: <6phprnepl2x.fsf@lamprey.fhcrc.org>
In-Reply-To: <OF59858257.1952E4AE-ON802574BE.00546416-802574BE.005CFDCA@jpmchase.com> (tolga i. uzuner's message of "Mon, 8 Sep 2008 17:55:43 +0100")