auto_cluster: Quickly Create a Cluster for Parallel Comprehension

Description Usage Arguments Value Functions Examples

View source: R/cluster.R

Description

A function to quickly create a cluster for use in parallel vector comprehensions. Use makeCluster from the parallel package for greater control. It defaults to making a PSOCK cluster on Windows systems and a Fork cluster on unix-based systems. close_cluster is a wrapper to stopCluster.

Usage

1
2
3
auto_cluster(ncore = detectCores() - 1)

close_cluster(clust)

Arguments

ncore

number of cores/nodes to use. If not specified, it attempts to detect the number of cores available and uses all but 1.

clust

cluster to close the connection to

Value

an object of class c("SOCKcluster", "cluster")

Functions

Examples

1
2
3
4
## Parallel vector comprehension
cluster <- auto_cluster(2)
Num(for (i in 1:1000) exp(sqrt(i)), clust=cluster)
close_cluster(cluster)

eList documentation built on Jan. 23, 2021, 1:05 a.m.