32 #ifndef VSMC_SMP_BACKEND_OMP_HPP 33 #define VSMC_SMP_BACKEND_OMP_HPP 53 template <
typename IntType>
57 using stype =
typename std::make_signed<size_type>::type;
58 stype n =
static_cast<stype
>(N);
59 #pragma omp parallel for default(shared) 60 for (stype i = 0; i < n; ++i) {
62 static_cast<size_type>(src_idx[i]), static_cast<size_type>(i));
64 #else // _OPENMP < 200805 65 #pragma omp parallel for default(shared) 67 this->copy_particle(static_cast<size_type>(src_idx[i]), i);
68 #endif // _OPENMP < 200805 74 template <
typename T,
typename Derived>
81 const size_type N = particle.
size();
84 std::size_t accept = 0;
86 using stype =
typename std::make_signed<size_type>::type;
87 stype n =
static_cast<stype
>(N);
88 #pragma omp parallel for reduction(+ : accept) default(shared) 89 for (stype i = 0; i < n; ++i) {
93 #else // _OPENMP < 200805 94 #pragma omp parallel for reduction(+ : accept) default(shared) 95 for (size_type i = 0; i < N; ++i)
97 #endif // _OPENMP < 200805 109 template <
typename T,
typename Derived>
116 const size_type N = particle.
size();
118 std::size_t accept = 0;
120 using stype =
typename std::make_signed<size_type>::type;
121 stype n =
static_cast<stype
>(N);
122 #pragma omp parallel for reduction(+ : accept) default(shared) 123 for (stype i = 0; i < n; ++i) {
127 #else // _OPENMP < 200805 128 #pragma omp parallel for reduction(+ : accept) default(shared) 129 for (size_type i = 0; i < N; ++i)
131 #endif // _OPENMP < 200805 143 template <
typename T,
typename Derived>
148 std::size_t iter, std::size_t dim,
Particle<T> &particle,
double *r)
151 const size_type N = particle.
size();
154 using stype =
typename std::make_signed<size_type>::type;
155 stype n =
static_cast<stype
>(N);
156 #pragma omp parallel for default(shared) 157 for (stype i = 0; i < n; ++i) {
160 r + static_cast<std::size_t>(i) * dim);
162 #else // _OPENMP < 200805 163 #pragma omp parallel for default(shared) 164 for (size_type i = 0; i < N; ++i) {
166 r + static_cast<std::size_t>(i) * dim);
168 #endif // _OPENMP < 200805 178 template <
typename T,
typename Derived>
185 const size_type N = particle.
size();
188 using stype =
typename std::make_signed<size_type>::type;
189 stype n =
static_cast<stype
>(N);
190 #pragma omp parallel for default(shared) 191 for (stype i = 0; i < n; ++i) {
195 #else // _OPENMP < 200805 196 #pragma omp parallel for default(shared) 197 for (size_type i = 0; i < N; ++i)
199 #endif // _OPENMP < 200805 202 return this->eval_grid(iter, particle);
211 #endif // VSMC_SMP_BACKEND_OMP_HPP
Particle class representing the whole particle set.
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.
Path<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
double operator()(std::size_t iter, Particle< T > &particle, double *r)
Move base dispatch class.
Sampler<T>::init_type subtype using OpenMP.
typename SizeTypeTrait< T >::type SizeType
Path evalution base dispatch class.
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)
A thin wrapper over a complete Particle.
Initialize base dispatch class.