Experimental functions to collect and display timing data for cluster computations.
snow.time(expr)
# S3 method for snowTimingData
print(x, ...)
# S3 method for snowTimingData
plot(x, xlab = "Elapsed Time", ylab = "Node",
title = "Cluster Usage", ...)
expression to evaluate
timing data object to plot or print
x axis label
y axis label
plot main title
additional arguments
snow.time
collects and returns and returns timing information
for cluster usage in evaluating expr
. The return value is an
object of class snowTimingData
; details of the return
value are subject to change. The print
method for
snowTimingData
objects shows the total elapsed time, the total
communication time between master and worker nodes, and the compute
time on each worker node. The plot
, motivated by the display
produced by xpvm
, produces a Gantt chart of the computation, with
green rectangles representing active computation, blue horizontal lines
representing a worker waiting to return a result, and red lines
representing master/worker communications.
# NOT RUN {
# }
# NOT RUN {
cl <- makeCluster(2,type="SOCK")
x <- rnorm(1000000)
tm <- snow.time(clusterCall(cl, function(x) for (i in 1:100) sum(x), x))
print(tm)
plot(tm)
stopCluster(cl)
# }
Run the code above in your browser using DataLab