Long message when compiling reduce_sum model

Hi,
I have been trying to implement the “reduce_sum” example provided here:
https://mc-stan.org/users/documentation/case-studies/reduce_sum_tutorial.html
When compiling the multithreaded model (logistic1.stan) I get the very long message that I have copied below. The model does run and generates meaningful results, but there is no performance speed up when compared to the non-multithreaded model (logistic0.stan) so I wonder whether it is even possible that multithreading is not actually working? Can you help me understand what that long message I get during compiling means?

I am working on Windows10, R version 4.2.3, cmdstanr version 0.7.0 and cmdstan version 2.28.2.

Please let me know if I can provide any additional information, I am new to this forum and to the “reduce_sum” world.

Thank you!

Compiling Stan program…
In file included from stan/lib/stan_math/stan/math/rev/functor.hpp:29,
from stan/lib/stan_math/stan/math/rev.hpp:11,
from stan/lib/stan_math/stan/math.hpp:19,
from stan/src/stan/model/model_header.hpp:4,
from C:/Users/Euronics/AppData/Local/Temp/Rtmpa0S1Y5/model-5e601abc1d13.hpp:3:
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp: In instantiation of ‘stan::math::internal::reduce_sum_impl<ReduceFunction, typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type, ReturnType, Vec, Args …>::recursive_reducer::recursive_reducer(size_t, size_t, double*, VecT&&, ArgsT&& …) [with VecT = const std::vector&; ArgsT = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}; ReduceFunction = logistic1_model_namespace::partial_sum_lpmf_rsfunctor_; ReturnType = stan::math::var_value; Vec = const std::vector&; Args = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}; size_t = long long unsigned int]’:
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:249:23: required from ‘stan::math::var stan::math::internal::reduce_sum_impl<ReduceFunction, typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type, ReturnType, Vec, Args …>::operator()(Vec&&, bool, int, std::ostream*, Args&& …) const [with ReduceFunction = logistic1_model_namespace::partial_sum_lpmf_rsfunctor_; ReturnType = stan::math::var_value; Vec = const std::vector&; Args = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::
math::var_value<double, void>, -1, 1, 0, -1, 1>&}; typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type = void; stan::math::var = stan::math::var_value; std::ostream = std::basic_ostream]’
stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:207:60: required from 'auto stan::math::reduce_sum(Vec&&, int, std::ostream*, Args&& …) [with ReduceFunction = logistic1_model_namespace::partial_sum_lpmf_rsfunctor
_; Vec = const std::vector&; = void; Args = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}; std::ostream = std::basic_ostream]’
C:/Users/Euronics/AppData/Local/Temp/Rtmpa0S1Y5/model-5e601abc1d13.hpp:244:61: required from ‘stan::scalar_type_t logistic1_model_namespace::logistic1_model::log_prob_impl(VecR&, VecI&, std::ostream*) const [with bool propto__ = false; bool jacobian__ = false; VecR = Eigen::Matrix<stan::math::var_value, -1, 1>; VecI = Eigen::Matrix<int, -1, 1>; stan::require_vector_like_t* = 0; stan::require_vector_like_vt<std::is_integral, VecI>* = 0; stan::scalar_type_t = stan::math::var_value; std::ostream = std::basic_ostream]’
C:/Users/Euronics/AppData/Local/Temp/Rtmpa0S1Y5/model-5e601abc1d13.hpp:439:77: required from ‘T_ logistic1_model_namespace::logistic1_model::log_prob(Eigen::Matrix<T_job_param, -1, 1>&, std::ostream*) const [with bool propto__ = false; bool jacobian__ = false; T_ = stan::math::var_value; std::ostream = std::basic_ostream]’
stan/src/stan/model/model_base_crtp.hpp:96:77: required from ‘stan::math::var stan::model::model_base_crtp::log_prob(Eigen::Matrix<stan::math::var_value, -1, 1>&, std::ostream*) const [with M = logistic1_model_namespace::logistic1_model; stan::math::var = stan::mat
h::var_value; std::ostream = std::basic_ostream]’
stan/src/stan/model/model_base_crtp.hpp:93:20: required from here
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:58:23: warning: ‘stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer::local_args_tuple_scope_’ will be initialized after [-Wreorder]
scoped_args_tuple local_args_tuple_scope_;
^~~~~~~~~~~~~~~~~~~~~~~

stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:57:25: warning: ‘std::tuple<const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&> stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer::args_tuple_’ [-Wreorder]
std::tuple<Args…> args_tuple_;
^~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:63:5: warning: when initialized here [-Wreorder]
recursive_reducer(size_t num_vars_per_term, size_t num_vars_shared_terms,
^~~~~~~~~~~~~~~~~

stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp: In instantiation of ‘stan::math::internal::reduce_sum_impl<ReduceFunction, typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type, ReturnType, Vec, Args …>::recursive_reducer::recursive_reducer(size_t, size_t, double*, VecT&&, ArgsT&& …) [with VecT = const std::vector&; ArgsT = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}; ReduceFunction = logistic1_model_namespace::partial_sum_lpmf_rsfunctor_; ReturnType = stan::math::var_value; Vec = const std::vector&; Args = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}; size_t = long long unsigned int]’:
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:249:23: required from ‘stan::math::var stan::math::internal::reduce_sum_impl<ReduceFunction, typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type, ReturnType, Vec, Args …>::operator()(Vec&&, bool, int, std::ostream*, Args&& …) const [with ReduceFunction = logistic1_model_namespace::partial_sum_lpmf_rsfunctor_; ReturnType = stan::math::var_value; Vec = const std::vector&; Args = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}; typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type = void; stan::math::var = stan::math::var_value; std::ostream = std::basic_ostream]’
stan/lib/stan_math/stan/math/prim/functor/reduce_sum.hpp:207:60: required from 'auto stan::math::reduce_s
um(Vec&&, int, std::ostream*, Args&& …) [with ReduceFunction = logistic1_model_namespace::partial_sum_lpmf_rsfunctor
_; Vec = const std::vector&; = void; Args = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}; std::ostream = std::basic_ostream]’
C:/Users/Euronics/AppData/Local/Temp/Rtmpa0S1Y5/model-5e601abc1d13.hpp:244:61: required from ‘stan::scalar_type_t logistic1_model_namespace::logistic1_model::log_prob_impl(VecR&, VecI&, std::ostream*) const [with bool propto__ = true; bool jacobian__ = false; VecR = Eigen::Matrix<stan::math::var_value, -1, 1>; VecI = Eigen::Matrix<int, -1, 1>; stan::require_vector_like_t* = 0; stan::require_vector_like_vt<std::is_integral, VecI>* = 0; stan::scalar_type_t = stan::math::var_value; std::ostream = std::basic_ostream]’
C:/Users/Euronics/AppData/Local/Temp/Rtmpa0S1Y5/model-5e601abc1d13.hpp:439:77: required from ‘T_ logistic1_model_namespace::logistic1_model::log_prob(Eigen::Matrix<T_job_param, -1, 1>&, std::ostream*) const [with bool propto__ = true; bool jacobian__ = false; T_ = stan::math::var_value; std::ostream = std::basic_ostream]’
stan/src/stan/model/model_base_crtp.hpp:118:76: required from ‘stan::math::var stan::model::model_base_crtp::log_prob_propto(Eigen::Matrix<stan::math::var_value, -1, 1>&, std::ostream*) const [with M = logistic1_model_namespace::logistic1_model; stan::math::var = stan::math::var_value; std::ostream = std::basic_ostream]’
stan/src/stan/model/model_base_crtp.hpp:115:20: required from here
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:58:23: warning: ‘stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, cons
t std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer::local_args_tuple_scope_’ will be initialized after [-Wreorder]
scoped_args_tuple local_args_tuple_scope_;
^~~~~~~~~~~~~~~~~~~~~~~

stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:57:25: warning: ‘std::tuple<const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&> stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer::args_tuple_’ [-Wreorder]
std::tuple<Args…> args_tuple_;
^~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:63:5: warning: when initialized here [-Wreorder]
recursive_reducer(size_t num_vars_per_term, size_t num_vars_shared_terms,
^~~~~~~~~~~~~~~~~

stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp: In instantiation of ‘stan::math::internal::reduce_sum_impl<ReduceFunction, typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type, ReturnType, Vec, Args …>::recursive_reducer::recursive_reducer(stan::math::internal::reduce_sum_impl<ReduceFunction, typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type, ReturnType, Vec, Args …>::recursive_reducer&, tbb::split) [with ReduceFunction = logistic1_model_namespace::partial_sum_lpmf_rsfunctor; ReturnType = stan::math::var_value; Vec = const std::vector&; Args = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}]’:
stan/lib/stan_math/lib/tbb_2020.3/include/tbb/parallel_reduce.h:186:27: required from ‘tbb::task* tbb::interface9::internal::start_reduce<Range, Body, Partitioner>::execute() [with Range = tbb::blocked_range; Body = stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer; Partitioner = const tbb::auto_partitioner]’
stan/lib/stan_math/lib/tbb_2020.3/include/tbb/parallel_reduce.h:181:11: required from here
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:58:23: warning: ‘stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0,
0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer::local_args_tuple_scope_’ will be initialized after [-Wreorder]
scoped_args_tuple local_args_tuple_scope_;
^~~~~~~~~~~~~~~~~~~~~~~

stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:57:25: warning: ‘std::tuple<const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&> stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer::args_tuple_’ [-Wreorder]
std::tuple<Args…> args_tuple_;
^~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:78:5: warning: when initialized here [-Wreorder]
recursive_reducer(recursive_reducer& other, tbb::split)
^~~~~~~~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp: In instantiation of ‘stan::math::internal::reduce_sum_impl<ReduceFunction, typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type, ReturnType, Vec, Args …>::recursive_reducer::recursive_reducer(stan::math::internal::reduce_sum_impl<ReduceFunction, typename std::enable_if<stan::is_var<typename std::decay<Arg>::type, void>::value, void>::type, ReturnType, Vec, Args …>::recursive_reducer&, tbb::split) [with ReduceFunction = logistic1_model_namespace::partial_sum_lpmf_rsfunctor; ReturnType = stan::math::var_value; Vec = const std::vector&; Args = {const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&}]’:
stan/lib/stan_math/lib/tbb_2020.3/include/tbb/parallel_reduce.h:186:27: required from ‘tbb::task* tbb::interface9::internal::start_reduce<Range, Body, Partit
ioner>::execute() [with Range = tbb::blocked_range; Body = stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer; Partitioner = const tbb::auto_partitioner]’
stan/lib/stan_math/lib/tbb_2020.3/include/tbb/parallel_reduce.h:181:11: required from here
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:58:23: warning: ‘stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer::local_args_tuple_scope_’ will be initialized after [-Wreorder]
scoped_args_tuple local_args_tuple_scope_;
^~~~~~~~~~~~~~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:57:25: warning: ‘std::tuple<const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&> stan::math::internal::reduce_sum_impl<logistic1_model_namespace::partial_sum_lpmf_rsfunctor__, void, stan::math::var_value, const std::vector&, const std::vector<int, std::allocator >&, const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >&, Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1>&>::recursive_reducer::args_tuple_’ [-Wreorder]
std::tuple<Args…> args_tuple_;
^~~~~~~~~~~
stan/li
b/stan_math/stan/math/rev/functor/reduce_sum.hpp:78:5: warning: when initialized here [-Wreorder]
recursive_reducer(recursive_reducer& other, tbb::split)