25 idx_t pid, ndom, maxndom, minndom, tndom, *pptr, *pind, *pdom;
26 idx_t ncmps, nover, *cptr, *cind, *cpwgts;
39 printf(
" - Edgecut: %"PRIDX", communication volume: %"PRIDX".\n\n",
44 kpwgts =
ismalloc(ncon*nparts, 0,
"ComputePartitionInfo: kpwgts");
46 for (i=0; i<nvtxs; i++) {
47 for (j=0; j<
ncon; j++)
48 kpwgts[where[i]*ncon+j] += vwgt[i*ncon+j];
52 printf(
" - Balance:\n");
53 for (j=0; j<
ncon; j++) {
54 tvwgt =
isum(nparts, kpwgts+j, ncon);
55 for (k=0, unbalance=1.0*kpwgts[k*ncon+j]/(tpwgts[k*ncon+j]*tvwgt), i=1; i<
nparts; i++) {
56 if (unbalance < 1.0*kpwgts[i*ncon+j]/(tpwgts[i*ncon+j]*tvwgt)) {
57 unbalance = 1.0*kpwgts[i*ncon+
j]/(tpwgts[i*ncon+
j]*tvwgt);
61 printf(
" constraint #%"PRIDX
": %5.3"PRREAL" out of %5.3"PRREAL"\n",
63 1.0*nparts*vwgt[ncon*
iargmax_strd(nvtxs, vwgt+j, ncon)+j]/
64 (1.0*
isum(nparts, kpwgts+j, ncon)));
69 tvwgt =
isum(nparts, kpwgts, 1);
70 for (k=0, unbalance=kpwgts[k]/(tpwgts[k]*tvwgt), i=1; i<
nparts; i++) {
71 if (unbalance < kpwgts[i]/(tpwgts[i]*tvwgt)) {
72 unbalance = kpwgts[
i]/(tpwgts[
i]*tvwgt);
77 printf(
" - Most overweight partition:\n" 78 " pid: %"PRIDX
", actual: %"PRIDX
", desired: %"PRIDX
", ratio: %.2"PRREAL".\n\n",
79 k, kpwgts[k], (
idx_t)(tvwgt*tpwgts[k]), unbalance);
86 pptr =
imalloc(nparts+1,
"ComputePartitionInfo: pptr");
87 pind =
imalloc(nvtxs,
"ComputePartitionInfo: pind");
88 pdom =
imalloc(nparts,
"ComputePartitionInfo: pdom");
94 for (tndom=0, pid=0; pid<
nparts; pid++) {
95 iset(nparts, 0, pdom);
96 for (ii=pptr[pid]; ii<pptr[pid+1]; ii++) {
98 for (j=xadj[i]; j<xadj[i+1]; j++)
99 pdom[where[adjncy[j]]] += adjwgt[j];
102 for (ndom=0, i=0; i<
nparts; i++)
103 ndom += (pdom[i] > 0 ? 1 : 0);
105 if (pid == 0 || maxndom < ndom)
107 if (pid == 0 || minndom > ndom)
111 printf(
" - Subdomain connectivity: max: %"PRIDX
", min: %"PRIDX
", avg: %.2"PRREAL"\n\n",
112 maxndom, minndom, 1.0*tndom/nparts);
118 cptr =
imalloc(nvtxs+1,
"ComputePartitionInfo: cptr");
119 cind =
imalloc(nvtxs,
"ComputePartitionInfo: cind");
120 cpwgts =
ismalloc(nparts, 0,
"ComputePartitionInfo: cpwgts");
124 printf(
" - Each partition is contiguous.\n");
127 for (nover=0, i=0; i<ncmps; i++) {
128 cpwgts[where[cind[cptr[
i]]]]++;
129 if (cpwgts[where[cind[cptr[i]]]] == 2)
132 printf(
" - There are %"PRIDX
" non-contiguous partitions.\n" 133 " Total components after removing the cut edges: %"PRIDX
",\n" 134 " max components: %"PRIDX
" for pid: %"PRIDX
".\n",
138 printf(
" - The original graph had %"PRIDX
" connected components and the resulting\n" 139 " partitioning after removing the cut edges has %"PRIDX
" components.",
idx_t idx_t idx_t idx_t * vwgt
idx_t idx_t idx_t idx_t idx_t idx_t idx_t * nparts
NonlinearFactorGraph graph
static const SmartProjectionParams params
void ComputePartitionInfo(params_t *params, graph_t *graph, idx_t *where)
idx_t idx_t idx_t idx_t idx_t idx_t idx_t real_t * tpwgts
idx_t idx_t idx_t idx_t idx_t idx_t * adjwgt
void gk_free(void **ptr1,...)
idx_t idx_t idx_t idx_t * where
idx_t idx_t idx_t * adjncy
#define FindPartitionInducedComponents