How to suppress compiler warnings from brms with cmdstanr backend?

I recently updated CmdStan (2.33.1), cmdstanr (0.6.1), and brms (dev version from GitHub) on my Windows 10 machine. Now, whenever I compile a model with brms and cmdstanr backend, I get the following compiler warnings:

Compiling Stan program...
In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5,
                 from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4,
                 from stan/lib/stan_math/stan/math/prim/prob.hpp:356,
                 from stan/lib/stan_math/stan/math/prim.hpp:16,
                 from stan/lib/stan_math/stan/math/rev.hpp:14,
                 from stan/lib/stan_math/stan/math.hpp:19,
                 from stan/src/stan/model/model_header.hpp:4,
                 from C:/Users/qdread/AppData/Local/Temp/Rtmp0ugc64/model-3a743cda3bac.hpp:2:
stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)':
stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
  194 |       if (cdf_n < 0.0)
      | 

stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory

Start sampling

Other than that the model compiles and samples fine. Can you please tell me what flags I can use to get rid of these annoying compiler warnings? Thanks for your help, and thanks to all the Stan/brms team for your tireless work.

Hi Quentin! I tend to see warnings like this for a few months after new features/deprecations in cmdstan, and the developers often resolve them within a few months. Assuming that these aren’t impacting features of your model, you could reduce the verbosity of the output to minimize the annoyance while these get fixed. Would brm(..., silent = 2) work for you?

Heads up that there is an open issue to resolve mismatches between the way that brms and cmdstanr treat verbosity options. The solution you find now might behave differently in the near future.

Thank you my friend! I am personally OK with the compiler warnings. The main reason I care is because I am going to teach a workshop using brms soon. I am trying to get scientists on board with using brms, and hyping up how easy and user-friendly it is. When scary and incomprehensible C++ messages pop up when fitting a simple model, it sort of undermines my narrative. :-D

I see that setting silent = 2, on individual calls to brm() suppresses the messages. I guess there is no way to set that as a global option? Also I do not see how to silence the compiler messages without also getting rid of sampler progress indicators. Even if I set refresh to a positive value, if silent = 2 I see no progress indication.

You might be stuck with that crude verbosity switch under your current set-up. I had a look but don’t see any easy way to fix this for either individual calls or globally.

Other avenues you might pursue:

  • Try the release version of brms instead of the dev version
  • Roll back to an earlier cmdstan release install_cmdstan(..., version = _____)
  • If your group can do most things with pre-compiled models in rstanarm, use it for the main demo and introduce brms as a tool for when greater flexibility is needed
1 Like

Thanks for the tips! I have considered rolling back cmdstanr but I hate to do that. In the end I think it will not be an issue because the workshop will be done on Posit Cloud server, which runs Ubuntu. The compiler warnings were a Windows only issue. Also, I’ve saved further time by saving the precompiled brms objects in the workshop project space so that during the workshop, the students will not have to sit around waiting for the models to compile. So it won’t be an issue for the workshop. I am sure the compiler messages will be dealt with in a future release of brms and/or cmdstanr :-D