snow-cluster {snow} | R Documentation |

Functions for computing on a SNOW cluster.

clusterSplit(cl, seq) clusterCall(cl, fun, ...) clusterApply(cl, x, fun, ...) clusterApplyLB(cl, x, fun, ...) clusterEvalQ(cl, expr) clusterExport(cl, list)

`cl` |
cluster object |

`fun` |
function or character string naming a function |

`expr` |
expression to evaluate |

`seq` |
vector to split |

`list` |
character vector of variables to export |

`x` |
array |

`...` |
additional arguments to pass to standard function |

These are the basic functions for computing on a cluster. All
evaluations on the slave nodes are done using `try`

. Currently
the result lists returned by the cluster computing functions can a
combination of proper results and `try`

error objects. More
sophisticated approaches will be considered in the future.

`clusterCall`

calls a function `fun`

with identical arguments
`...`

on each node in the cluster `cl`

and returns a list
of the results.

`clusterEvalQ`

evaluates a literal expression on each cluster node.
It a cluster version of `evalq`

, and is a convenience function
defined in terms of `clusterCall`

.

`clusterApply`

calls `fun`

on the first cluster node
with arguments `seq[[1]]`

and `...`

, on the second node with
`seq[[2]]`

and `...`

, and so on. The length of `seq`

must be less than or equal to the number of nodes in the cluster.
A list of the results is returned; the length of the result list
will equal the length of `seq`

.

`clusterApplyLB`

is a load balancing version of `clusterApply`

.
if the length `p`

of `seq`

is greater than the number of
cluster nodes `n`

, then the first `n`

jobs are placed in
order on the `n`

nodes. When the first job completes, the next
job is placed on the available node; this continues until all jobs
are complete. Using `clusterApplyLB`

can result in better
cluster utilization than using `clusterApply`

. However,
increased communication can reduce performance. Furthermore, the
node that executes a particular job is nondeterministic, which can
complicate ensuring reproducibility in simulations.

`clusterExport`

assigns the global values on the master of the
variables named in `list`

to variables of the same names in the
global environments of each node.

`clusterSplit`

splits `seq`

into one consecutive piece for
each cluster and returns the result as a list with length equal to the
number of cluster nodes. Currently the pieces are chosen to be close
to equal in length. Future releases will attempt to use relative
performance information about nodes to choose split proportional to
performance.

For more details see http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html.

## Not run: cl <- makeSOCKcluster(c("localhost","localhost")) clusterApply(cl, 1:2, get("+"), 3) clusterEvalQ(cl, library(boot)) x<-1 clusterExport(cl, "x") clusterCall(cl, function(y) x + y, 2) ## End(Not run)

[Package *snow* version 0.2-1 Index]