I get Segmentation fault when generating samples from normal distribution

132 views
Skip to first unread message

matus.s...@privatdemail.net

unread,
Jun 21, 2015, 9:09:57 AM6/21/15
to stan-...@googlegroups.com
I want to generate normal samples with Stan. First I used this code:

import pystan
model
= """
data{
    real dmx;
    real dvx;
}
model{
}
generated quantities {
    real rt[50];
    for (i in 1:50){
        rt[i]<-normal_rng(dmx,dvx);
    }
}
"""

sm
= pystan.StanModel(model_code=model)
fit
=sm.sampling(data={'dmx':0,'dvx':1},
        iter
=1,chains=1,warmup=0,seed=1)

And I get:
RuntimeError: Must use algorithm="Fixed_param" for model that has no parameters.

Ok. So now I add the option
fit=sm.sampling(data={'dmx':0,'dvx':1},
        iter
=1,chains=1,warmup=0,seed=1,algorithm='Fixed_param')
and I get
Segmentation fault

Looks like a bug to me.

I'm on Pystan 2.6.3, 32-bit Linux.

Seth Flaxman

unread,
Jun 21, 2015, 10:01:53 AM6/21/15
to stan-...@googlegroups.com
FWIW, I just tried it with RStan (2.6.0 / 64-bit Windows) and all is fine...
> --
> You received this message because you are subscribed to the Google Groups
> "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to stan-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Bob Carpenter

unread,
Jun 21, 2015, 12:56:06 PM6/21/15
to stan-...@googlegroups.com
Matus --- which version of PyStan are you using?

We want to take seg fault issues very seriously due to their
tendency to crash their host environment.

Thanks for testing, Seth. Maybe Allen will have an idea
what's going on. This should probably be turned into an
issue.

Might this be a problem with 32-bit linux or PyStan?

- Bob

matus.s...@privatdemail.net

unread,
Jun 21, 2015, 2:16:09 PM6/21/15
to stan-...@googlegroups.com
Today (before the segfault) I  upgraded to pystan 2.6.3 with
pip install pystan --upgrade
Maybe,  some dependency didn't get upgraded properly?

I investigated further with other models and the segfault occurs whenever I set algorithm='Fixed_param'

I will check the code on my other machines tomorrow.

m.

Allen B. Riddell

unread,
Jun 21, 2015, 3:18:54 PM6/21/15
to stan-...@googlegroups.com
This isn't your fault. I'm pretty sure there's a bug in PyStan for Fixed
Param mode. I'll create the issue shortly.
Reply all
Reply to author
Forward
0 new messages