Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mpi.remote.exec

Remote Executions on R slaves


Description

Remotely execute a command on R slaves spawned by using slavedaemon.R script and return all executed results back to master.

Usage

mpi.remote.exec(cmd, ..., simplify = TRUE, comm = 1, ret = TRUE)

Arguments

cmd

the command to be executed on R slaves

...

used as arguments to cmd (function command) for passing their (master) values to R slaves, i.e., if ‘myfun(x)’ will be executed on R slaves with ‘x’ as master variable, use mpi.remote.exec(cmd=myfun, x).

simplify

logical; should the result be simplified to a data.frame if possible?

comm

a communicator number.

ret

return executed results from R slaves if TRUE.

Details

Once R slaves are spawned by mpi.spawn.Rslaves with the slavedaemon.R script, they are waiting for instructions from master. One can use mpi.bcast.cmd to send a command to R slaves. However it will not return executed results. Hence mpi.remote.exec can be considered an extension to mpi.bcast.cmd.

Value

return executed results from R slaves if the argument ret is set to be TRUE. The value could be a data.frame if values (integer or double) from each slave have the same dimension. Otherwise a list is returned.

Warning

mpi.remote.exec may have difficult guessing invisible results on R slaves. Use ret = FALSE instead.

Author(s)

Hao Yu

See Also

Examples

mpi.remote.exec(mpi.comm.rank())
 x=5
mpi.remote.exec(rnorm,x)

Rmpi

Interface (Wrapper) to MPI (Message-Passing Interface)

v0.6-9.1
GPL (>= 2)
Authors
Hao Yu [aut]
Initial release
2021-02-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.