batchReduce | R Documentation |
Each jobs reduces a certain number of elements on one slave. You can then submit these jobs to the batch system.
batchReduce(reg, fun, xs, init, block.size, more.args = list())
reg |
[ |
fun |
[ |
xs |
[ |
init |
[any] |
block.size |
[ |
more.args |
[ |
Vector of type integer
with job ids.
# define function to reduce on slave, we want to sum a vector f = function(aggr, x) aggr + x reg = makeRegistry(id = "BatchJobsExample", file.dir = tempfile(), seed = 123) # sum 20 numbers on each slave process, i.e. 5 jobs batchReduce(reg, fun = f, 1:100, init = 0, block.size = 5) submitJobs(reg) waitForJobs(reg) # now reduce one final time on master reduceResults(reg, fun = function(aggr,job,res) f(aggr, res))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.