because programs are segfaulting, can’t get debug info out for CmdStanR fit objects because there is no fit object.
users are trying to debug an indexing error in CmdStanR by putting print
statements into their Stan program, but no output to console. default for show_messages
is TRUE, but nothing to console - expecting print stmts, which, underlyingly are being sent to stdout.
Probably doesn’t help, but I always do ll - rt /tmp
and/or just grep all files in /tmp/*/. Works fine on Ubuntu.
Not sure I follow, are you saying a user added prints and those were not displayed?
If I just run
library(cmdstanr)
file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
data_file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.data.json")
mod <- cmdstan_model(file)
fit <- mod$sample(data = data_file)
where I changed the model to
model {
theta ~ beta(1,1); // uniform prior on interval 0,1
y ~ bernoulli(theta);
print(theta);
}
I see all the prints.
...
Chain 4 0.218246
Chain 4 0.2636
Chain 4 0.210149
Chain 4 0.245909
Chain 4 0.245909
Chain 4 0.213425
Chain 4 0.22143
Chain 4 0.263097
Chain 4 0.22143
Chain 4 0.188243
Chain 4 0.294658
Chain 4 0.316411
Chain 4 0.188243
Chain 4 0.148463
Chain 4 0.148463
Chain 4 0.0712568
Chain 4 0.429266
Chain 4 0.511316
Chain 4 0.0712568
Chain 4 0.0487743
Chain 4 0.0712568
Chain 4 0.0641963
Chain 4 0.0641963
Chain 4 0.0847295
Chain 4 0.0847295
....
In R tempdir()
will print the current temp folder (for the R sessions) which is also where cmdstanr will do its work. But I am not sure if that will help?
yes, this is secondhand - Bob was on a call helping a user debug their program, using CmdStanR. the program segfaulted and the print stmts never made it to the terminal.
I think the tempdir
cmd would have helped - not sure.
(note - this is an issue for CmdStanPy - Options for streaming CmdStan's stdout, stderr to Python console · Issue #152 · stan-dev/cmdstanpy · GitHub -
which should be discussed in its own thread, or just fixed.)