Learn R Programming

dclone (version 2.1-1)

clusterSize: Optimizing the number of workers

Description

These functions help in optimizing workload for the workers if problems are of different size.

Usage

clusterSize(size)
plotClusterSize(n, size, 
    balancing = c("none", "load", "size", "both"),
    plot = TRUE, col = NA, xlim = NULL, ylim = NULL, 
    main, ...)

Arguments

n
Number of workers.
size
Vector of problem sizes (recycled if needed). The default 1 indicates equality of problem sizes.
balancing
Character, type of balancing to perform, one of c("none", "load", "size", "both").
plot
Logical, if a plot should be drawn.
col
Color of the polygons for work load pieces.
xlim, ylim
Limits for the x and the y axis, respectively (optional).
main
Title of the plot, can be missing.
...
Other arguments passed to polygon.

Value

  • clusterSize returns a data frame with approximate processing time as the function of the number of workers (rows, in 1:length(size)) and the type of balancing (c("none", "load", "size", "both")). Approximate processing time is calculated from values in size without taking into account any communication overhead. plotClusterSize invisibly returns the total processing time needed for a setting given its arguments. As a side effect, a plot is produced (if plot = TRUE).

encoding

UTF-8

Details

These functions help determine the optimal number of workers needed for different sized problems ('size' indicates approximate processing time here). The number of workers needed depends on the type of balancing. For the description of the balancing types, see snowWrapper.

Examples

Run this code
## determine the number of workers needed
clusterSize(1:5)
## visually compare balancing options
opar <- par(mfrow=c(2, 2))
plotClusterSize(2,1:5, "none")
plotClusterSize(2,1:5, "load")
plotClusterSize(2,1:5, "size")
plotClusterSize(2,1:5, "both")
par(opar)

Run the code above in your browser using DataLab