makeCluster(spec, type, ...)
makePSOCKcluster(names, ...)
makeForkCluster(nnodes = getOption("mc.cores", 2L), ...)stopCluster(cl = NULL)
setDefaultCluster(cl = NULL)
"cluster"
.c("SOCKcluster", "cluster")
.makeCluster
creates a cluster of one of the supported types.
The default type, "PSOCK"
, calls makePSOCKcluster
. Type
"FORK"
calls makeForkCluster
. Other types are passed to
package https://CRAN.R-project.org/package=snow. makePSOCKcluster
is an enhanced version of
makeSOCKcluster
in package https://CRAN.R-project.org/package=snow. It runs
Rscript
on the specified host(s) to set up a worker process
which listens on a socket for expressions to evaluate, and returns the
results (as serialized objects). makeForkCluster
is merely a stub on Windows. On Unix-alike
platforms it creates the worker process by forking. The workers are most often running on the same host as the master,
when no options need be set. Several options are supported (mainly for makePSOCKcluster
):
master
port
R_PARALLEL_PORT
,
then a randomly chosen port in the range 11000:11999
.timeout
outfile
stdout
and
stderr
connection output from the workers.
""
indicates no redirection (which may only be useful for
workers on the local machine).
Defaults to /dev/null
(nul:
on Windows). The other
possibility is a file path on the worker's host.
Files will be opened in append mode, as all workers log to the
same file.homogeneous
Rscript
can be launched using
the same path on each? Otherwise Rscript
has to be in
the default path on the workers.rscript
Rscript
on the workers,
used if homogeneous
is true. Defaults to the full path on
the master.rscript_args
Rscript
such as --no-environ.renice
15
for a low priority.
OS-dependent: see psnice
for details.rshcmd
ssh
.user
manual
methods
useXDR
makeForkCluster
creates a socket cluster by forking
(and hence is not available on Windows). It supports options
port
, timeout
and outfile
, and always uses
useXDR = FALSE
. It is good practice to shut down the workers by calling
stopCluster
: however the workers will terminate
themselves once the socket on which they are listening for commands
becomes unavailable, which it should if the master R session is
completed (or its process dies). Function setDefaultCluster
registers a cluster as the default one
for the current session. Using setDefaultCluster(NULL)
removes
the registered cluster, as does stopping that cluster.