makeCluster
starts a cluster of the specified or default type
and returns a reference to the cluster. Supported cluster types are
"SOCK"
,
and "MPI"
. For
"MPI"
clusters the spec
argument should be an integer
specifying the number of worker nodes to create. For "SOCK"
clusters spec
should be a character vector naming the hosts on
which worker nodes should be started; one node is started for each
element in the vector. For "SOCK"
clusters spec
can also be an integer specifying the
number of worker nodes to create on the local machine.
For SOCK
clusters the spec
can also be a
list of machine specifications, each a list of named option values.
Such a list must include a character value named host
host
specifying the name or address of the host to use. Any other option
can be specified as well. For SOCK
clusters
this may be a more convenient alternative than inhomogeneous cluster
startup procedure. The options rscript
and snowlib
are
often useful; see the examples below.
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 worker 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 type
and homogeneous
. The
default value of the type
option is currently set to
"MPI" if Rmpi is on the search path. Otherwise it is set to
"MPI"
if Rmpi is available,
and to "SOCK"
otherwise.
The homogeneous
option should be set to FALSE
to
specify that the startup procedure for inhomogeneous clusters is to
be used; this requires some additional configuration. The default
setting is TRUE
unless the environment variable
R_SNOW_LIB
is defined on the master host with a non-empty
value.
The optionoutfile
can be used to specify the file to which
worker 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. On some systems setting outfile
to ""
or
to /dev/tty
will result in worker output being sent tothe
terminal running the master process.
The functions makeSOCKcluster
,
and makeMPIcluster
can be used to start
a cluster of the corresponding type.
In MPI configurations where process spawning is not available and
something like mpirun
is used to start a master and a set of workers
the corresponding cluster will have been pre-constructed and can be obtained
with getMPIcluster
. It is also possible to obtain a reference
to the running cluster using makeCluster
or
makeMPIcluster
. In this case the count
argument can be
omitted; if it is supplied, it must equal the number of nodes in the
cluster. This interface is still experimental and
subject to change.
For SOCK
clusters the option manual = TRUE
forces a
manual startup mode in which the master prints the command to be run
manually to start a worker process. Together with setting the
outfile
option this can be useful for debugging cluster startup.
For more details see
https://stat.uiowa.edu/~luke/R/cluster/cluster.html.