cmdstanr
cmdstanr copied to clipboard
Cannot use method suggested by Rok to remove excessive sampler warnings
Hi, I followed @rok-cesnovar 's advice on brms issue 1480 but I get the following error:
make/local:5: *** missing separator. Stop.
I decided to post here instead of cluttering the brms issue with comments. Thanks in advance for any help you can provide!
can you post the return of cmdstanr::cmdstan_make_local()
[1] "CXXFLAGS += -Wno-nonnull -D_UCRT"
[2] "TBB_CXXFLAGS= -D_UCRT"
[3] "CXXFLAGS += -Wno-deprecated-declarations"
[4] "-Wno-deprecated-declarations -Wno-unused-lambda-capture -Wno-unused-variable -Wno-unknown-pragmas"
[5] "TBB_CXXFLAGS += -Wno-unused-but-set-variable"
[6] "CXXFLAGS_BOOST += -Wno-deprecated-declarations"
Ok, thanks. Run the following script and you should be good to go.
cmdstanr::cmdstan_make_local(
cpp_options = list(
"CXXFLAGS += -Wno-nonnull -D_UCRT -Wno-deprecated-declarations -Wno-unused-lambda-capture -Wno-unused-variable -Wno-unknown-pragmas",
"TBB_CXXFLAGS= -D_UCRT -Wno-unused-but-set-variable",
"CXXFLAGS_BOOST += -Wno-deprecated-declarations"
),
append = FALSE
)
cmdstanr::rebuild_cmdstan(cores = 4)
Hi, I was able to rebuild cmdstan with the flags. However I still get lots of compiler messages. For example,
library(brms)
brm(mpg~hp,data=mtcars,backend='cmdstanr')
If I run the above, I get the following messages, in addition I get lots and lots of sampler warnings that the proposal is about to be rejected, that I never used to get, even after warmup has ended and sampling has started.
Compiling Stan program...
In file included from stan/src/stan/model/model_header.hpp:11:
stan/src/stan/model/model_base_crtp.hpp:152: warning: 'stan::math::var stan::model::model_base_crtp<M>::log_prob(std::vector<stan::math::var_value<double>, std::allocator<stan::math::var_value<double> > >&, std::vector<int>&, std::ostream*) const [with M = model_31c732508b70432b202ed138060549e8_model_namespace::model_31c732508b70432b202ed138060549e8_model; stan::math::var = stan::math::var_value<double>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
152 | inline math::var log_prob(std::vector<math::var>& theta,
|
C:/Users/qdread/AppData/Local/Temp/RtmpyUfo4B/model-65407abc7c79.hpp:534: note: by 'model_31c732508b70432b202ed138060549e8_model_namespace::model_31c732508b70432b202ed138060549e8_model::log_prob'
534 | log_prob(std::vector<T_>& params_r, std::vector<int>& params_i,
|
stan/src/stan/model/model_base_crtp.hpp:147: warning: 'double stan::model::model_base_crtp<M>::log_prob(std::vector<double, std::allocator<double> >&, std::vector<int>&, std::ostream*) const [with M = model_31c732508b70432b202ed138060549e8_model_namespace::model_31c732508b70432b202ed138060549e8_model; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
147 | inline double log_prob(std::vector<double>& theta, std::vector<int>& theta_i,
|
C:/Users/qdread/AppData/Local/Temp/RtmpyUfo4B/model-65407abc7c79.hpp:534: note: by 'model_31c732508b70432b202ed138060549e8_model_namespace::model_31c732508b70432b202ed138060549e8_model::log_prob'
534 | log_prob(std::vector<T_>& params_r, std::vector<int>& params_i,
|
stan/src/stan/model/model_base_crtp.hpp:96: warning: 'stan::math::var stan::model::model_base_crtp<M>::log_prob(Eigen::Matrix<stan::math::var_value<double>, -1, 1>&, std::ostream*) const [with M = model_31c732508b70432b202ed138060549e8_model_namespace::model_31c732508b70432b202ed138060549e8_model; stan::math::var = stan::math::var_value<double>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
96 | inline math::var log_prob(Eigen::Matrix<math::var, -1, 1>& theta,
|
C:/Users/qdread/AppData/Local/Temp/RtmpyUfo4B/model-65407abc7c79.hpp:534: note: by 'model_31c732508b70432b202ed138060549e8_model_namespace::model_31c732508b70432b202ed138060549e8_model::log_prob'
534 | log_prob(std::vector<T_>& params_r, std::vector<int>& params_i,
|
stan/src/stan/model/model_base_crtp.hpp:91: warning: 'double stan::model::model_base_crtp<M>::log_prob(Eigen::VectorXd&, std::ostream*) const [with M = model_31c732508b70
432b202ed138060549e8_model_namespace::model_31c732508b70432b202ed138060549e8_model; Eigen::VectorXd = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
91 | inline double log_prob(Eigen::VectorXd& theta,
|
C:/Users/qdread/AppData/Local/Temp/RtmpyUfo4B/model-65407abc7c79.hpp:534: note: by 'model_31c732508b70432b202ed138060549e8_model_namespace::model_31c732508b70432b202ed138060549e8_model::log_prob'
534 | log_prob(std::vector<T_>& params_r, std::vector<int>& params_i,
|
cc1plus.exe: note: unrecognized command-line option '-Wno-unused-lambda-capture' may have been intended to silence earlier diagnostics
Start sampling
Hi, Just chiming in to say that I got the exact same issue (same messages at the start and at every suggested step for solving the issue) I also got the sampler warnings after the model starts sampling. They seem spurious given the resulting toy models are perfectly fine?
To add some information beyond "I got that issue too":
- Got that issue after updating R/cmdstanr/cmdstan the same day. After a few tries at reverting the updates one at a time, I am pretty sure the issue started to appear after updating cmdstanr from 0.5.x to 0.6.0 on my side (and stays when updating to the latest development version).
- similar compiler messages and sampler warnings also appear when using cmdstanr via rethinking instead of brms
Thanks @mdahirel - based on your comment I rolled cmdstanr back to 0.5.3 and now I no longer get the compiler warnings or excessive sampler warnings from brms. I also see the iteration progress again in the console, which I wasn't able to see with cmdstanr 0.6.0.