View source: R/batchReduceResults.R
batchReduceResults | R Documentation |
Each jobs reduces a certain number of results on one slave.
You can then submit these jobs to the batch system.
Later, you can do a final reduction with reduceResults
on the master.
batchReduceResults( reg, reg2, fun, ids, part = NA_character_, init, block.size, more.args = list() )
reg |
[ |
reg2 |
[ |
fun |
[ |
ids |
[ |
part |
[ |
init |
[any] |
block.size |
[ |
more.args |
[ |
Vector of type integer
with job ids.
# generating example results: reg1 = makeRegistry(id = "BatchJobsExample1", file.dir = tempfile(), seed = 123) f = function(x) x^2 batchMap(reg1, f, 1:20) submitJobs(reg1) waitForJobs(reg1) # define function to reduce on slave, we want to sum the squares myreduce = function(aggr, job, res) aggr + res # sum 5 results on each slave process, i.e. 4 jobs reg2 = makeRegistry(id = "BatchJobsExample2", file.dir = tempfile(), seed = 123) batchReduceResults(reg1, reg2, fun = myreduce, init = 0, block.size = 5) submitJobs(reg2) waitForJobs(reg2) # now reduce one final time on master reduceResults(reg2, fun = myreduce)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.