Exemple #1
0
void mds_set_type_links(struct mds_net* net, struct mds* m,
    int t, struct mds_links* ln)
{
  unsigned i;
  unsigned j;
  unsigned* in;
  struct mds_copy c;
  PCU_Comm_Begin();
  for (i = 0; i < ln->np; ++i) {
    PCU_ALWAYS_ASSERT(ln->l);
    for (j = 0; j < ln->n[i]; ++j)
      PCU_COMM_PACK(ln->p[i], ln->l[i][j]);
  }
  PCU_Comm_Send();
  while (PCU_Comm_Listen()) {
    c.p = PCU_Comm_Sender();
    PCU_ALWAYS_ASSERT(c.p != PCU_Comm_Self());
    i = find_peer(ln, c.p);
    in = PCU_Comm_Extract(ln->n[i] * sizeof(unsigned));
    for (j = 0; j < ln->n[i]; ++j) {
      c.e = mds_identify(t, in[j]);
      mds_add_copy(net, m, mds_identify(t, ln->l[i][j]), c);
    }
  }
}
Exemple #2
0
void mds_get_type_links(struct mds_net* net, struct mds* m,
    int t, struct mds_links* ln)
{
  unsigned i;
  /* count remote links in np, p and n */
  for_type_net(net, m, t, note_remote_link, ln);
  alloc_links(ln);
  for (i = 0; i < ln->np; ++i)
    if (((unsigned)PCU_Comm_Self()) < ln->p[i])
      /* zero n's for behavior in take_copy */
      ln->n[i] = 0;
  /* record indices in local order for owned boundaries */
  for_type_net(net, m, t, take_remote_link, ln);
  PCU_Comm_Begin();
  /* send indices in local order for owned boundaries */
  for_type_net(net, m, t, send_remote_link, NULL);
  PCU_Comm_Send();
  while (PCU_Comm_Listen())
  /* recv indices in remote order for non-owned boundaries */
    recv_links(ln);
}
Exemple #3
0
/* see apf/apfConvert.cc apf::Converter::createRemotes */
static void rebuild_net(struct mds_net* net,
    struct mds* m,
    struct mds_net* net2,
    struct mds* m2,
    struct mds_tag* new_of)
{
  int d;
  mds_id e;
  mds_id ne;
  mds_id ce;
  mds_id nce;
  struct mds_copies* cs;
  struct mds_copy c;
  int i;
  PCU_Comm_Begin();
  for (d = 0; d <= m->d; ++d)
    for (e = mds_begin(m, d); e != MDS_NONE; e = mds_next(m, e)) {
      cs = mds_get_copies(net, e);
      if (!cs)
        continue;
      ne = lookup(new_of, e);
      for (i = 0; i < cs->n; ++i) {
        ce = cs->c[i].e;
        PCU_COMM_PACK(cs->c[i].p, ce);
        PCU_COMM_PACK(cs->c[i].p, ne);
      }
    }
  PCU_Comm_Send();
  while (PCU_Comm_Listen()) {
    c.p = PCU_Comm_Sender();
    while (!PCU_Comm_Unpacked()) {
      PCU_COMM_UNPACK(ce);
      PCU_COMM_UNPACK(ne);
      c.e = ne;
      nce = lookup(new_of, ce);
      mds_add_copy(net2, m2, nce, c);
    }
  }
}