split_parapply {bigparallelr} | R Documentation |
A Split-Apply-Combine strategy to parallelize the evaluation of a function.
split_parapply(
FUN,
ind,
...,
.combine = NULL,
ncores = nb_cores(),
nb_split = ncores,
opts_cluster = list(),
.costs = NULL
)
FUN |
The function to be applied to each subset matrix. |
ind |
Initial vector of indices that will be splitted in |
... |
Extra arguments to be passed to |
.combine |
Function to combine the results with |
ncores |
Number of cores to use. Default uses |
nb_split |
Number of blocks. Default uses |
opts_cluster |
Optional parameters for clusters passed as a named list.
E.g., you can use |
.costs |
Vector of costs (e.g. proportional to computation time)
associated with each element of |
This function splits indices in parts, then apply a given function to each part and finally combine the results.
Return a list of ncores
elements, each element being the result of
one of the cores, computed on a block. The elements of this list are then
combined with do.call(.combine, .)
if .combined
is not NULL
.
## Not run:
str(
split_parapply(function(ind) {
sqrt(ind)
}, ind = 1:10000, ncores = 2)
)
## End(Not run)