32 #ifndef VSMC_SMP_BACKEND_TBB_HPP    33 #define VSMC_SMP_BACKEND_TBB_HPP    38 #define VSMC_DEFINE_SMP_BACKEND_TBB_PARALLEL_RUN_INITIALIZE(args)             \    39     this->eval_param(particle, param);                                        \    40     this->eval_pre(particle);                                                 \    41     work_type work(this, &particle);                                          \    42     ::tbb::parallel_reduce args;                                              \    43     this->eval_post(particle);                                                \    46 #define VSMC_DEFINE_SMP_BACKEND_TBB_PARALLEL_RUN_MOVE(args)                   \    47     this->eval_pre(iter, particle);                                           \    48     work_type work(this, iter, &particle);                                    \    49     ::tbb::parallel_reduce args;                                              \    50     this->eval_post(iter, particle);                                          \    53 #define VSMC_DEFINE_SMP_BACKEND_TBB_PARALLEL_RUN_MONITOR_EVAL(args)           \    54     this->eval_pre(iter, particle);                                           \    55     work_type work(this, iter, dim, &particle, r);                            \    56     ::tbb::parallel_for args;                                                 \    57     this->eval_post(iter, particle);    59 #define VSMC_DEFINE_SMP_BACKEND_TBB_PARALLEL_RUN_PATH_EVAL(args)              \    60     this->eval_pre(iter, particle);                                           \    61     work_type work(this, iter, &particle, r);                                 \    62     ::tbb::parallel_for args;                                                 \    63     this->eval_post(iter, particle);                                          \    64     return this->eval_grid(iter, particle);    81     template <
typename IntType>
    84         parallel_copy_run(src_idx, ::tbb::blocked_range<size_type>(0, N));
    88     template <
typename IntType>
    93             : state_(state), src_idx_(src_idx)
    97         void operator()(const ::tbb::blocked_range<size_type> &range)
 const    99             for (
size_type i = range.begin(); i != range.end(); ++i) {
   100                 state_->copy_particle(static_cast<size_type>(src_idx_[i]), i);
   106         const IntType *
const src_idx_;
   109     template <
typename IntType>
   111         const IntType *src_idx, const ::tbb::blocked_range<size_type> &range)
   116     template <
typename IntType>
   118         const ::tbb::blocked_range<size_type> &range,
   119         const ::tbb::auto_partitioner &partitioner)
   125     template <
typename IntType>
   127         const ::tbb::blocked_range<size_type> &range,
   128         const ::tbb::simple_partitioner &partitioner)
   134     template <
typename IntType>
   136         const ::tbb::blocked_range<size_type> &range,
   137         ::tbb::affinity_partitioner &partitioner)
   143 #if __TBB_TASK_GROUP_CONTEXT   144     template <
typename IntType>
   146         const ::tbb::blocked_range<size_type> &range,
   147         const ::tbb::auto_partitioner &partitioner,
   148         ::tbb::task_group_context &context)
   154     template <
typename IntType>
   156         const ::tbb::blocked_range<size_type> &range,
   157         const ::tbb::simple_partitioner &partitioner,
   158         ::tbb::task_group_context &context)
   164     template <
typename IntType>
   166         const ::tbb::blocked_range<size_type> &range,
   167         ::tbb::affinity_partitioner &partitioner,
   168         ::tbb::task_group_context &context)
   173 #endif // __TBB_TASK_GROUP_CONTEXT   178 template <
typename T, 
typename Derived>
   184         return parallel_run(particle, param,
   186                                 0, particle.
size()));
   198             : wptr_(wptr), pptr_(pptr), accept_(0)
   203             : wptr_(other.wptr_), pptr_(other.pptr_), accept_(0)
   207         void operator()(const ::tbb::blocked_range<size_type> &range)
   209             for (
size_type i = range.begin(); i != range.end(); ++i)
   213         void join(
const work_type &other) { accept_ += other.accept_; }
   215         std::size_t 
accept()
 const { 
return accept_; }
   231         const ::tbb::auto_partitioner &partitioner)
   234             (range, work, partitioner));
   239         const ::tbb::simple_partitioner &partitioner)
   242             (range, work, partitioner));
   247         ::tbb::affinity_partitioner &partitioner)
   250             (range, work, partitioner));
   253 #if __TBB_TASK_GROUP_CONTEXT   256         const ::tbb::auto_partitioner &partitioner,
   257         ::tbb::task_group_context &context)
   260             (range, work, partitioner, context));
   265         const ::tbb::simple_partitioner &partitioner,
   266         ::tbb::task_group_context &context)
   269             (range, work, partitioner, context));
   274         ::tbb::affinity_partitioner &partitioner,
   275         ::tbb::task_group_context &context)
   278             (range, work, partitioner, context));
   280 #endif // __TBB_TASK_GROUP_CONTEXT   285 template <
typename T, 
typename Derived>
   291         return parallel_run(iter, particle,
   293                                 0, particle.
size()));
   306             : wptr_(wptr), iter_(iter), pptr_(pptr), accept_(0)
   318         void operator()(const ::tbb::blocked_range<size_type> &range)
   320             for (
size_type i = range.begin(); i != range.end(); ++i)
   324         void join(
const work_type &other) { accept_ += other.accept_; }
   326         std::size_t 
accept()
 const { 
return accept_; }
   330         const std::size_t iter_;
   343         const ::tbb::auto_partitioner &partitioner)
   346             (range, work, partitioner));
   351         const ::tbb::simple_partitioner &partitioner)
   354             (range, work, partitioner));
   359         ::tbb::affinity_partitioner &partitioner)
   362             (range, work, partitioner));
   365 #if __TBB_TASK_GROUP_CONTEXT   368         const ::tbb::auto_partitioner &partitioner,
   369         ::tbb::task_group_context &context)
   372             (range, work, partitioner, context));
   377         const ::tbb::simple_partitioner &partitioner,
   378         ::tbb::task_group_context &context)
   381             (range, work, partitioner, context));
   386         ::tbb::affinity_partitioner &partitioner,
   387         ::tbb::task_group_context &context)
   390             (range, work, partitioner, context));
   392 #endif // __TBB_TASK_GROUP_CONTEXT   397 template <
typename T, 
typename Derived>
   402         std::size_t iter, std::size_t dim, 
Particle<T> &particle, 
double *r)
   404         parallel_run(iter, dim, particle, r,
   406                          0, particle.
size()));
   419             : wptr_(wptr), iter_(iter), dim_(dim), pptr_(pptr), r_(r)
   423         void operator()(const ::tbb::blocked_range<size_type> &range)
 const   425             for (
size_type i = range.begin(); i != range.end(); ++i) {
   427                     r_ + static_cast<std::size_t>(i) * dim_);
   433         const std::size_t iter_;
   434         const std::size_t dim_;
   449         const ::tbb::auto_partitioner &partitioner)
   452             (range, work, partitioner));
   458         const ::tbb::simple_partitioner &partitioner)
   461             (range, work, partitioner));
   467         ::tbb::affinity_partitioner &partitioner)
   470             (range, work, partitioner));
   473 #if __TBB_TASK_GROUP_CONTEXT   477         const ::tbb::auto_partitioner &partitioner,
   478         ::tbb::task_group_context &context)
   481             (range, work, partitioner, context));
   487         const ::tbb::simple_partitioner &partitioner,
   488         ::tbb::task_group_context &context)
   491             (range, work, partitioner, context));
   497         ::tbb::affinity_partitioner &partitioner,
   498         ::tbb::task_group_context &context)
   501             (range, work, partitioner, context));
   503 #endif // __TBB_TASK_GROUP_CONTEXT   508 template <
typename T, 
typename Derived>
   514         return parallel_run(iter, particle, r,
   516                                 0, particle.
size()));
   529             : wptr_(wptr), iter_(iter), pptr_(pptr), r_(r)
   533         void operator()(const ::tbb::blocked_range<size_type> &range)
 const   535             for (
size_type i = range.begin(); i != range.end(); ++i)
   541         const std::size_t iter_;
   554         const ::tbb::auto_partitioner &partitioner)
   557             (range, work, partitioner));
   562         const ::tbb::simple_partitioner &partitioner)
   565             (range, work, partitioner));
   570         ::tbb::affinity_partitioner &partitioner)
   573             (range, work, partitioner));
   576 #if __TBB_TASK_GROUP_CONTEXT   579         const ::tbb::auto_partitioner &partitioner,
   580         ::tbb::task_group_context &context)
   583             (range, work, partitioner, context));
   588         const ::tbb::simple_partitioner &partitioner,
   589         ::tbb::task_group_context &context)
   592             (range, work, partitioner, context));
   597         ::tbb::affinity_partitioner &partitioner,
   598         ::tbb::task_group_context &context)
   601             (range, work, partitioner, context));
   603 #endif // __TBB_TASK_GROUP_CONTEXT   608 #endif // VSMC_SMP_BACKEND_TBB_HPP 
Particle class representing the whole particle set. 
 
double parallel_run(std::size_t iter, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::auto_partitioner &partitioner,::tbb::task_group_context &context)
 
double parallel_run(std::size_t iter, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range,::tbb::affinity_partitioner &partitioner,::tbb::task_group_context &context)
 
std::size_t accept() const 
 
Sampler<T>::init_type subtype using Intel Threading Building Blocks. 
 
void parallel_copy_run(const IntType *src_idx, const ::tbb::blocked_range< size_type > &range, const ::tbb::simple_partitioner &partitioner,::tbb::task_group_context &context)
 
double operator()(std::size_t iter, Particle< T > &particle, double *r)
 
void parallel_copy_run(const IntType *src_idx, const ::tbb::blocked_range< size_type > &range,::tbb::affinity_partitioner &partitioner,::tbb::task_group_context &context)
 
void join(const work_type &other)
 
double parallel_run(std::size_t iter, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range,::tbb::affinity_partitioner &partitioner)
 
std::size_t parallel_run(Particle< T > &particle, void *param, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::auto_partitioner &partitioner,::tbb::task_group_context &context)
 
void operator()(const ::tbb::blocked_range< size_type > &range)
 
void operator()(const ::tbb::blocked_range< size_type > &range) const 
 
work_type(StateTBB< StateBase > *state, const IntType *src_idx)
 
double parallel_run(std::size_t iter, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::auto_partitioner &partitioner)
 
void parallel_run(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::simple_partitioner &partitioner)
 
std::size_t parallel_run(Particle< T > &particle, void *param, const ::tbb::blocked_range< typename Particle< T >::size_type > &range,::tbb::affinity_partitioner &partitioner,::tbb::task_group_context &context)
 
double parallel_run(std::size_t iter, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::simple_partitioner &partitioner,::tbb::task_group_context &context)
 
Monitor evalution base dispatch class. 
 
work_type(MonitorEvalTBB< T, Derived > *wptr, std::size_t iter, std::size_t dim, Particle< T > *pptr, double *r)
 
void operator()(const ::tbb::blocked_range< size_type > &range) const 
 
std::size_t parallel_run(std::size_t iter, Particle< T > &particle, const ::tbb::blocked_range< typename Particle< T >::size_type > &range,::tbb::affinity_partitioner &partitioner)
 
void parallel_run(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range,::tbb::affinity_partitioner &partitioner)
 
void parallel_copy_run(const IntType *src_idx, const ::tbb::blocked_range< size_type > &range, const ::tbb::simple_partitioner &partitioner)
 
void operator()(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r)
 
void parallel_run(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::simple_partitioner &partitioner,::tbb::task_group_context &context)
 
void parallel_run(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range)
 
#define VSMC_DEFINE_SMP_BACKEND_FORWARD(Name)                                                              
 
void operator()(const ::tbb::blocked_range< size_type > &range) const 
 
#define VSMC_DEFINE_SMP_BACKEND_TBB_PARALLEL_RUN_INITIALIZE(args)                      
 
std::size_t parallel_run(std::size_t iter, Particle< T > &particle, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::simple_partitioner &partitioner,::tbb::task_group_context &context)
 
void copy(size_type N, const IntType *src_idx)
 
typename Particle< T >::size_type size_type
 
#define VSMC_DEFINE_SMP_BACKEND_TBB_PARALLEL_RUN_MOVE(args)                                  
 
Monitor<T>::eval_type subtype using Intel Threading Building Blocks. 
 
typename Particle< T >::size_type size_type
 
std::size_t operator()(std::size_t iter, Particle< T > &particle)
 
std::size_t parallel_run(Particle< T > &particle, void *param, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::simple_partitioner &partitioner,::tbb::task_group_context &context)
 
std::size_t parallel_run(std::size_t iter, Particle< T > &particle, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::simple_partitioner &partitioner)
 
work_type(InitializeTBB< T, Derived > *wptr, Particle< T > *pptr)
 
void parallel_run(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range,::tbb::affinity_partitioner &partitioner,::tbb::task_group_context &context)
 
Sampler<T>::move_type subtype using Intel Threading Building Blocks. 
 
void operator()(const ::tbb::blocked_range< size_type > &range)
 
#define VSMC_DEFINE_SMP_BACKEND_TBB_PARALLEL_RUN_MONITOR_EVAL(args)                  
 
std::size_t accept() const 
 
#define VSMC_DEFINE_SMP_BACKEND_TBB_PARALLEL_RUN_PATH_EVAL(args)                        
 
double parallel_run(std::size_t iter, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::simple_partitioner &partitioner)
 
std::size_t parallel_run(Particle< T > &particle, void *param, const ::tbb::blocked_range< typename Particle< T >::size_type > &range)
 
std::size_t parallel_run(std::size_t iter, Particle< T > &particle, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::auto_partitioner &partitioner)
 
work_type(MoveTBB< T, Derived > *wptr, std::size_t iter, Particle< T > *pptr)
 
work_type(const work_type &other,::tbb::split)
 
std::size_t parallel_run(std::size_t iter, Particle< T > &particle, const ::tbb::blocked_range< typename Particle< T >::size_type > &range,::tbb::affinity_partitioner &partitioner,::tbb::task_group_context &context)
 
double parallel_run(std::size_t iter, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range)
 
void parallel_copy_run(const IntType *src_idx, const ::tbb::blocked_range< size_type > &range,::tbb::affinity_partitioner &partitioner)
 
work_type(const work_type &other,::tbb::split)
 
void parallel_run(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::auto_partitioner &partitioner,::tbb::task_group_context &context)
 
SizeType< StateBase > size_type
 
work_type(PathEvalTBB< T, Derived > *wptr, std::size_t iter, Particle< T > *pptr, double *r)
 
Move base dispatch class. 
 
std::size_t parallel_run(Particle< T > &particle, void *param, const ::tbb::blocked_range< typename Particle< T >::size_type > &range,::tbb::affinity_partitioner &partitioner)
 
std::size_t parallel_run(Particle< T > &particle, void *param, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::simple_partitioner &partitioner)
 
typename Particle< T >::size_type size_type
 
Particle::value_type subtype using Intel Threading Building Blocks. 
 
Path<T>::eval_type subtype using Intel Threading Building Blocks. 
 
typename SizeTypeTrait< T >::type SizeType
 
std::size_t parallel_run(Particle< T > &particle, void *param, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::auto_partitioner &partitioner)
 
Path evalution base dispatch class. 
 
void join(const work_type &other)
 
size_type size() const 
Number of particles. 
 
std::size_t parallel_run(std::size_t iter, Particle< T > &particle, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::auto_partitioner &partitioner,::tbb::task_group_context &context)
 
void parallel_copy_run(const IntType *src_idx, const ::tbb::blocked_range< size_type > &range, const ::tbb::auto_partitioner &partitioner)
 
#define VSMC_DEFINE_SMP_BACKEND_SPECIAL(SMP, Name)                                                    
 
A thin wrapper over a complete Particle. 
 
std::size_t parallel_run(std::size_t iter, Particle< T > &particle, const ::tbb::blocked_range< typename Particle< T >::size_type > &range)
 
std::size_t operator()(Particle< T > &particle, void *param)
 
void parallel_copy_run(const IntType *src_idx, const ::tbb::blocked_range< size_type > &range)
 
typename Particle< T >::size_type size_type
 
void parallel_copy_run(const IntType *src_idx, const ::tbb::blocked_range< size_type > &range, const ::tbb::auto_partitioner &partitioner,::tbb::task_group_context &context)
 
Initialize base dispatch class. 
 
void parallel_run(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r, const ::tbb::blocked_range< typename Particle< T >::size_type > &range, const ::tbb::auto_partitioner &partitioner)