Brian Smith
Brian Smith

Reputation: 1353

How to initiate cores in parallel package of R

To initiate the cluster, it is advised to use below codes

library(parallel)
cl <- makeCluster(getOption("cl.cores", 2))

However I fail to understand what is the meaning of getOption("cl.cores", 2)? How exactly I can find the number of cores in my windows system to run parallel computation?

Upvotes: 0

Views: 215

Answers (1)

SamR
SamR

Reputation: 20405

The usual way to do this is:

num_cores  <- parallel::detectCores() # 8 in my case
cluster  <- parallel::makeCluster(num_cores-1)

Upvotes: 1

Related Questions