Cmdstan 2.21 compile map_rect model fails

I was able to compile the binomial example model and models that I use that do not have map_rect however when I try to compile map_rect models in CmdStan they fail even though they compile fine in Rstan. For example, the model from rmcelreath’s repo https://github.com/rmcelreath/cmdstan_map_rect_tutorial/blob/master/logistic1.stan compiles fine in Rstan but gives the following error in cmdstan:

--- Compiling, linking C++ code ---
g++ -DSTAN_THREADS -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs     -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include  -D_USE_MATH_DEFINES  -DBOOST_DISABLE_ASSERTS      -c  -x c++ -o model/test.o model/test.hpp
In file included from stan/lib/stan_math/stan/math/prim/arr/fun/promote_elements.hpp:5:0,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/promote_elements.hpp:4,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/promote_common.hpp:5,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/mdivide_left_tri.hpp:6,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/mdivide_left_tri_low.hpp:6,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/chol2inv.hpp:7,
                 from stan/lib/stan_math/stan/math/prim/mat.hpp:71,
                 from stan/lib/stan_math/stan/math/rev/mat.hpp:12,
                 from stan/lib/stan_math/stan/math.hpp:4,
                 from stan/src/stan/model/model_header.hpp:4,
                 from model/test.hpp:3:
stan/lib/stan_math/stan/math/prim/scal/fun/promote_elements.hpp: In instantiation of 'static T stan::math::promote_elements<T, S>::promote(const S&) [with T = double; S = stan::math::var]':
stan/lib/stan_math/stan/math/prim/arr/fun/array_builder.hpp:38:51:   required from 'stan::math::array_builder<T>& stan::math::array_builder<T>::add(const S&) [with S = stan::math::var; T = double]'
model/test.hpp:125:60:   required from 'Eigen::Matrix<typename boost::math::tools::promote_args<RT1, RT2, A>::type, -1, 1> test_model_namespace::lp_reduce(const Eigen::Matrix<Scalar, -1, 1>&, const Eigen::Matrix<RhsScalar, -1, 1>&, const std::vector<T_l>&, const std::vector<int>&, std::ostream*) [with T0__ = stan::math::var; T1__ = double; T2__ = double; typename boost::math::tools::promote_args<RT1, RT2, A>::type = stan::math::var; std::ostream = std::basic_ostream<char>]'
model/test.hpp:143:48:   required from 'Eigen::Matrix<typename boost::math::tools::promote_args<RT1, RT2, A>::type, -1, 1> test_model_namespace::lp_reduce_functor__::operator()(const Eigen::Matrix<Scalar, -1, 1>&, const Eigen::Matrix<RhsScalar, -1, 1>&, const std::vector<T_l>&, const std::vector<int>&, std::ostream*) const [with T0__ = stan::math::var; T1__ = double; T2__ = double; typename boost::math::tools::promote_args<RT1, RT2, A>::type = stan::math::var; std::ostream = std::basic_ostream<char>]'
stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_reduce.hpp:112:79:   required from 'stan::math::matrix_d stan::math::internal::map_rect_reduce<F, stan::math::var, double>::operator()(const vector_d&, const vector_d&, const std::vector<double>&, const std::vector<int>&, std::ostream*) const [with F = test_model_namespace::lp_reduce_functor__; stan::math::matrix_d = Eigen::Matrix<double, -1, -1>; stan::math::vector_d = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]'
stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_concurrent.hpp:42:53:   required from 'stan::math::internal::map_rect_concurrent(const Eigen::Matrix<T_shared_param, -1, 1>&, const std::vector<Eigen::Matrix<T_job_param, -1, 1> >&, const std::vector<std::vector<double> >&, const std::vector<std::vector<int> >&, std::ostream*)::<lambda(std::size_t, std::size_t)> [with int call_id = 1; F = test_model_namespace::lp_reduce_functor__; T_shared_param = stan::math::var; T_job_param = double; std::size_t = long long unsigned int]'
stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_concurrent.hpp:43:7:   required from 'struct stan::math::internal::map_rect_concurrent(const Eigen::Matrix<T_shared_param, -1, 1>&, const std::vector<Eigen::Matrix<T_job_param, -1, 1> >&, const std::vector<std::vector<double> >&, const std::vector<std::vector<int> >&, std::ostream*) [with int call_id = 1; F = test_model_namespace::lp_reduce_functor__; T_shared_param = stan::math::var; T_job_param = double; typename stan::return_type<T1, T2>::type = stan::math::var; std::ostream = std::basic_ostream<char>]::<lambda(std::size_t, std::size_t)>'
stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_concurrent.hpp:45:3:   required from 'Eigen::Matrix<typename stan::return_type<T1, T2>::type, -1, 1> stan::math::internal::map_rect_concurrent(const Eigen::Matrix<T_shared_param, -1, 1>&, const std::vector<Eigen::Matrix<T_job_param, -1, 1> >&, const std::vector<std::vector<double> >&, const std::vector<std::vector<int> >&, std::ostream*) [with int call_id = 1; F = test_model_namespace::lp_reduce_functor__; T_shared_param = stan::math::var; T_job_param = double; typename stan::return_type<T1, T2>::type = stan::math::var; std::ostream = std::basic_ostream<char>]'
stan/lib/stan_math/stan/math/prim/mat/functor/map_rect.hpp:175:48:   required from 'Eigen::Matrix<typename stan::return_type<T1, T2>::type, -1, 1> stan::math::map_rect(const Eigen::Matrix<T_shared_param, -1, 1>&, const std::vector<Eigen::Matrix<T_job_param, -1, 1> >&, const std::vector<std::vector<double> >&, const std::vector<std::vector<int> >&, std::ostream*) [with int call_id = 1; F = test_model_namespace::lp_reduce_functor__; T_shared_param = stan::math::var; T_job_param = double; typename stan::return_type<T1, T2>::type = stan::math::var; std::ostream = std::basic_ostream<char>]'
model/test.hpp:289:74:   required from 'T__ test_model_namespace::test_model::log_prob(std::vector<T_l>&, std::vector<int>&, std::ostream*) const [with bool propto__ = false; bool jacobian__ = false; T__ = stan::math::var; std::ostream = std::basic_ostream<char>]'
stan/src/stan/model/model_base_crtp.hpp:153:29:   required from 'stan::math::var stan::model::model_base_crtp<M>::log_prob(std::vector<stan::math::var>&, std::vector<int>&, std::ostream*) const [with M = test_model_namespace::test_model; std::ostream = std::basic_ostream<char>]'
model/test.hpp:489:1:   required from here
stan/lib/stan_math/stan/math/prim/scal/fun/promote_elements.hpp:24:48: error: cannot convert 'const stan::math::var' to 'double' in return
   inline static T promote(const S& u) { return u; }
                                                ^
stan/lib/stan_math/stan/math/prim/scal/fun/promote_elements.hpp: In static member function 'static T stan::math::promote_elements<T, S>::promote(const S&) [with T = double; S = stan::math::var]':
stan/lib/stan_math/stan/math/prim/scal/fun/promote_elements.hpp:24:51: warning: control reaches end of non-void function [-Wreturn-type]
   inline static T promote(const S& u) { return u; }
                                                   ^
make: *** [make/program:43: model\test.exe] Error 1

Did you “make clean-all” and make build upon setting the STAN_THREADS flag?

If you built cmdstan without stan threads and then build with the flag it will not work.

1 Like

Thanks for the suggestion, I just “make clean-all” and rebuilt using mingw32-make from the previous thread Cmdstan 2.21 windows can’t make bernoulli example. Prior to rebuilding I made sure the STAN_THREADS flag was in the make/local file. I am still getting the error.

FYI, I came home from work and tried cmdstan 2.21 on my mac with Mojave 10.14.6 setting CXXFLAGS += -DSTAN_THREADS and then make clean-all and rebuilding results with an error as well on the map_rect example. I can compile and run non-map_rect models fine.

Seans-MBP:cmdstan seanpinkney$ make cmdstan_map_rect_tutorial/logistic1
clang++ -DSTAN_THREADS -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT      -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include    -DBOOST_DISABLE_ASSERTS      -c -MT stan/src/stan/model/model_header.hpp.gch -MT stan/src/stan/model/model_header.d -MM -E -MG -MP -MF stan/src/stan/model/model_header.d stan/src/stan/model/model_header.hpp

--- Translating Stan model to C++ code ---
bin/stanc  --o=cmdstan_map_rect_tutorial/logistic1.hpp cmdstan_map_rect_tutorial/logistic1.stan

--- Compiling, linking C++ code ---
clang++ -DSTAN_THREADS -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT      -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include    -DBOOST_DISABLE_ASSERTS      -c -include-pch stan/src/stan/model/model_header.hpp.gch -x c++ -o cmdstan_map_rect_tutorial/logistic1.o cmdstan_map_rect_tutorial/logistic1.hpp
In file included from cmdstan_map_rect_tutorial/logistic1.hpp:1:
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math.hpp:4:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/rev/mat.hpp:12:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/mat.hpp:71:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/mat/fun/chol2inv.hpp:7:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/mat/fun/mdivide_left_tri_low.hpp:6:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/mat/fun/mdivide_left_tri.hpp:6:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/mat/fun/promote_common.hpp:5:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/mat/fun/promote_elements.hpp:4:
In file included from /Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/arr/fun/promote_elements.hpp:5:
/Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/scal/fun/promote_elements.hpp:24:48: error: 
      no viable conversion from returned value of type 'const stan::math::var'
      to function return type 'double'
  inline static T promote(const S& u) { return u; }
                                               ^
/Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/arr/fun/array_builder.hpp:38:42: note: 
      in instantiation of member function 'stan::math::promote_elements<double,
      stan::math::var>::promote' requested here
    x_.push_back(promote_elements<T, S>::promote(u));
                                         ^
cmdstan_map_rect_tutorial/logistic1.hpp:125:45: note: in instantiation of
      function template specialization
      'stan::math::array_builder<double>::add<stan::math::var>' requested here
        stan::math::array_builder<double>().add(lp).array()));
                                            ^
cmdstan_map_rect_tutorial/logistic1.hpp:143:8: note: in instantiation of
      function template specialization
      'logistic1_model_namespace::lp_reduce<stan::math::var, double, double>'
      requested here
return lp_reduce(beta, theta, xr, xi, pstream__);
       ^
/Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_reduce.hpp:112:23: note: 
      in instantiation of function template specialization
      'logistic1_model_namespace::lp_reduce_functor__::operator()<stan::math::var,
      double, double>' requested here
      vector_v fx_v = F()(shared_params_v, job_specific_params, x_r, x_i, msgs);
                      ^
/Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_concurrent.hpp:41:23: note: 
      in instantiation of member function
      'stan::math::internal::map_rect_reduce<logistic1_model_namespace::lp_reduce_functor__,
      stan::math::var, double>::operator()' requested here
      job_output[i] = ReduceF()(shared_params_dbl, value_of(job_params[i]),
                      ^
/Users/seanpinkney/cmdstan/stan/lib/stan_math/stan/math/prim/mat/functor/map_rect.hpp:174:20: note: 
      in instantiation of function template specialization
      'stan::math::internal::map_rect_concurrent<1,
      logistic1_model_namespace::lp_reduce_functor__, stan::math::var, double>'
      requested here
  return internal::map_rect_concurrent<call_id, F, T_shared_param, T_job_param>(
                   ^
cmdstan_map_rect_tutorial/logistic1.hpp:288:28: note: in instantiation of
      function template specialization 'stan::math::map_rect<1,
      logistic1_model_namespace::lp_reduce_functor__, stan::math::var, double>'
      requested here
        lp_accum__.add(sum(map_rect<1, lp_reduce_functor__>(beta, theta, xr,
                           ^
cmdstan_map_rect_tutorial/logistic1.hpp:462:14: note: in instantiation of
      function template specialization
      'logistic1_model_namespace::logistic1_model::log_prob<false, false,
      stan::math::var>' requested here
      return log_prob<propto__,jacobian__,T_>(vec_params_r, vec_params_i...
             ^
/Users/seanpinkney/cmdstan/stan/src/stan/model/model_base_crtp.hpp:95:50: note: 
      in instantiation of function template specialization
      'logistic1_model_namespace::logistic1_model::log_prob<false, false,
      stan::math::var>' requested here
    return static_cast<const M*>(this)->template log_prob<false, false>(theta,
                                                 ^
cmdstan_map_rect_tutorial/logistic1.hpp:162:3: note: in instantiation of member
      function
      'stan::model::model_base_crtp<logistic1_model_namespace::logistic1_model>::log_prob'
      requested here
  ~logistic1_model() { }
  ^
1 error generated.
make: *** [cmdstan_map_rect_tutorial/logistic1] Error 1

FWIW, I ran in to what looks like a similar issue while trying to get rmcelreath’s example working using a freshly cloned version of cmdstan (991360f). But the model complies fine when downloading and unpacking the latest release.

Ubuntu 18.04
g++ 7.4.0

That is, the following

git clone https://github.com/stan-dev/cmdstan.git --recursive 
make stan-update
echo "CXXFLAGS += -DSTAN_THREADS" > make/local
make build
make redcard/logistic1

results in an error

stan/lib/stan_math/stan/math/prim/scal/fun/promote_elements.hpp:24:48: error: cannot convert ‘const stan::math::var’ to ‘double’ in return
   inline static T promote(const S& u) { return u; }
                                                ^

full output below

--- Translating Stan model to C++ code ---
bin/stanc  --o=redcard/logistic1.hpp redcard/logistic1.stan

--- Compiling, linking C++ code ---
g++ -DSTAN_THREADS -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare     -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include    -DBOOST_DISABLE_ASSERTS      -c  -x c++ -o redcard/logistic1.o redcard/logistic1.hpp
In file included from stan/lib/stan_math/stan/math/prim/arr/fun/promote_elements.hpp:5:0,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/promote_elements.hpp:4,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/promote_common.hpp:5,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/mdivide_left_tri.hpp:6,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/mdivide_left_tri_low.hpp:6,
                 from stan/lib/stan_math/stan/math/prim/mat/fun/chol2inv.hpp:7,
                 from stan/lib/stan_math/stan/math/prim/mat.hpp:71,
                 from stan/lib/stan_math/stan/math/rev/mat.hpp:12,
                 from stan/lib/stan_math/stan/math.hpp:4,
                 from stan/src/stan/model/model_header.hpp:4,
                 from redcard/logistic1.hpp:3:
stan/lib/stan_math/stan/math/prim/scal/fun/promote_elements.hpp: In instantiation of ‘static T stan::math::promote_elements<T, S>::promote(const S&) [with T = double; S = stan::math::var]’:
stan/lib/stan_math/stan/math/prim/arr/fun/array_builder.hpp:38:49:   required from ‘stan::math::array_builder<T>& stan::math::array_builder<T>::add(const S&) [with S = stan::math::var; T = double]’
redcard/logistic1.hpp:125:53:   required from ‘Eigen::Matrix<typename boost::math::tools::promote_args<RT1, RT2, A>::type, -1, 1> logistic1_model_namespace::lp_reduce(const Eigen::Matrix<Scalar, -1, 1>&, const Eigen::Matrix<RhsScalar, -1, 1>&, const std::vector<T_l>&, const std::vector<int>&, std::ostream*) [with T0__ = stan::math::var; T1__ = double; T2__ = double; typename boost::math::tools::promote_args<RT1, RT2, A>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’
redcard/logistic1.hpp:143:17:   required from ‘Eigen::Matrix<typename boost::math::tools::promote_args<RT1, RT2, A>::type, -1, 1> logistic1_model_namespace::lp_reduce_functor__::operator()(const Eigen::Matrix<Scalar, -1, 1>&, const Eigen::Matrix<RhsScalar, -1, 1>&, const std::vector<T_l>&, const std::vector<int>&, std::ostream*) const [with T0__ = stan::math::var; T1__ = double; T2__ = double; typename boost::math::tools::promote_args<RT1, RT2, A>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’
stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_reduce.hpp:112:26:   required from ‘stan::math::matrix_d stan::math::internal::map_rect_reduce<F, stan::math::var, double>::operator()(const vector_d&, const vector_d&, const std::vector<double>&, const std::vector<int>&, std::ostream*) const [with F = logistic1_model_namespace::lp_reduce_functor__; stan::math::matrix_d = Eigen::Matrix<double, -1, -1>; stan::math::vector_d = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]’
stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_concurrent.hpp:41:32:   required from ‘stan::math::internal::map_rect_concurrent(const Eigen::Matrix<T_shared_param, -1, 1>&, const std::vector<Eigen::Matrix<T_job_param, -1, 1> >&, const std::vector<std::vector<double> >&, const std::vector<std::vector<int> >&, std::ostream*)::<lambda(std::size_t, std::size_t)> [with int call_id = 1; F = logistic1_model_namespace::lp_reduce_functor__; T_shared_param = stan::math::var; T_job_param = double; std::size_t = long unsigned int]’
stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_concurrent.hpp:43:7:   required from ‘struct stan::math::internal::map_rect_concurrent(const Eigen::Matrix<T_shared_param, -1, 1>&, const std::vector<Eigen::Matrix<T_job_param, -1, 1> >&, const std::vector<std::vector<double> >&, const std::vector<std::vector<int> >&, std::ostream*) [with int call_id = 1; F = logistic1_model_namespace::lp_reduce_functor__; T_shared_param = stan::math::var; T_job_param = double; typename stan::return_type<T1, T2>::type = stan::math::var; std::ostream = std::basic_ostream<char>]::<lambda(std::size_t, std::size_t)>’
stan/lib/stan_math/stan/math/rev/mat/functor/map_rect_concurrent.hpp:39:8:   required from ‘Eigen::Matrix<typename stan::return_type<T1, T2>::type, -1, 1> stan::math::internal::map_rect_concurrent(const Eigen::Matrix<T_shared_param, -1, 1>&, const std::vector<Eigen::Matrix<T_job_param, -1, 1> >&, const std::vector<std::vector<double> >&, const std::vector<std::vector<int> >&, std::ostream*) [with int call_id = 1; F = logistic1_model_namespace::lp_reduce_functor__; T_shared_param = stan::math::var; T_job_param = double; typename stan::return_type<T1, T2>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’
stan/lib/stan_math/stan/math/prim/mat/functor/map_rect.hpp:174:80:   required from ‘Eigen::Matrix<typename stan::return_type<T1, T2>::type, -1, 1> stan::math::map_rect(const Eigen::Matrix<T_shared_param, -1, 1>&, const std::vector<Eigen::Matrix<T_job_param, -1, 1> >&, const std::vector<std::vector<double> >&, const std::vector<std::vector<int> >&, std::ostream*) [with int call_id = 1; F = logistic1_model_namespace::lp_reduce_functor__; T_shared_param = stan::math::var; T_job_param = double; typename stan::return_type<T1, T2>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’
redcard/logistic1.hpp:288:60:   required from ‘T__ logistic1_model_namespace::logistic1_model::log_prob(std::vector<T_l>&, std::vector<int>&, std::ostream*) const [with bool propto__ = false; bool jacobian__ = false; T__ = stan::math::var; std::ostream = std::basic_ostream<char>]’
stan/src/stan/model/model_base_crtp.hpp:153:29:   required from ‘stan::math::var stan::model::model_base_crtp<M>::log_prob(std::vector<stan::math::var>&, std::vector<int>&, std::ostream*) const [with M = logistic1_model_namespace::logistic1_model; std::ostream = std::basic_ostream<char>]’
redcard/logistic1.hpp:489:1:   required from here
stan/lib/stan_math/stan/math/prim/scal/fun/promote_elements.hpp:24:48: error: cannot convert ‘const stan::math::var’ to ‘double’ in return
   inline static T promote(const S& u) { return u; }
                                                ^
make/program:41: recipe for target 'redcard/logistic1' failed
make: *** [redcard/logistic1] Error 1

But all seems well with the latest release

--- Translating Stan model to C++ code ---
bin/stanc  --o=redcard/logistic1.hpp redcard/logistic1.stan
Model name=logistic1_model
Input file=redcard/logistic1.stan
Output file=redcard/logistic1.hpp
DIAGNOSTIC(S) FROM PARSER:
Info: integer division implicitly rounds to integer. Found int division: N / n_shards
 Positive values rounded down, negative values rounded up or down in platform-dependent way.


--- Compiling, linking C++ code ---
g++ -DSTAN_THREADS -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare     -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include    -DBOOST_DISABLE_ASSERTS      -c  -x c++ -o redcard/logistic1.o redcard/logistic1.hpp
g++ -DSTAN_THREADS -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare     -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include    -DBOOST_DISABLE_ASSERTS            -Wl,-L,"/home/psadil/.cmdstanr/cmdstan/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/home/psadil/.cmdstanr/cmdstan/stan/lib/stan_math/lib/tbb"  redcard/logistic1.o src/cmdstan/main.o         stan/lib/stan_math/lib/sundials_4.1.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_4.1.0/lib/libsundials_cvodes.a stan/lib/stan_math/lib/sundials_4.1.0/lib/libsundials_idas.a stan/lib/stan_math/lib/sundials_4.1.0/lib/libsundials_kinsol.a  stan/lib/stan_math/lib/tbb/libtbb.so.2 -o redcard/logistic1

I removed cmdstan and re-cloned. I’m still getting the error on windows. I’ll test on my mac when I get home.

Sorry, I meant that nothing I cloned could compile logistic1.stan. What worked came from manually downloading the .tar.gz file on the releases page (unpacking that, adding DSTAN_THREADS flag, rebuilding, then compiling).

The current develop CmdStan uses the new stanc3 parser. Tagging @seantalts

Ah ok, I was hopeful since the diff log from what I had previously did show some commits. Will try with the tar.gz file.
image

I’ll take a look at that model, thanks!

You can always use git to check out a different tag, git checkout master && make clean-all should get you to the same code included in the .tar.gz.

I’m confirming that git checkout master && make clean-all branch works. Thanks @seantalts and @psadil!

1 Like

Just merged a fix to stanc3 - should be in the next build and should propagate to cmdstan develop. If you’re currently on develop, running a make clean-all before your next build should cause the new one to be downloaded for you.

2 Likes

@mitzimorris @jonah do the CmdStanPy/R install functions do this?

by default, the install function gets the latest release or a specified release, but it doesn’t install from develop.

the install function downloads and unzips the release, which is in a clean state, so make clean-all isn’t necessary.

1 Like

CmdStanR installs the latest release from tarball by default, although thanks to @rok_cesnovar it does now also let you install from develop or any other branch you want:

https://mc-stan.org/cmdstanr/reference/cmdstan_git_checkout_branch.html

2 Likes