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); } } }
void mds_set_local_matches(struct mds_net* net, struct mds* m, int t, struct mds_links* ln) { int self, other; unsigned i; mds_id a, b; struct mds_copy c; c.p = PCU_Comm_Self(); self = find_peer(ln, PCU_Comm_Self()); if (self == -1) return; other = find_peer(ln, PCU_Comm_Peers()); assert(ln->n[self] = ln->n[other]); for (i = 0; i < ln->n[self]; ++i) { a = mds_identify(t, ln->l[self][i]); b = mds_identify(t, ln->l[other][i]); c.e = b; mds_add_copy(net, m, a, c); c.e = a; mds_add_copy(net, m, b, c); } }
/* 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); } } }