Created
March 31, 2017 15:36
-
-
Save rmcelreath/ad708c5806f714a6a3a5fc45e3c961ff to your computer and use it in GitHub Desktop.
RStan error passing issue with parallel chains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rstan) | |
# simple model with a bug | |
model_code <- " | |
parameters{ | |
real a; | |
} | |
model{ | |
a ~ normal(0,1); | |
} | |
generated quantities{ | |
real buggy; // undefined, so will throw an error after sampling | |
} | |
" | |
# running with parallel cores hides undefined variable message | |
# instead get crypted message about slot "mode" | |
m1 <- stan( model_code=model_code , chains=2 , cores=2 ) | |
# now run with 1 chain (or 1 core) to see problem with buggy variable | |
m2 <- stan( model_code=model_code , chains=1 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment