Extension of the snow package supporting fault tolerant and reproducible applications, dynamic cluster resizing, as well as supporting easy-to-use parallel programming - only one function is needed. It supports the MPI and the socket communication layers.
The main function of this package,
performParallel, handles all tasks that are necessary for evaluating a user-defined function in parallel. These include creating a cluster, initializing nodes, handling a random number generator, processing the given function on the cluster and cleaning up. In the very basic settings (i.e. when using with the socket layer), no additional software is necessary. The package can be used on a single multi-processor/core machine, homogeneous cluster, or a heterogeneous group of computers.
The package supports creating and handling a snow cluster that is:
Fault tolerant: The master checks repeatedly for failures in its waiting time and initiates a failure recovery if needed. (This feature has been implemented for the PVM layer. Unfortunately, the PVM layer had to be switched off due to the rpvm package not being currently maintained.)
Load balanced AND produces reproducible results: one stream of random numbers associated with one replicate (instead of one stream per node as handled by snow and parallel).
Computationally transparent: Currently processed replicates and failed replicates stored into files. Allows defining a function that is called after each given number of replicates.
Dynamically resizeable: The cluster size is stored in a file which is read by the master repeatedly. In case of a modification the cluster is updated. (Not available for MPI.)
Administration overhead minimized: All administration is managed by the master in its waiting time. (Note that there is a time-overhead for creating and destroying the cluster, as well as the RNG initialization. Thus, simple operations, such as the example below, will not gain from running in parallel.)
Allows running processes sequentially with the same random numbers as it would in parallel. Thus, results can be compared between the two modes.
Easy to use: All features, including creating the cluster, RNG initialization and clean-up, are available via one single function -
Hana Sevcikova, A. J. Rossini
Maintainer: Hana Sevcikova <[email protected]>
1 2 3 4 5 6 7 8 9 10 11 12 13 14
## Not run: # generates 500 times 1000 normally distributed random numbers on 5 nodes # (all localhost) res <- performParallel(5, rep(1000, 500), fun = rnorm, cltype = "SOCK") print(mean(unlist(res))) # View cluster usage # number of physical nodes P <- parallel::detectCores(logical = FALSE) t <- snow::snow.time(performParallel(P, rep(1e6, 50), fun = function(x) median(rnorm(x)), cltype = "SOCK")) plot(t) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.