mpi.spawn.Rslaves
spawns R slaves to those hosts automatically
chosen by MPI or specific hosts assigned by the argument hosts
.
Those R slaves are running in R BATCH mode with a specific Rscript file.
The default Rscript file "slavedaemon.R" provides interactive R slave
environments.
mpi.close.Rslaves
shuts down R slaves spawned by
mpi.spawn.Rslaves
.
tailslave.log
view (from tail) R slave log files (assuming they are all
in one working directory).
mpi.spawn.Rslaves(Rscript=system.file("slavedaemon.R", package="Rmpi"),
nslaves=mpi.universe.size(), root = 0, intercomm = 2,
comm = 1, hosts = NULL, needlog = TRUE, mapdrive=TRUE, quiet = FALSE,
nonblock=TRUE, sleep=0.1)mpi.close.Rslaves(dellog = TRUE, comm = 1)
tailslave.log(nlines = 3, comm = 1)
Unless quiet = TRUE
, mpi.spawn.Rslaves
prints to stdio how many
slaves are successfully spawned and where they are running.
mpi.close.Rslaves
return 1 if success and 0 otherwise.
tailslave.log
returns last lines of R slave's log files.
an R script file used to run R in BATCH mode.
number of slaves to be spawned.
the rank number of the member who spawns R slaves.
an intercommunicator number
a communicator number merged from an intercomm.
NULL or LAM node numbers to specify where R slaves to be spawned.
a logical. If TRUE, R BATCH outputs will be saved in log files. If FALSE, the outputs will send to /dev/null.
a logical. If TRUE and master's working dir is on a network, mapping network drive is attemped on remote nodes under windows platform.
a logical. If TRUE, do not print anything unless an error occurs.
a logical. If TRUE, a nonblock procedure is used on all slaves so that they will consume none or little CPUs while waiting.
a sleep interval, used when nonblock=TRUE. Smaller sleep is, more response slaves are, more CPUs consume.
a logical specifying if R slave's log files are deleted or not.
number of lines to view from tail in R slave's log files.
Hao Yu
The R slaves that mpi.spawn.Rslaves
spawns are really running a shell
program which can be found in system.file("Rslaves.sh",package="Rmpi")
which takes a Rscript file as one of its arguments. Other arguments are
used to see if a log file (R output) is needed and how to name it. The master
process id and the comm number, along with host names where R slaves are running are
used to name these log files.
Once R slaves are successfully spawned, the mergers from an intercomm (default `intercomm = 2') to a comm (default `comm = 1') are automatically done on master and slaves (should be done if the default Rscript is replaced). If additional sets of R slaves are needed, please use `comm = 3', `comm = 4', etc to spawn them. At most a comm number up to 10 can be used. Notice that the default comm number for R slaves (using slavedaemon.R) is always 1 which is saved as .comm.
To spawn R slaves to specific hosts, please use the argument hosts
with a list of those node numbers (an integer vector). Total node numbers
along their host names can be found by using lamhosts
.
Notice that this is LAM-MPI specific.
mpi.comm.spawn
,
lamhosts
.
# \donttest{
#mpi.spawn.Rslaves(nslaves=2)
#tailslave.log()
#mpi.remote.exec(rnorm(10))
#mpi.close.Rslaves()
# }
Run the code above in your browser using DataLab