snow-cluster              package:snow              R Documentation

_C_l_u_s_t_e_r-_L_e_v_e_l _S_N_O_W _F_u_n_c_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     Functions for computing on a SNOW cluster.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

      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

_D_e_t_a_i_l_s:

     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 <URL:
     http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html>.

_E_x_a_m_p_l_e_s:

       ## 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)

