Пример #1
0
static bool done_sending_peers(pcu_aa_tree t)
{
  if (pcu_aa_empty(t))
    return true;
  pcu_msg_peer* peer;
  peer = (pcu_msg_peer*)t;
  return pcu_mpi_done(&(peer->message))
    && done_sending_peers(t->left)
    && done_sending_peers(t->right);
}
Пример #2
0
/* tries to complete this communication step.
   Returns false if communication is not done,
   otherwise wraps up communication, merges
   if necessary, and returns true */
static bool end_coll_step(pcu_coll* c)
{
  int action = c->pattern->action(c->bit);
  if (action == pcu_coll_idle)
    return true;
  if (action == pcu_coll_send)
    return pcu_mpi_done(&(c->message));
  pcu_message incoming;
  pcu_make_message(&incoming);
  incoming.peer = c->pattern->peer(c->bit);
  if ( ! pcu_mpi_receive(&incoming,pcu_coll_comm))
    return false;
  if (c->message.buffer.size != incoming.buffer.size)
    pcu_fail("collective not called by all ranks or pcu bug");
  c->merge(c->message.buffer.start,incoming.buffer.start,incoming.buffer.size);
  pcu_free_message(&incoming);
  return true;
}