What is the effect of running sample() with 4 chains on 16 cores?

I’m running the sample command with chains=4 and cores=16 (on my 16 cores box) and I see in the output that 4 chains are sampled (“Sampling 4 chains”). Htop command shows that all 16 cores are working. Can I infer that the 4 chains are parallelized over the 16 cores in some way?
Thanks, Patrick

1 Like

Did you specify a cores number to sample? If you didn’t, it will attempt to set it equal to the number of chains. What this parameter does, is it sets the number of processes that will sample from the independent chains in parallel.

In your case, you should see the main root process and four worker processes that are sampling the four chains in parallel. You must be seeing that all 16 cores are being used because of some intrinsic parallelization in a blas library, like mkl or lapack, that parallelizes some operations across many threads.

Yes @lucianopaz, I specified cores and chains. So I see the 16 cores are being used because of some intrinsic parallelization as you said. Thank you for the info.