Compiling Stan program...
In file included from /var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:1:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_header.hpp:6:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev.hpp:15:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor.hpp:30:
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:36:31: error: no matching function for call to 'deep_copy_vars'
36 | = std::tuple<decltype(deep_copy_vars(std::declval<Args>()))...>;
| ^~~~~~~~~~~~~~
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:58:23: note: in instantiation of member class 'stan::math::internal::reduce_sum_impl<laplace_approximation_compiling_error_example_model_namespace::partial_sum_2_lpmf_rsfunctor__<false>, void, stan::math::var_value<double>, const std::vector<int> &, const std::vector<std::vector<int>> &, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>::scoped_args_tuple' requested here
58 | scoped_args_tuple local_args_tuple_scope_;
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:247:23: note: in instantiation of member class 'stan::math::internal::reduce_sum_impl<laplace_approximation_compiling_error_example_model_namespace::partial_sum_2_lpmf_rsfunctor__<false>, void, stan::math::var_value<double>, const std::vector<int> &, const std::vector<std::vector<int>> &, Eigen::Matrix<stan:
:math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>::recursive_reducer' requested here
247 | recursive_reducer worker(num_vars_per_term, num_vars_shared_terms, partials,
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:207:10: note: in instantiation of member function 'stan::math::internal::reduce_sum_impl<laplace_approximation_compiling_error_example_model_namespace::partial_sum_2_lpmf_rsfunctor__<false>, void, stan::math::var_value<double>, const std::vector<int> &, const std::vector<std::vector<int>> &, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>::operator()' requested here
207 | return internal::reduce_sum_impl<ReduceFunction, void, return_type, Vec,
| ^
/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:1042:12: note: in instantiation of function template specialization 'laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model::log_prob_impl<false, false, Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<int, -1, 1>, nullptr, nullptr, nullptr>' requested here
1042 | return log_prob_impl<prop
to__, jacobian__>(params_r, params_i, pstream);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_base_crtp.hpp:98:50: note: in instantiation of function template specialization 'laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model::log_prob<false, false, stan::math::var_value<double>>' requested here
98 | return static_cast<const M*>(this)->template log_prob<false, false>(theta,
| ^
/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:432:3: note: in instantiation of member function 'stan::model::model_base_crtp<laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model>::log_prob' requested here
432 | ~laplace_approximation_compiling_error_example_model() {}
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:33:13: note: candidate function not viable: no known conversion from 'const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int>' to 'const var' (aka 'const var_value<double>') for 1st argument
33 | inline auto deep_copy_vars(const var& arg) {
| ^ ~~~~~~~~~~~~~~
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:23:14: note: candidate template ignored: requirement 'is_arithmetic<std::tuple<Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, int, int, int, int>>::value' was not satisfied [with Arith = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
23 | inline Arith deep_copy_vars(Arith&& arg) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:45:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with VarVec
= const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
45 | inline auto deep_copy_vars(VarVec&& arg) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:63:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with VecContainer = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
63 | inline auto deep_copy_vars(VecContainer&& arg) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:79:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with EigT = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
79 | inline auto deep_copy_vars(EigT&& arg) {
| ^
In file included from /var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:1:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_base.hpp:8:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core.hpp:13:
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/count_vars.hpp:129:10: error: call to function 'count_vars_impl' that is neither visible in the template definition nor found by argument-dependent lookup
129 | return count_vars_impl(count, std::forward<Pargs>(args)...);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/count_vars.hpp:129:10: note: in instantiation of function template specialization 'stan::math::internal::count_vars_impl<const Eigen::Map<Eigen::Matrix<double, -1, -1>>, nullptr, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/count_vars.hpp:93:10: note: in instantiation of function template specialization 'stan::math::internal::count_vars_impl<const int, nullptr, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
93 | return count_vars_impl(count + x.size(), std::forward<Pargs>(args)...);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/count_vars.hpp:93:10: note: in instantiation of function template specialization 'stan::math::internal::count_vars_impl<Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, nullptr, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
/Users
/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/count_vars.hpp:129:10: note: in instantiation of function template specialization 'stan::math::internal::count_vars_impl<Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, nullptr, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
129 | return count_vars_impl(count, std::forward<Pargs>(args)...);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/count_vars.hpp:162:20: note: in instantiation of function template specialization 'stan::math::internal::count_vars_impl<const std::vector<std::vector<int>>, nullptr, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
162 | return internal::count_vars_impl(0, std::forward<Pargs>(args)...);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:233:47: note: in instantiation of function template specialization 'stan::math::count_vars<const std::vector<std::vector<int>> &, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
233 | const std::size_t num_vars_shared_terms = count_vars(args...);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:207:10: note: in instantiation of member function 'stan::math::internal::reduce_sum_impl<laplace_approximation_compiling_error_example_model_namespace::partial_sum_2_lpmf_rsfunctor__<false>, void, stan::math::var_value<double>, const std::vector<int> &, const std::vector<std::vector<int>> &, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>
, double, int, int, int, int> &>::operator()' requested here
207 | return internal::reduce_sum_impl<ReduceFunction, void, return_type, Vec,
| ^
/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:1042:12: note: in instantiation of function template specialization 'laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model::log_prob_impl<false, false, Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<int, -1, 1>, nullptr, nullptr, nullptr>' requested here
1042 | return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_base_crtp.hpp:98:50: note: in instantiation of function template specialization 'laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model::log_prob<false, false, stan::math::var_value<double>>' requested here
98 | return static_cast<const M*>(this)->template log_prob<false, false>(theta,
| ^
/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:432:3: note: in instantiation of member function 'stan::model::model_base_crtp<laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model>::log_prob' requested here
432 | ~laplace_approximation_compiling_error_example_model() {}
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/count_vars.hpp:141:15: note: 'count_vars_impl' should be declared prior to the call site or in namespace 'Eigen'
141 | inline size_t count_vars_impl(std::size_t count,
| ^
In file included from /var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:1:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_header.hpp:4:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_base.hpp:8:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core.hpp:79:
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:136:10: error: no matching function for call to 'save_varis'
136 | return save_varis(dest, std::forward<Pargs>(args)...);
| ^~~~~~~~~~
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:136:10: note: in instantiation of function template specialization 'stan::math::save_varis<const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, nullptr, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:118:10: note: in instantiation of function template specialization 'stan::math::save_varis<const int &, nullptr, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
118 | return save_varis(d
est + x.size(), std::forward<Pargs>(args)...);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:118:10: note: in instantiation of function template specialization 'stan::math::save_varis<Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, nullptr, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:136:10: note: in instantiation of function template specialization 'stan::math::save_varis<Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, nullptr, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
136 | return save_varis(dest, std::forward<Pargs>(args)...);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:241:5: note: in instantiation of function template specialization 'stan::math::save_varis<const std::vector<std::vector<int>> &, nullptr, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>' requested here
241 | save_varis(varis + num_vars_sliced_terms, args...);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:207:10: note: in instantiation of member function 'stan::math::internal::reduce_sum_impl<laplace_approximation_compiling_error_example_model_namespace::partial_sum_2_lpmf_rsfunctor__<false>, void, stan::math::var_value<double>, const std::vector<int>
&, const std::vector<std::vector<int>> &, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>::operator()' requested here
207 | return internal::reduce_sum_impl<ReduceFunction, void, return_type, Vec,
| ^
/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:1042:12: note: in instantiation of function template specialization 'laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model::log_prob_impl<false, false, Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<int, -1, 1>, nullptr, nullptr, nullptr>' requested here
1042 | return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_base_crtp.hpp:98:50: note: in instantiation of function template specialization 'laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model::log_prob<false, false, stan::math::var_value<double>>' requested here
98 | return static_cast<const M*>(this)->template log_prob<false, false>(theta,
| ^
/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:432:3: note: in instantiation of member function 'stan::model::model_base_crtp<laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model>::log_prob' requested here
432 | ~laplace_approximation_compiling_error_example_model() {}
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:51:15: note: candidate function template not viable: no known conversion fr
om 'const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int>' to 'const var' (aka 'const var_value<double>') for 2nd argument
51 | inline vari** save_varis(vari** dest, const var& x, Pargs&&... args) {
| ^ ~~~~~~~~~~~~
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:71:15: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with VarVec = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
71 | inline vari** save_varis(vari** dest, VarVec&& x, Pargs&&... args) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:93:15: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with VecContainer = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
93 | inline vari** save_varis(vari** dest, VecContainer&& x, Pargs&&... args) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:114:15: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with EigT = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
114 | inline vari** save_varis(vari** dest, EigT&& x, Pargs&&... args) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_varis.hpp:135:15: note: candidate template ignored: requirement 'is_arithmetic<std::tuple<double, double, int, int, int, int>>::value' was not satisfied [with Arith = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
135 | inline vari** save_varis(vari** dest, Arith&& x, Pargs&&... args) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/save_vari
s.hpp:36:15: note: candidate function not viable: requires single argument 'dest', but 2 arguments were provided
36 | inline vari** save_varis(vari** dest);
| ^ ~~~~~~~~~~~
In file included from /var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:1:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_header.hpp:6:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math.hpp:19:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev.hpp:15:
In file included from /Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor.hpp:30:
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:36:31: error: no matching function for call to 'deep_copy_vars'
36 | = std::tuple<decltype(deep_copy_vars(std::declval<Args>()))...>;
| ^~~~~~~~~~~~~~
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:58:23: note: in instantiation of member class 'stan::math::internal::reduce_sum_impl<laplace_approximation_compiling_error_example_model_namespace::partial_sum_2_lpmf_rsfunctor__<true>, void, stan::math::var_value<double>, const std::vector<int> &, const std::vector<std::vector<int>> &, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>::scoped_args_tuple' requested here
58 | scoped_args_tuple local_args_tuple_scope_;
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:247:23: note: in instantiation of member class 'stan::math::internal::reduce_sum_impl<laplace_approximation_compiling_error_example_model_namespace::partial_sum_2_lpmf_rsfunctor__<true>, void, stan::math::var_value<double>, const std::vector<int> &, const std::vector<std::vector<int>> &, Eigen::Matrix<stan::m
ath::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>::recursive_reducer' requested here
247 | recursive_reducer worker(num_vars_per_term, num_vars_shared_terms, partials,
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:207:10: note: in instantiation of member function 'stan::math::internal::reduce_sum_impl<laplace_approximation_compiling_error_example_model_namespace::partial_sum_2_lpmf_rsfunctor__<true>, void, stan::math::var_value<double>, const std::vector<int> &, const std::vector<std::vector<int>> &, Eigen::Matrix<stan::math::var_value<double>, -1, -1> &, Eigen::Map<const Eigen::Matrix<stan::math::var_value<double>, -1, 1>> &, const int &, const Eigen::Map<Eigen::Matrix<double, -1, -1>> &, const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &>::operator()' requested here
207 | return internal::reduce_sum_impl<ReduceFunction, void, return_type, Vec,
| ^
/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:1042:12: note: in instantiation of function template specialization 'laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model::log_prob_impl<true, false, Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<int, -1, 1>, nullptr, nullptr, nullptr>' requested here
1042 | return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/src/stan/model/model_base_crtp.hpp
:120:50: note: in instantiation of function template specialization 'laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model::log_prob<true, false, stan::math::var_value<double>>' requested here
120 | return static_cast<const M*>(this)->template log_prob<true, false>(theta,
| ^
/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.hpp:432:3: note: in instantiation of member function 'stan::model::model_base_crtp<laplace_approximation_compiling_error_example_model_namespace::laplace_approximation_compiling_error_example_model>::log_prob_propto' requested here
432 | ~laplace_approximation_compiling_error_example_model() {}
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:33:13: note: candidate function not viable: no known conversion from 'const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int>' to 'const var' (aka 'const var_value<double>') for 1st argument
33 | inline auto deep_copy_vars(const var& arg) {
| ^ ~~~~~~~~~~~~~~
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:23:14: note: candidate template ignored: requirement 'is_arithmetic<std::tuple<Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, int, int, int, int>>::value' was not satisfied [with Arith = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
23 | inline Arith deep_copy_vars(Arith&& arg) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:45:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with VarVec = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
45 | inline auto deep_copy_vars(VarVec&& arg) {
|
^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:63:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with VecContainer = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
63 | inline auto deep_copy_vars(VecContainer&& arg) {
| ^
/Users/myusername/.cmdstan/cmdstan-2.39.0/stan/lib/stan_math/stan/math/rev/core/deep_copy_vars.hpp:79:13: note: candidate template ignored: requirement 'integral_constant<bool, false>::value' was not satisfied [with EigT = const std::tuple<Eigen::Matrix<double, -1, 1>, double, int, int, int, int> &]
79 | inline auto deep_copy_vars(EigT&& arg) {
| ^
4 errors generated.
make: *** [/var/folders/11/bb8zxz8j0fx1lv3_s0mbhkr00000gp/T/RtmpMv3O97/model-67d3359827bf.o] Error 1
This issue has been communicated in a thread in the Stan forum, but I think it is also worth posting an issue here.
Since the release of CmdStan 2.39, I have been using the newly added embedded Laplace approximation for my logistic-normal-multinomial model. When trying to fit large empirical data, I encountered warnings saying that the maximum iteration in Laplace approximation was reached in laplace_marginal(). So I switched to laplace_marginal_tol() to pass the custom options with larger iteration limits.
I then encountered issues when compiling my Stan model whose error can be replicated by following code:
Expand the code
Specifically, the Stan model above will prompt an error when compiling with the default cmdstanr options:
with error messages:
Expand error message
As discussed in the Stan forum thread referenced above, this error can be addressed by manually editing the Stan Math library, and the compilation can finish without error and the compiled program runs OK.
However, even with the manual patch, the same code will prompt errors when trying to compile a multi-thread version for CPU-acceleration:
with error messages:
Expand error message
Multi-threading will be critical for fitting empirical data in a reasonable time, so I would like to report this issue here and I hope this can be addressed in a future release of CmdStan.