No Output Issue with cmdstanr

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.

  • Operating System: Windows
  • CmdStan Version: 2.37.0

Thanks, as always, for the help and time.

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.

If this ends up being something specific to Windows I may not be of much help, but maybe @andrjohns or @WardBrian could be. @WardBrian could this be related to the issue(s) in your post that @jkalley linked to? ( Guide: Diagnosing a complete lack of output on Windows )

Definitely could be related to a TBB load error, though the code 309 doesn’t bring up anything.

Can you share the output of the where.exe command from that post?

Thanks for the quick response, all.

@jonah here’s what I have.

  1. Does this happen with every model?: Example model runs and samples fine.
  2. If you set parallel_chains = 1 does the same thing happen?: Yes, same error.
  3. Have you tried rebuilding cmdstan with cmdstanr::rebuild_cmdstan()? Does that help?: Rebuild and re–install, neither successful.
  4. Does using the development version of cmdstanr change anything?: Unfortunately not.

@WardBrian here’s the cmd output

C:\Users\Joshua_Alley>where.exe tbb.dll
C:\Users\Joshua_Alley.cmdstan\cmdstan-2.37.0\stan\lib\stan_math\lib\tbb\tbb.dll

Interesting. Are you able to share the code of the model that is failing?

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.

1 Like

Thanks for following up. Glad everything is working now!

You can also pass the argument force_recompile=TRUE to cmdstan_model() to avoid having to manually delete the exe.

3 Likes