Parameters converted to `double` when compiling with external C++ and MPI map_rect()

Gaah, you’re right, I got the theta thing exactly backwards.

Alright how about comment out the automatically generated definitions and also add this to your custom functions list:

inline stan::math::var sigmoid(const stan::math::var& x,
                               const double& sen,
                               const double& mid_pt,
                               const double& rate,
                               std::ostream* pstream__) = delete;

This will avoid the promotion and give you a C++ error and then maybe it will be possible to piece together the template logic (and at least find where things start looking weird)?

My compiler gives me this:

wheat.hpp: In instantiation of ‘Eigen::Matrix<typename boost::math::tools::promote_args<RT1, RT2, A>::type, -1, 1> wheat_model_namespace::continuous_dydt(const Eigen::Matrix<Scalar, -1, 1>&, const Eigen::Matrix<RhsScalar, -1, 1>&, const std::vector<T_l>&, std::ostream*) [with T0__ = stan::math::var; T1__ = double; T2__ = stan::math::var; typename boost::math::tools::promote_args<RT1, RT2, A>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’:
wheat.hpp:2011:24:   required from ‘std::vector<std::vector<typename boost::math::tools::promote_args<T1, T2, T3, T4>::type> > wheat_model_namespace::euler_integrate_ode(const Eigen::Matrix<Scalar, -1, 1>&, const Eigen::Matrix<RhsScalar, -1, 1>&, const std::vector<int>&, const std::vector<std::vector<T_l> >&, const T4__&, std::ostream*) [with T0__ = stan::math::var; T1__ = double; T3__ = stan::math::var; T4__ = double; typename boost::math::tools::promote_args<T1, T2, T3, T4>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’
wheat.hpp:2243:28:   required from ‘Eigen::Matrix<typename boost::math::tools::promote_args<RT1, RT2, A>::type, -1, 1> wheat_model_namespace::run_model(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__ = double; T1__ = stan::math::var; T2__ = double; typename boost::math::tools::promote_args<RT1, RT2, A>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’
wheat.hpp:2414:16:   required from ‘Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, -1, 1> wheat_model_namespace::parallel_log_likelihood(const Eigen::Matrix<Scalar, -1, 1>&, const Eigen::Matrix<RhsScalar, -1, 1>&, const std::vector<double>&, const std::vector<int>&, std::ostream*) [with T0__ = double; T1__ = stan::math::var; typename boost::math::tools::promote_args<T1, T2>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’
wheat.hpp:2454:31:   required from ‘Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, -1, 1> wheat_model_namespace::parallel_log_likelihood_functor__::operator()(const Eigen::Matrix<Scalar, -1, 1>&, const Eigen::Matrix<RhsScalar, -1, 1>&, const std::vector<double>&, const std::vector<int>&, std::ostream*) const [with T0__ = double; T1__ = stan::math::var; typename boost::math::tools::promote_args<T1, T2>::type = stan::math::var; std::ostream = std::basic_ostream<char>]’
stan/lib/stan_math/stan/math/rev/functor/map_rect_reduce.hpp:69:24:   required from ‘stan::math::matrix_d stan::math::internal::map_rect_reduce<F, double, stan::math::var>::operator()(const vector_d&, const vector_d&, const std::vector<double>&, const std::vector<int>&, std::ostream*) const [with F = wheat_model_namespace::parallel_log_likelihood_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/prim/functor/mpi_parallel_call.hpp:299:24:   required from ‘stan::math::mpi_parallel_call<call_id, ReduceF, CombineF>::result_t stan::math::mpi_parallel_call<call_id, ReduceF, CombineF>::reduce_combine() [with int call_id = 1; ReduceF = stan::math::internal::map_rect_reduce<wheat_model_namespace::parallel_log_likelihood_functor__, double, stan::math::var>; CombineF = stan::math::internal::map_rect_combine<wheat_model_namespace::parallel_log_likelihood_functor__, double, stan::math::var>; stan::math::mpi_parallel_call<call_id, ReduceF, CombineF>::result_t = Eigen::Matrix<stan::math::var, -1, 1>]’
stan/lib/stan_math/stan/math/prim/functor/mpi_parallel_call.hpp:260:15:   required from ‘static void stan::math::mpi_parallel_call<call_id, ReduceF, CombineF>::distributed_apply() [with int call_id = 1; ReduceF = stan::math::internal::map_rect_reduce<wheat_model_namespace::parallel_log_likelihood_functor__, double, stan::math::var>; CombineF = stan::math::internal::map_rect_combine<wheat_model_namespace::parallel_log_likelihood_functor__, double, stan::math::var>]’
stan/lib/stan_math/stan/math/prim/functor/mpi_distributed_apply.hpp:40:42:   required from ‘void stan::math::mpi_distributed_apply<F>::run() const [with F = stan::math::mpi_parallel_call<1, stan::math::internal::map_rect_reduce<wheat_model_namespace::parallel_log_likelihood_functor__, double, stan::math::var>, stan::math::internal::map_rect_combine<wheat_model_namespace::parallel_log_likelihood_functor__, double, stan::math::var> >]’
wheat.hpp:3849:1:   required from here
wheat.hpp:1903:22: error: use of deleted function ‘stan::math::var wheat_model_namespace::sigmoid(const stan::math::var&, const double&, const double&, const double&, std::ostream*)’
     vrn_fac = sigmoid(
               ~~~~~~~^
                 rvalue(y, cons_list(index_uni(1), nil_index_list()), "y"),
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 rvalue(theta, cons_list(index_uni(7), nil_index_list()),
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                   "theta"),
                   ~~~~~~~~~
                 (rvalue(theta, cons_list(index_uni(6), nil_index_list()),
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    "theta") / 2),
                    ~~~~~~~~~~~~~~
                 (10 /
                 ~~~~~ 
                   rvalue(theta, cons_list(index_uni(6), nil_index_list()),
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     "theta")), pstream__);