Attempt to kill the specified parallel cluster. Might have unexpected side effects when using the kill all command.

parallel.destroy(cl = NULL, destroy = FALSE)

Arguments

cl

Type: cluster or integer. A parallel cluster. When it is a number, creates a cluster with the specified number of parallel clusters. Defaults to parallel::detectCores().

destroy

Type: logical. Whether to attempt to destroy any cluster. Might have side effects. Defaults to FALSE.

Value

TRUE.

Examples

# NOT RUN { # Cannot pass CRAN checks. Disabled. library(parallel) # Generate 2 useless clusters of 8 threads cl <- parallel::makeCluster(8) cl <- parallel::makeCluster(8) # Attempts to stop the second cluster parallel.destroy(cl) # Kills any clusters parallel.destroy(destroy = TRUE) # }