32 #ifndef VSMC_SMP_BACKEND_OMP_HPP 33 #define VSMC_SMP_BACKEND_OMP_HPP 53 template <
typename IntType>
56 #pragma omp parallel for default(shared) 58 this->copy_particle(static_cast<size_type>(src_idx[i]), i);
64 template <
typename T,
typename Derived>
71 const size_type N = particle.
size();
74 std::size_t accept = 0;
75 #pragma omp parallel for reduction(+ : accept) default(shared) 76 for (size_type i = 0; i < N; ++i)
89 template <
typename T,
typename Derived>
96 const size_type N = particle.
size();
98 std::size_t accept = 0;
99 #pragma omp parallel for reduction(+ : accept) default(shared) 100 for (size_type i = 0; i < N; ++i)
101 accept += this->
eval_sp(iter, particle.
sp(i));
113 template <
typename T,
typename Derived>
118 std::size_t iter, std::size_t dim,
Particle<T> &particle,
double *r)
121 const size_type N = particle.
size();
123 #pragma omp parallel for default(shared) 124 for (size_type i = 0; i < N; ++i) {
126 r +
static_cast<std::size_t
>(i) * dim);
137 #endif // VSMC_SMP_BACKEND_OMP_HPP
Particle class representing the whole particle set.
sp_type sp(size_type id)
Get a SingleParticle<T> object.
void eval_param(Particle< T > &particle, void *param)
Particle::value_type subtype using OpenMP.
std::size_t eval_sp(SingleParticle< T > sp)
void copy(size_type N, const IntType *src_idx)
Sampler<T>::move_type subtype using OpenMP.
Monitor evalution base dispatch class.
void operator()(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r)
Monitor<T>::eval_type subtype using OpenMP.
std::size_t operator()(Particle< T > &particle, void *param)
#define VSMC_DEFINE_SMP_BACKEND_FORWARD(Name)
void eval_pre(Particle< T > &particle)
SizeType< StateBase > size_type
Move base dispatch class.
Sampler<T>::init_type subtype using OpenMP.
typename SizeTypeTrait< T >::type SizeType
size_type size() const
Number of particles.
void eval_post(Particle< T > &particle)
#define VSMC_DEFINE_SMP_BACKEND_SPECIAL(SMP, Name)
std::size_t operator()(std::size_t iter, Particle< T > &particle)
Initialize base dispatch class.