Strange behaviour of the chains when running in parallel

Hi everybody.

Since 1 month I am experiencing strange behaviours with the parallelization of chains. I try to explain myself better:

I start by calling the package and putting the options for the mc.cores as following :


options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)

Then I set the values for the number of iterations, warmup and chains, and I launch the simulation as follows:

iter <- 12000
warmup <- 10000
chains <- 6

fit = stan(model_name="Long_reg", file = file.source, 
                  data = dat, iter = iter, warmup = warmup,                      
                  control = list(max_treedepth = 15),
                  chains = chains, verbose = TRUE)

The simulation starts properly but one chain (a different one each time) proceed until it finishes its iterations, and the other chains (in this case the other 5) remains stuck without proceeding.

Am I missing something? Is there anybody else experiencing the same issue?

Many thanks.


Do they run normally in series? Alternatively, you can also try CmdStanR (I can’t be much help beyond this, but I had a few issues/limitations with PyStan that I managed to get around with CmdStan and CmdStanPy).

1 Like

Can you reproduce this behavior on one of the built-in examples, i.e. bernoulli.stan?

1 Like