예제 #1
0
 void tpi_execute(TPI_Work * work)
 {
   // get work/data pair
   const WDPPlusRange<WDP>* const_wdp_wrapper = static_cast<const WDPPlusRange<WDP>*>(work->info);
   WDPPlusRange<WDP>* wdp_wrapper = const_cast<WDPPlusRange<WDP>*>(const_wdp_wrapper);
   WDP wdp = wdp_wrapper->wdp;
   int beg = wdp_wrapper->beg, end = wdp_wrapper->end;
   int ibeg, iend;
   // determine my share of the work
   tpi_work_span(work, beg, end, ibeg, iend);
   // do my share of the work
   for (int i=ibeg; i<iend; ++i) {
     wdp.execute(i);
   }
 }
예제 #2
0
 static void parallel_for(int beg, int end, WDP wd) {
   for (int i=beg; i != end; ++i) {
     wd.execute(i);
   }
 }