3 #ifndef STAN_MATH_PRIM_MAT_FUNCTOR_MAP_RECT_MPI_HPP 5 #define STAN_MATH_PRIM_MAT_FUNCTOR_MAP_RECT_MPI_HPP 19 template <
int call_id,
typename F,
typename T_shared_param,
21 Eigen::Matrix<typename stan::return_type<T_shared_param, T_job_param>::type,
24 const Eigen::Matrix<T_shared_param, Eigen::Dynamic, 1>& shared_params,
25 const std::vector<Eigen::Matrix<T_job_param, Eigen::Dynamic, 1>>&
27 const std::vector<std::vector<double>>& x_r,
28 const std::vector<std::vector<int>>& x_i, std::ostream* msgs =
nullptr) {
29 typedef internal::map_rect_reduce<F, T_shared_param, T_job_param> ReduceF;
30 typedef internal::map_rect_combine<F, T_shared_param, T_job_param> CombineF;
36 mpi_parallel_call<call_id, ReduceF, CombineF> job_chunk(
37 shared_params, job_params, x_r, x_i);
39 return job_chunk.reduce_combine();
40 }
catch (
const mpi_is_in_use&
e) {
41 return map_rect_concurrent<call_id, F>(shared_params, job_params, x_r, x_i,
49 #define STAN_REGISTER_MPI_MAP_RECT(CALLID, FUNCTOR, SHARED, JOB) \ 52 namespace internal { \ 53 typedef FUNCTOR mpi_mr_##CALLID##_##SHARED##_##JOB##_; \ 54 typedef map_rect_reduce<mpi_mr_##CALLID##_##SHARED##_##JOB##_, SHARED, JOB> \ 55 mpi_mr_##CALLID##_##SHARED##_##JOB##_red_; \ 56 typedef map_rect_combine<mpi_mr_##CALLID##_##SHARED##_##JOB##_, SHARED, 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)
double e()
Return the base of the natural logarithm.