static void exec( ThreadsExec & exec , const void * arg )
  {
    const ParallelReduce & self = * ((const ParallelReduce *) arg );
    const WorkRange range( self.m_policy, exec.pool_rank(), exec.pool_size() );

    ParallelReduce::template exec_range< WorkTag >
      ( self.m_functor , range.begin() , range.end() 
      , ValueInit::init( self.m_functor , exec.reduce_memory() ) );

    exec.template fan_in_reduce< FunctorType , WorkTag >( self.m_functor );
  }
Пример #2
0
  // Function is called once by every concurrent thread.
  static void exec( QthreadExec & exec , const void * arg )
  {
    const ParallelFor & self = * ((const ParallelFor *) arg );

    const WorkRange range( self.m_policy, exec.worker_rank(), exec.worker_size() );

    ParallelFor::template exec_range< WorkTag > ( self.m_functor , range.begin() , range.end() );

    // All threads wait for completion.
    exec.exec_all_barrier();
  }
Пример #3
0
  static void exec( QthreadExec & exec , const void * arg )
  {
    const ParallelReduce & self = * ((const ParallelReduce *) arg );

    const WorkRange range( self.m_policy, exec.worker_rank(), exec.worker_size() );

    ParallelReduce::template exec_range< WorkTag >(
      self.m_functor, range.begin(), range.end(),
      ValueInit::init( ReducerConditional::select(self.m_functor , self.m_reducer)
                     , exec.exec_all_reduce_value() ) );

    exec.template exec_all_reduce< FunctorType, ReducerType, WorkTag >( self.m_functor, self.m_reducer );
  }