startMPIcluster
function is used to start an MPI cluster.startMPIcluster(count, verbose=FALSE, workdir=getwd(), logdir=workdir,
maxcores=1, includemaster=TRUE, bcast=TRUE,
comm=if (mpi.comm.size(0) > 1) 0 else 3,
intercomm=comm + 1, mtag=10, wtag=11,
defaultopts=list())
count
argument, because startMPIcluster
will
try to do something reasonable. To be more specific, if
comm
is 0
, then it will set count
to
mpi.comm.size(0) - 1
. In fact, it is an error to set
count
to any other value. If comm
is greater than
0
, it will determine the number of processes to spawn by calling
mpi.universe.size()
. If that value is greater than one, then
count
is set to one less. If that value is equal to one, then
count
is arbitrarily set to 2
.
Note that if you've started the script without
mpirun, than mpi.universe.size()
will always return
1
, so count
will default to 2
.FALSE
.workdir
.1
.TRUE
.FALSE
is specified, the
data is sent by separate messages to each worker, which is sometimes
faster than using a broadcast. So this option really controls whether
to do a real or an emulated broadcast. Defaults to TRUE
.comm
and intercomm
. It defaults to 0
if mpi.comm.size(0) > 1
, otherwise 3
.comm + 1
.10
.11
..options.mpi
options.
These options include: chunkSize
, info
,
profile
, bcastThreshold
, forcePiggyback
,
nocompile
, and seed
.## Not run: ------------------------------------
# # start and register an MPI cluster with two workers in verbose mode:
# cl <- startMPIcluster(count=2, verbose=TRUE)
# registerDoMPI(cl)
# # and shut it down
# closeCluster(cl)
#
# # set the working directory to /tmp:
# cl <- startMPIcluster(count=2, workdir='/tmp')
# registerDoMPI(cl)
# # and shut it down
# closeCluster(cl)
## ---------------------------------------------
Run the code above in your browser using DataLab