3#ifndef STAN_MATH_PRIM_FUNCTOR_MAP_RECT_MPI_HPP
4#define STAN_MATH_PRIM_FUNCTOR_MAP_RECT_MPI_HPP
18template <
int call_id,
typename F,
typename T_shared_param,
20Eigen::Matrix<return_type_t<T_shared_param, T_job_param>, Eigen::Dynamic, 1>
22 const std::vector<Eigen::Matrix<T_job_param, Eigen::Dynamic, 1>>&
24 const std::vector<std::vector<double>>& x_r,
25 const std::vector<std::vector<int>>& x_i,
26 std::ostream* msgs =
nullptr) {
36 shared_params, job_params, x_r, x_i);
40 return map_rect_concurrent<call_id, F>(shared_params, job_params, x_r, x_i,
48#define STAN_REGISTER_MPI_MAP_RECT(CALLID, FUNCTOR, SHARED, JOB) \
51 namespace internal { \
52 typedef FUNCTOR mpi_mr_##CALLID##_##SHARED##_##JOB##_; \
53 typedef map_rect_reduce<mpi_mr_##CALLID##_##SHARED##_##JOB##_, SHARED, JOB> \
54 mpi_mr_##CALLID##_##SHARED##_##JOB##_red_; \
55 typedef map_rect_combine<mpi_mr_##CALLID##_##SHARED##_##JOB##_, \
56 Eigen::Matrix<SHARED, Eigen::Dynamic, 1>, JOB> \
57 mpi_mr_##CALLID##_##SHARED##_##JOB##_comb_; \
58 typedef mpi_parallel_call<CALLID, mpi_mr_##CALLID##_##SHARED##_##JOB##_red_, \
59 mpi_mr_##CALLID##_##SHARED##_##JOB##_comb_> \
60 mpi_mr_##CALLID##_##SHARED##_##JOB##_pcall_; \
64 STAN_REGISTER_MPI_DISTRIBUTED_APPLY( \
65 stan::math::internal::mpi_mr_##CALLID##_##SHARED##_##JOB##_pcall_)
67#define STAN_REGISTER_MPI_MAP_RECT_ALL(CALLID, FUNCTOR) \
68 STAN_REGISTER_MPI_MAP_RECT(CALLID, FUNCTOR, double, double)
71#undef STAN_REGISTER_MAP_RECT
72#define STAN_REGISTER_MAP_RECT(CALLID, FUNCTOR) \
73 STAN_REGISTER_MPI_MAP_RECT_ALL(CALLID, FUNCTOR)
Exception thrown whenever the MPI resource is busy.
result_t reduce_combine()
Once all data is distributed and cached the reduce_combine evaluates all assigned function evaluation...
The MPI parallel call class manages the distributed evaluation of a collection of tasks following the...
Eigen::Matrix< return_type_t< T_shared_param, T_job_param >, Eigen::Dynamic, 1 > map_rect_mpi(const T_shared_param &shared_params, const std::vector< Eigen::Matrix< T_job_param, Eigen::Dynamic, 1 > > &job_params, const std::vector< std::vector< double > > &x_r, const std::vector< std::vector< int > > &x_i, std::ostream *msgs=nullptr)
static constexpr double e()
Return the base of the natural logarithm.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...