13 #ifndef MTMETIS_KWINFO_H 14 #define MTMETIS_KWINFO_H 65 #define DLMEM_PREFIX kwnbrinfo 66 #define DLMEM_TYPE_T kwnbrinfo_type 67 #include <dlmem_headers.h> 72 #define DLMEM_PREFIX adjinfo 73 #define DLMEM_TYPE_T adjinfo_type 74 #include <dlmem_headers.h> 86 #define par_kwinfo_create MTMETIS_par_kwinfo_create 98 #define par_kwinfo_free MTMETIS_par_kwinfo_free 118 pid_type
const maxnnbrs)
121 adj_type psize, pstart;
129 myrinfo = kwinfo->nbrinfo + v;
131 if (myrinfo->nbrstart == NULL_ADJ) {
132 myrinfo->nbrstart = kwinfo->nnbrpool;
133 kwinfo->nnbrpool += maxnnbrs;
137 pool = size_downlog2(((myrinfo->nbrstart+maxnnbrs-1)>>kwinfo->basebits)+1);
138 psize = kwinfo->basennbrs << pool;
139 pstart = psize-kwinfo->basennbrs;
142 if (kwinfo->nbrpools[pool] == NULL) {
143 kwinfo->nbrpools[pool] = malloc(
sizeof(
adjinfo_type)*psize);
146 DL_ASSERT(myrinfo->nbrstart != NULL_ADJ,
"Bad nbrstart");
148 if (pstart > myrinfo->nbrstart) {
150 myrinfo->nbrstart = pstart;
151 kwinfo->nnbrpool = pstart+maxnnbrs;
152 mynbrs = kwinfo->nbrpools[pool];
155 mynbrs = kwinfo->nbrpools[pool] + (myrinfo->nbrstart - pstart);
158 DL_ASSERT(mynbrs < kwinfo->nbrpools[pool] + psize,
"Bad mynbrs");
159 DL_ASSERT(mynbrs >= kwinfo->nbrpools[pool],
"Bad mynbrs");
168 pid_type
const maxnnbrs)
171 adj_type psize, pstart;
179 myrinfo = kwinfo->nbrinfo + v;
181 if (myrinfo->nbrstart == NULL_ADJ) {
182 dlthread_set_lock(&(kwinfo->lock));
183 myrinfo->nbrstart = kwinfo->nnbrpool;
184 kwinfo->nnbrpool += maxnnbrs;
185 dlthread_unset_lock(&(kwinfo->lock));
189 pool = size_downlog2(((myrinfo->nbrstart+maxnnbrs-1)>>kwinfo->basebits)+1);
190 psize = kwinfo->basennbrs << pool;
191 pstart = psize-kwinfo->basennbrs;
194 if (kwinfo->nbrpools[pool] == NULL) {
195 dlthread_set_lock(&(kwinfo->lock));
196 if (kwinfo->nbrpools[pool] == NULL) {
197 kwinfo->nbrpools[pool] = malloc(
sizeof(
adjinfo_type)*psize);
199 dlthread_unset_lock(&(kwinfo->lock));
202 DL_ASSERT(myrinfo->nbrstart != NULL_ADJ,
"Bad nbrstart");
204 if (pstart > myrinfo->nbrstart) {
206 myrinfo->nbrstart = pstart;
207 kwinfo->nnbrpool = pstart+maxnnbrs;
208 mynbrs = kwinfo->nbrpools[pool];
211 mynbrs = kwinfo->nbrpools[pool] + (myrinfo->nbrstart - pstart);
214 DL_ASSERT(mynbrs < kwinfo->nbrpools[pool] + psize,
"Bad mynbrs");
215 DL_ASSERT(mynbrs >= kwinfo->nbrpools[pool],
"Bad mynbrs");
224 pid_type
const maxnnbrs)
227 adj_type psize, pstart;
231 myrinfo = kwinfo->nbrinfo + v;
233 if (maxnnbrs == 0 || myrinfo->nbrstart == NULL_ADJ) {
238 pool = size_downlog2(((myrinfo->nbrstart+maxnnbrs-1)>>kwinfo->basebits)+1);
239 psize = kwinfo->basennbrs << pool;
240 pstart = psize-kwinfo->basennbrs;
242 mynbrs = kwinfo->nbrpools[pool] + (myrinfo->nbrstart - pstart);
244 DL_ASSERT(mynbrs < kwinfo->nbrpools[pool] + psize,
"Bad mynbrs");
245 DL_ASSERT(mynbrs >= kwinfo->nbrpools[pool],
"Bad mynbrs");
Type and function prototypes for the ctrl structure.
void par_kwinfo_free(graph_type *graph)
Free a kwinfo and its associate memory owned by graph.
Definition: kwinfo.c:102
Types and functions for distributed graph objects.
void par_kwinfo_create(ctrl_type *ctrl, graph_type *graph)
Allocate the memory arrays for refinement.
Definition: kwinfo.c:62