Beispiel #1
0
 static typename WDP::ReductionType
 parallel_reduce(int begin, int end, WDP wd) {
   typename WDP::ReductionType result = wd.identity();
   for (int i=begin; i != end; ++i) {
     result = wd.reduce( result, wd.generate(i) );
   }
   return result;
 }
Beispiel #2
0
 static typename WDP::ReductionType
 parallel_reduce(int beg, int end, WDP wd) {
   typedef typename WDP::ReductionType ReductionType;
   ReductionType result = wd.identity();
   WDPPlusRange<WDP> wdp_plus(beg,end,wd);
   TPI_Run_threads_reduce(tpi_reduction_work<WDP>, &wdp_plus,
                          tpi_reduction_join<WDP>,
                          tpi_reduction_init<WDP>, sizeof(result), &result);
   return result;
 }