Writing with a tricky issue using cmdstanr. When I go to fit models in cmdstanr, I get the following problem. which cropped up earlier here. I’ve set the PATH variable to get to the dll, checked a bunch of other things, and not gotten anywhere.
The models compile just fine, but when I go to sample, this is the result:
> fit_irt <- irt_stan$sample(
+ data = irt_data,
+ seed = 12,
+ chains = 4,
+ parallel_chains = 4,
+ refresh = 100
+ )
Running MCMC with 4 parallel chains...
Warning: Chain 1 finished unexpectedly!
Warning: Chain 2 finished unexpectedly!
Warning: Chain 3 finished unexpectedly!
Warning: Chain 4 finished unexpectedly!
Warning: Use read_cmdstan_csv() to read the results of the failed chains.
Warning messages:
1: All chains finished unexpectedly! Use the $output(chain_id) method for more information.
2: No chains finished successfully. Unable to retrieve the fit.
There is not any output to diagnose. Running the exe directly gives a 309 error.
The really strange piece is that I can compile and sample using cmdstanr via brms.
That is very strange since brms is essentially doing the same thing you’re doing just wrapped inside brms functions.
A few questions:
Does this happen with every model? If you run the example models does it do the same thing?
cmdstanr_example(quiet = FALSE)
If you set parallel_chains = 1 does the same thing happen?
Have you tried rebuilding cmdstan with cmdstanr::rebuild_cmdstan()? Does that help?
Does using the development version of cmdstanr change anything? You can install that with remotes::install_github("stan-dev/cmdstanr") and then restart R.
This is a silly oversight, but hopefully someone can learn from it. I had just left the compiled .exe file in my working directory. I deleted it, recompiled the model, and it’s sampling now.