StartParallel | R Documentation |
Accelerate distance calculation by employing multiple CPU workers.
StartParallel(...)
SetParallel(cl)
GetParallel(cl)
StopParallel(quietly = FALSE)
... |
Parameters to pass to |
cl |
An existing cluster. |
quietly |
Logical; if |
"TreeDist" parallelizes the calculation of tree to tree distances via
the parCapply()
function, using a user-defined cluster specified in
options("TreeDist-cluster")
.
StartParallel()
calls parallel::makeCluster()
and tells "TreeDist" to
use the created cluster.
SetParallel()
tells "TreeDist" to use a pre-existing or user-specified
cluster.
StopParallel()
stops the current TreeDist cluster.
StartParallel()
and SetParallel()
return the previous value of
options("TreeDist-cluster")
.
GetParallel()
returns the currently specified cluster.
StopParallel()
returns TRUE
if a cluster was destroyed,
FALSE
otherwise.
Martin R. Smith (martin.smith@durham.ac.uk)
if (interactive()) { # Only run in terminal
library("TreeTools", quietly = TRUE)
nCores <- ceiling(parallel::detectCores() / 2)
StartParallel(nCores) # Takes a few seconds to set up processes
GetParallel()
ClusteringInfoDistance(as.phylo(0:6, 100))
StopParallel() # Returns system resources
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.