Starting and Stopping SNOW Clusters
Functions to start and stop a SNOW cluster and to set default cluster options.
makeCluster(spec, type = getClusterOption("type"), ...) stopCluster(cl)
makeSOCKcluster(names, ..., options = defaultClusterOptions) makePVMcluster(count, ..., options = defaultClusterOptions) makeMPIcluster(count, ..., options = defaultClusterOptions) getMPIcluster()
- cluster specification
- number of nodes to create
- character vector of node names
- cluster options object
- cluster object
- new option value
- cluster option specifications
makeCluster starts a cluster of the specified or default type
and returns a reference to the cluster. Supported cluster types are
"MPI" clusters the
spec argument should be an integer
specifying the number of slave nodes to create. For
spec should be a character vector naming the hosts on
which slave nodes should be started; one node is started for each
element in the vector.
stopCluster should be called to properly shut down the cluster
before exiting R. If it is not called it may be necessary to use
external means to ensure that all slave processes are shut down.
setDefaultClusterOptions can be used to specify alternate
values for default cluster options. There are many options. The
most useful ones are
default value of the
type option is currently set to
"PVM" if the
rpvm package is available; otherwise, it
is set to
Rmpi is available, and it is set to
"SOCK" if neither of these packages is found.
homogeneous option should be set to
specify that the startup procedure for inhomogeneous clusters is to
be used; this requires some additional configuration. The default
TRUE unless the environment variable
R_HOME_LIB is defined on the master host with a non-empty
outfile can be used to specify the file to which
slave node output is to be directed. The default is
/dev/null; during debugging of an installation it can be
useful to set this to a proper file.
makeMPIcluster can be used to start a cluster of the
In MPI configurations where process spawning is not available and
mpirun is used to start a master and a set of slaves
the corresponding cluster will have been pre-constructed and can be obtained
getMPIcluster. This interface is still experimental and
subject to change.
For more details see
cl <- makeCluster(c("localhost","localhost"), type = "SOCK") clusterApply(cl, 1:2, get("+"), 3)