Does Stan use multiple cores for multiple chains simultaneously even if we don't specify cores = 4 for chains =4?

Hi Everyone,

Suppose inside my Stan function, I don’t specify cores =4,

fit <- stan ( … , chains =4)

will it use 4 cores simultaneously for the 4 chains or does it perform MCMC sampling serially?

does explicitly mentioning no of cores fit <- stan ( … , chains =4, cores =4) necessary?

Thanks in advance

It is not necessary if you first do

options(mc.cores = 4)

Hi @bgoodri,

I had options(mc.cores = parallel::detectCores())

Does the above statement automatically detect the max no of cores available?

Also, if options(mc.cores = 4) is not specified at the start and if we don’t explicitly specify the number of cores inside fit <- stan ( … , chains =4), then it will be done in serial?

Hi, if things are setup correctly, doing options(mc.cores = 4) works, If not, then please provide us with a use case where you see that it doesn’t work.

1 Like