splitpb {pbapply} | R Documentation |
Divide Tasks for Progress-bar Friendly Distribution in a Cluster
Description
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.
Usage
splitpb(nx, ncl, nout = NULL)
Arguments
nx |
Number of tasks. |
ncl |
Number of cluster nodes. |
nout |
Integer, maximum number of partitions in the output (must be > 0). |
Value
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
).
Author(s)
Peter Solymos <solymos@ualberta.ca>
See Also
Parallel usage of pbapply
and related functions.
Examples
## 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)
[Package pbapply version 1.7-2 Index]