| splitpb {pbapply} | R Documentation |
Divides up 1:nx into approximately equal sizes (ncl)
as a way to allocate tasks to nodes in a cluster repeatedly
while updating a progress bar.
splitpb(nx, ncl, nout = NULL)
nx |
Number of tasks. |
ncl |
Number of cluster nodes. |
nout |
Integer, maximum number of partitions in the output (must be > 0). |
A list of length min(nout, ceiling(nx / ncl)),
each element being an integer vector of length ncl * k or less,
where k is a tuning parameter constrained by the other arguments
(k = max(1L, ceiling(ceiling(nx / ncl) / nout)) and
k = 1 if nout = NULL).
Peter Solymos <solymos@ualberta.ca>
Parallel usage of pbapply and related functions.
## define 1 job / worker at a time and repeat splitpb(10, 4) ## compare this to the no-progress-bar split ## that defines all the jubs / worker up front parallel::splitIndices(10, 4) ## cap the length of the output splitpb(20, 2, nout = NULL) splitpb(20, 2, nout = 5)