Hello,
I’m seeing some weird behavior when running the exact same code on mac vs. linux.
Mac: Latest M3 chip. Stan version 2.34.1
Linux: Recent Intel chip, Fedora 39. Stan version: 2.34.1
On the mac, I get some early warnings about rejected proposals, but then things settle down, and it samples fine. No divergences, Rhat around 1.01, etc. Looks fine
On the Linux box, I get the same warnings, but then some chains halt right away, some chains sample for a while and then halt. The error message is always: Warning: Chain 1 finished unexpectedly!
My guess is that maybe some internal library in Linux is more sensitive about some floating point issue, but I have no way to resolve this. Any ideas would be greatly appreciated.
For reference, below is the stan file I used:
data{
int<lower=1> N;
vector<lower=0>[N] y;
vector<lower=0>[N] size;
}
parameters{
real<lower=0> a0;
real<lower=0> sg;
}
transformed parameters{
eta = exp(a0); // to ensure positive value
for (i in 1:N){
mu[i] = size[i] / eta;
alpha[i] = square(mu[i] / sg);
beta[i] = mu[i] / square(sg);
}
}
model{
y ~ gamma(alpha, beta);
// priors
a0 ~ normal(16,1);
sg ~ normal(0, 1);
}