Esempio n. 1
0
void flip_coin(void* b_, const diy::Master::ProxyWithLink& cp, void*)
{
  Block*        b = static_cast<Block*>(b_);

  b->count++;
  bool done = rand() % 2;
  //std::cout << cp.gid() << "  " << done << " " << b->count << std::endl;
  cp.collectives()->clear();
  cp.all_reduce(done, std::logical_and<bool>());
}
Esempio n. 2
0
void min_max(void* b_, const diy::Master::ProxyWithLink& cp, void*)
{
  Block*   b   = static_cast<Block*>(b_);
  cp.all_reduce(b->points.size(), diy::mpi::minimum<size_t>());
  cp.all_reduce(b->points.size(), diy::mpi::maximum<size_t>());
}