Example #1
0
static pcu_msg_peer* make_peer(int id)
{
  pcu_msg_peer* p;
  NOTO_MALLOC(p,1);
  pcu_make_message(&(p->message));
  p->message.peer = id;
  return p;
}
Example #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;
}
Example #3
0
static void make_comm(pcu_msg* m)
{
  pcu_make_aa(&(m->peers));
  pcu_make_message(&(m->received));
  m->state = idle_state;
}