Zoltan2
Loading...
Searching...
No Matches
Zoltan2_CommGraphModel.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Zoltan2: A package of combinatorial algorithms for scientific computing
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact Karen Devine (kddevin@sandia.gov)
39// Erik Boman (egboman@sandia.gov)
40// Siva Rajamanickam (srajama@sandia.gov)
41//
42// ***********************************************************************
43//
44// @HEADER
45
60#ifndef _ZOLTAN2_COMMGRAPHMODEL_HPP_
61#define _ZOLTAN2_COMMGRAPHMODEL_HPP_
62
63#include <Zoltan2_Model.hpp>
73#include <unordered_map>
74
75namespace Zoltan2 {
76
78
90template <typename Adapter>
91class CommGraphModel : public Model<Adapter>
92{
93public:
94
95#ifndef DOXYGEN_SHOULD_SKIP_THIS
96 typedef typename Adapter::scalar_t scalar_t;
97 typedef typename Adapter::gno_t gno_t;
98 typedef typename Adapter::lno_t lno_t;
99 typedef typename Adapter::node_t node_t;
100 typedef typename Adapter::user_t user_t;
101 typedef typename Adapter::userCoord_t userCoord_t;
102 typedef StridedData<lno_t, scalar_t> input_t;
103 typedef typename Adapter::offset_t offset_t;
104#endif
105
108
119 CommGraphModel(const RCP<const MatrixAdapter<user_t,userCoord_t> > &/* ia */,
120 const RCP<const Environment> &/* env */, const RCP<const Comm<int> > &/* comm */,
121 const modelFlag_t &modelflags = modelFlag_t())
122 {
123 throw std::runtime_error("CommGraphModel is not implemented for MatrixAdapter yet.");
124 }
125
126 CommGraphModel(const RCP<const GraphAdapter<user_t,userCoord_t> > &ia,
127 const RCP<const Environment> &env, const RCP<const Comm<int> > &comm,
128 const modelFlag_t &modelflags = modelFlag_t());
129
130 CommGraphModel(const RCP<const MeshAdapter<user_t> > &/* ia */,
131 const RCP<const Environment> &/* env */, const RCP<const Comm<int> > &/* comm */,
132 const modelFlag_t &modelflags = modelFlag_t())
133 {
134 throw std::runtime_error("CommGraphModel is not implemented for MeshAdapter yet.");
135 }
136
137 CommGraphModel(const RCP<const VectorAdapter<userCoord_t> > &/* ia */,
138 const RCP<const Environment> &/* env */, const RCP<const Comm<int> > &/* comm */,
139 const modelFlag_t &modelflags = modelFlag_t())
140 {
141 throw std::runtime_error("cannot build CommGraphModel from VectorAdapter");
142 }
143
144 CommGraphModel(const RCP<const IdentifierAdapter<user_t> > &/* ia */,
145 const RCP<const Environment> &/* env */, const RCP<const Comm<int> > &/* comm */,
146 const modelFlag_t &modelflags = modelFlag_t())
147 {
148 throw std::runtime_error("cannot build GraphModel from IdentifierAdapter");
149 }
150
153 const RCP<const Comm<int> > getComm() { return comm_; }
154
157 size_t getLocalNumVertices() const { return nLocalVertices_; }
158
161 size_t getGlobalNumVertices() const { return nGlobalVertices_; }
162
166 size_t getLocalNumEdges() const { return nLocalEdges_; }
167
171 size_t getGlobalNumEdges() const { return nGlobalEdges_; }
172
175 int getNumWeightsPerVertex() const { return nWeightsPerVertex_; }
176
179 int getNumWeightsPerEdge() const { return nWeightsPerEdge_; }
180
181
190 ArrayView<const gno_t> &Ids,
191 ArrayView<input_t> &wgts) const
192 {
193 Ids = vGids_.view(0, nLocalVertices_);
194 wgts = vWeights_.view(0, nWeightsPerVertex_);
195 return nLocalVertices_;
196 }
197
198 // Implied Vertex LNOs from getVertexList are used as indices to offsets
199 // array.
200 // Vertex GNOs are returned as neighbors in edgeIds.
201
202 size_t getEdgeList( ArrayView<const gno_t> &edgeIds,
203 ArrayView<const offset_t> &offsets,
204 ArrayView<input_t> &wgts) const
205 {
206 edgeIds = eGids_.view(0, nLocalEdges_);
207 offsets = eOffsets_.view(0, nLocalVertices_+1);
208 wgts = eWeights_.view(0, nWeightsPerEdge_);
209 return nLocalEdges_;
210 }
211
216 inline void getVertexDist(ArrayView<size_t> &vtxdist) const
217 {
218 vtxdist = vtxDist_();
219 if (vtxDist_.size() == 0) {
220 throw std::runtime_error("getVertexDist is available only "
221 "when consecutiveIdsRequired");
222 }
223 }
224
226 // The Model interface.
228
229 size_t getLocalNumObjects() const { return nLocalVertices_; }
230
231 size_t getGlobalNumObjects() const { return nGlobalVertices_; }
232
234 // Migration-related functions.
236
237 int getNumActiveRanks() const { return nActiveRanks_; }
238
239 int getDestinationRank() const { return destRank_; }
240
241 int getStartRank() const { return startRank_; }
242
243 int getEndRank() const { return endRank_; }
244
245private:
246
247 void print(); // For debugging
248 void migrateGraph(); // For debugging
249
250 const RCP<const Environment > env_;
251 const RCP<const Comm<int> > comm_;
252
253 int threshold_; // threshold on #vertices each rank stores post-migration
254 int nActiveRanks_ ; // # ranks for the small graph to be partitioned on
255 int destRank_, startRank_, endRank_;
256
257
258 size_t nLocalVertices_; // # local vertices in built graph
259 size_t nGlobalVertices_; // # global vertices in built graph
260 ArrayRCP<gno_t> vGids_; // vertices of graph built in model;
261 // may be same as adapter's input
262 // or may be renumbered 0 to (N-1).
263
264 int nWeightsPerVertex_;
265 ArrayRCP<input_t> vWeights_;
266
267 // Note: in some cases, size of these arrays
268 // may be larger than nLocalEdges_. So do not use .size().
269 // Use nLocalEdges_, nGlobalEdges_
270
271 size_t nLocalEdges_; // # local edges in built graph
272 size_t nGlobalEdges_; // # global edges in built graph
273 ArrayRCP<gno_t> eGids_; // edges of graph built in model
274 ArrayRCP<offset_t> eOffsets_; // edge offsets build in model
275 // May be same as adapter's input
276 // or may differ
277 // due to renumbering, self-edge
278 // removal, or local graph.
279
280 int nWeightsPerEdge_;
281 ArrayRCP<input_t> eWeights_; // edge weights in built graph
282 // May be same as adapter's input
283 // or may differ due to self-edge
284 // removal, or local graph.
285
286 ArrayRCP<size_t> vtxDist_; // If consecutiveIdsRequired,
287 // vtxDist (as needed by ParMETIS
288 // and Scotch) is also created.
289 // Otherwise, it is Teuchos::null.
290};
291
292
294// GraphModel from GraphAdapter
295template <typename Adapter>
297 const RCP<const GraphAdapter<user_t,userCoord_t> > &bia,
298 const RCP<const Environment> &env,
299 const RCP<const Comm<int> > &comm,
300 const modelFlag_t &/* modelflags */):
301 env_(env),
302 comm_(comm),
303 nLocalVertices_(0),
304 nGlobalVertices_(0),
305 vGids_(),
306 nWeightsPerVertex_(0),
307 vWeights_(),
308 nLocalEdges_(0),
309 nGlobalEdges_(0),
310 eGids_(),
311 eOffsets_(),
312 nWeightsPerEdge_(0),
313 eWeights_(),
314 vtxDist_()
315{
316 int commSize = comm_->getSize();
317
318 // Get XpetraCrsGraphAdapter from GraphAdapter
319 RCP<XpetraCrsGraphAdapter<user_t, userCoord_t>> ia;
320 try{
321 RCP<GraphAdapter<user_t, userCoord_t>> tmp =
322 rcp_const_cast<GraphAdapter<user_t, userCoord_t>>(bia);
323 ia = rcp_dynamic_cast<XpetraCrsGraphAdapter<user_t, userCoord_t>>(tmp);
324 }
326
327 // Get the graph from the input adapter
328 auto inGraph = ia->getXpetraGraph();
329
330 // Get the importer of the graph
331 auto imp = inGraph->getImporter();
332
333 // Identify nbor PIDs and number of entries sent per PID
334 std::map<int,double> exportpidmap;
335 auto exportpids = imp->getExportPIDs();
336 size_t nexportpids = imp->getNumExportIDs();
337 for (size_t i = 0; i < nexportpids; i++) {
338 int k = exportpids[i];
339 if (exportpidmap.find(k) != exportpidmap.end())
340 exportpidmap[k] = exportpidmap[k] + 1.;
341 else
342 exportpidmap[k] = 1.;
343 }
344
345 // Set sizes
346 // There is only one vertex in each rank
347 nLocalVertices_ = 1;
348 nLocalEdges_ = exportpidmap.size();
349
350 // Allocate space
351 vGids_ = arcp(new gno_t[nLocalVertices_],
352 0, nLocalVertices_, true);
353 eGids_ = arcp(new gno_t[nLocalEdges_],
354 0, nLocalEdges_, true);
355 eOffsets_ = arcp(new offset_t[nLocalVertices_+1],
356 0, nLocalVertices_+1, true);
357 scalar_t *wgts2 = new scalar_t [nLocalEdges_];
358
359 // Form the vertices
360 vGids_[0] = comm->getRank();
361
362 // Form the edges
363 size_t ptr = 0;
364 eOffsets_[0] = ptr;
365 for (std::map<int,double>::iterator it = exportpidmap.begin();
366 it != exportpidmap.end(); it++) {
367 eGids_[ptr] = it->first;
368 wgts2[ptr++] = it->second;
369 }
370 eOffsets_[nLocalVertices_] = ptr;
371
372 // Edge weights
373 nWeightsPerEdge_ = 1;
374 input_t *wgts = new input_t [nWeightsPerEdge_];
375 eWeights_ = arcp(wgts, 0, nWeightsPerEdge_, true);
376
377 for (int w=0; w < nWeightsPerEdge_; w++){
378 int stride=0;
379 ArrayRCP<const scalar_t> wgtArray = arcp(wgts2, 0, nLocalEdges_, true);
380 eWeights_[w] = input_t(wgtArray, stride);
381 }
382
383 // Vertex weights
384 nWeightsPerVertex_ = 1;
385 input_t *weightInfo = new input_t [nWeightsPerVertex_];
386
387 for (int idx=0; idx < nWeightsPerVertex_; idx++){
388 scalar_t *wgt = new scalar_t [nLocalVertices_];
389 wgt[0] = inGraph->getLocalNumEntries();
390 ArrayRCP<const scalar_t> wgtArray = arcp(wgt, 0, nLocalVertices_, true);
391 weightInfo[idx] = input_t(wgtArray, 1);
392 }
393
394 vWeights_ = arcp<input_t>(weightInfo, 0, nWeightsPerVertex_, true);
395
396 reduceAll<int, size_t>(*comm_, Teuchos::REDUCE_SUM, 1,
397 &nLocalVertices_, &nGlobalVertices_);
398 reduceAll<int, size_t>(*comm_, Teuchos::REDUCE_SUM, 1,
399 &nLocalEdges_, &nGlobalEdges_);
400
401 // Build vtxDist_ array starting with vGid on each rank
402 vtxDist_ = arcp(new size_t[commSize+1], 0, commSize+1, true);
403 vtxDist_[0] = 0;
404 Teuchos::gatherAll(*comm_, 1, &nLocalVertices_, commSize, &vtxDist_[1]);
405 for (int i = 0; i < commSize; i++)
406 vtxDist_[i+1] += vtxDist_[i];
407
408 // Migrate the quotient graph into smaller number of MPI ranks (active ranks)
409 migrateGraph();
410}
411
412template <typename Adapter>
414{
415
416 // Set default threshold for migration
417 threshold_ = 1024;
418
419 // Check if the user set the threshold value
420 const ParameterList &pl = env_->getParameters();
421 const Teuchos::ParameterEntry *pe = pl.getEntryPtr("quotient_threshold");
422 if (pe)
423 threshold_ = pe->getValue<int>(&threshold_);
424
425 // Compute the sizes of/in the new distribution
426 nActiveRanks_ = std::ceil((double) nGlobalVertices_ / threshold_);
427 size_t avgVertexShare = nGlobalVertices_ / nActiveRanks_;
428 size_t myVertexShare = 0;
429
430 int me = comm_->getRank();
431 int commSize = comm_->getSize();
432
433 // Save the original pointers
434 ArrayRCP<offset_t> old_eOffsets_ = eOffsets_;
435 ArrayRCP<gno_t> old_eGids_ = eGids_;
436 size_t old_nLocalEdges_ = nLocalEdges_;
437 ArrayRCP<input_t> old_vWeights_ = vWeights_;
438 ArrayRCP<input_t> old_eWeights_ = eWeights_;
439
440 // Compute whom to send to
441 destRank_ = me / (int) avgVertexShare;
442 if(destRank_ >= nActiveRanks_)
443 destRank_ = nActiveRanks_ - 1;
444
445 // Start with sending the size of the edge list
446 RCP<CommRequest<int>> *requests;
447 if(me < nActiveRanks_) {
448
449 // Determine the range of ranks to receive edges from
450 // Needs to be updated when chunks are introduced
451 startRank_ = me * static_cast<int>(avgVertexShare);
452 endRank_ = (me+1) * static_cast<int>(avgVertexShare);
453 if(me == nActiveRanks_ - 1 ) // Last rank gets the surplus
454 endRank_ = static_cast<int>(nGlobalVertices_);
455 myVertexShare = endRank_ - startRank_;
456
457 eOffsets_ = arcp(new offset_t[myVertexShare+1], 0, myVertexShare+1, true);
458 eOffsets_[0] = 0;
459
460 // Receive the sizes of their edge list
461 requests = new RCP<CommRequest<int>>[myVertexShare];
462 for(int i = startRank_; i < endRank_; i++) {
463 requests[i-startRank_] = Teuchos::ireceive<int, offset_t>(*comm_,
464 arcp(&eOffsets_[i-startRank_+1], 0, 1, false),
465 i);
466 }
467
468 // Send adjacency size even though this rank will remain active
469 Teuchos::send<int, offset_t>(*comm_, 1, &old_eOffsets_[nLocalVertices_], destRank_);
470
471 // Wait
472 Teuchos::waitAll<int>(*comm_, Teuchos::arrayView(requests, myVertexShare));
473
474 // Prefix sum over the offsets
475 for(size_t i = 1; i <= myVertexShare; i++)
476 eOffsets_[i] += eOffsets_[i-1];
477
478 // Recompute the number of local edges
479 nLocalEdges_ = eOffsets_[myVertexShare];
480
481 // Reallocate the adjacency array
482 eGids_ = arcp(new gno_t[nLocalEdges_], 0, nLocalEdges_, true);
483
484
485 // Receive the adjacency lists
486 for(int i = startRank_; i < endRank_; i++) {
487 offset_t adjStartRank_ = eOffsets_[i-startRank_];
488 offset_t adjSize = eOffsets_[i-startRank_+1] - adjStartRank_;
489 requests[i-startRank_] = Teuchos::ireceive<int, gno_t>(*comm_,
490 arcp(&eGids_[adjStartRank_], 0, adjSize, false),
491 i);
492 }
493
494 // Send adjacency even though this rank will remain active
495 Teuchos::send<int, gno_t>(*comm_, old_nLocalEdges_, &old_eGids_[0], destRank_);
496 Teuchos::waitAll<int>(*comm_, Teuchos::arrayView(requests, myVertexShare));
497
498
499 // Migrate vertex weights arrays
500 scalar_t *wgts = new scalar_t [myVertexShare];
501 for(int i = startRank_; i < endRank_; i++) {
502 requests[i-startRank_] = Teuchos::ireceive<int, scalar_t>(*comm_,
503 arcp(&wgts[i-startRank_], 0, 1, false), // assumes one vertex per rank
504 i);
505 }
506
507 const scalar_t *wPtr;
508 size_t wLen = 0;
509 int stride = 0;
510 old_vWeights_[0].getStridedList(wLen, wPtr, stride);
511 Teuchos::send<int, scalar_t>(*comm_, nLocalVertices_, wPtr, destRank_);
512
513 Teuchos::waitAll<int>(*comm_, Teuchos::arrayView(requests, myVertexShare));
514
515 input_t *weightInfo = new input_t [nWeightsPerVertex_];
516 for (int idx=0; idx < nWeightsPerVertex_; idx++){
517 ArrayRCP<const scalar_t> wgtArray = arcp(wgts, 0, myVertexShare, true);
518 weightInfo[idx] = input_t(wgtArray, 1);
519 }
520 vWeights_ = arcp<input_t>(weightInfo, 0, nWeightsPerVertex_, true);
521
522 // Migrate edge weights arrays
523 scalar_t *ewgts = new scalar_t [nLocalEdges_];
524 for(int i = startRank_; i < endRank_; i++) {
525 offset_t adjStartRank_ = eOffsets_[i-startRank_];
526 offset_t adjSize = eOffsets_[i-startRank_+1] - adjStartRank_;
527 requests[i-startRank_] = Teuchos::ireceive<int, scalar_t>(*comm_,
528 arcp(&ewgts[adjStartRank_], 0, adjSize, false), // assumes one vertex per rank
529 i);
530 }
531
532 old_eWeights_[0].getStridedList(wLen, wPtr, stride);
533 Teuchos::send<int, scalar_t>(*comm_, old_nLocalEdges_, wPtr, destRank_);
534
535 Teuchos::waitAll<int>(*comm_, Teuchos::arrayView(requests, myVertexShare));
536
537 input_t *eweightInfo = new input_t [nWeightsPerEdge_];
538 for (int idx=0; idx < nWeightsPerEdge_; idx++){
539 ArrayRCP<const scalar_t> ewgtArray = arcp(ewgts, 0, nLocalEdges_, true);
540 eweightInfo[idx] = input_t(ewgtArray, 1);
541 }
542 eWeights_ = arcp<input_t>(eweightInfo, 0, nWeightsPerEdge_, true);
543
544
545 // Finalize the migration
546 vGids_ = arcp(new gno_t[myVertexShare], 0, myVertexShare, true);
547 for(int i = startRank_; i < endRank_; i++)
548 vGids_[i-startRank_] = i;
549
550 nLocalVertices_ = myVertexShare;
551
552
553 }
554 else {
555
556 // Send adjacency size
557 Teuchos::send<int, offset_t>(*comm_, 1, &eOffsets_[nLocalVertices_], destRank_);
558
559 // Send adjacency list
560 Teuchos::send<int, gno_t>(*comm_, nLocalEdges_, &eGids_[0], destRank_);
561
562 // Send vertex weights list
563 const scalar_t *wPtr;
564 size_t wLen = 0;
565 int stride = 0;
566 vWeights_[0].getStridedList(wLen, wPtr, stride);
567 Teuchos::send<int, scalar_t>(*comm_, nLocalVertices_, wPtr, destRank_);
568
569 // Send edge weights list
570 eWeights_[0].getStridedList(wLen, wPtr, stride);
571 Teuchos::send<int, scalar_t>(*comm_, nLocalEdges_, wPtr, destRank_);
572
573 nLocalVertices_ = 0;
574 }
575
576 for (int i = 0; i <= commSize; i++)
577 vtxDist_[i] = 0;
578
579 Teuchos::gatherAll(*comm_, 1, &nLocalVertices_, commSize, &vtxDist_[1]);
580 for (int i = 0; i < commSize; i++)
581 vtxDist_[i+1] += vtxDist_[i];
582
583}
584
586template <typename Adapter>
587void CommGraphModel<Adapter>::print()
588{
589 std::ostream *os = env_->getDebugOStream();
590
591 int me = comm_->getRank();
592
593 *os << me
594 << " Nvtx " << nLocalVertices_
595 << " Nedge " << nLocalEdges_
596 << " NVWgt " << nWeightsPerVertex_
597 << " NEWgt " << nWeightsPerEdge_
598 << std::endl;
599
600 for (size_t i = 0; i < nLocalVertices_; i++) {
601 *os << me << " " << i << " GID " << vGids_[i] << ": ";
602 for (offset_t j = eOffsets_[i]; j < eOffsets_[i+1]; j++)
603 *os << eGids_[j] << " " ;
604 *os << std::endl;
605 }
606
607 if (nWeightsPerVertex_) {
608 for (size_t i = 0; i < nLocalVertices_; i++) {
609 *os << me << " " << i << " VWGTS " << vGids_[i] << ": ";
610 for (int j = 0; j < nWeightsPerVertex_; j++)
611 *os << vWeights_[j][i] << " ";
612 *os << std::endl;
613 }
614 }
615
616 if (nWeightsPerEdge_) {
617 for (size_t i = 0; i < nLocalVertices_; i++) {
618 *os << me << " " << i << " EWGTS " << vGids_[i] << ": ";
619 for (offset_t j = eOffsets_[i]; j < eOffsets_[i+1]; j++) {
620 *os << eGids_[j] << " (";
621 for (int w = 0; w < nWeightsPerEdge_; w++)
622 *os << eWeights_[w][j] << " ";
623 *os << ") ";
624 }
625 *os << std::endl;
626 }
627 }
628
629}
630
631} // namespace Zoltan2
632
633
634#endif
635
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t
Definition Metric.cpp:74
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
Defines the GraphAdapter interface.
Defines the IdentifierAdapter interface.
Traits for application input objects.
Defines the MatrixAdapter interface.
Defines the MeshAdapter interface.
Defines helper functions for use in the models.
Defines the Model interface.
This file defines the StridedData class.
Defines the VectorAdapter interface.
Defines XpetraCrsGraphAdapter class.
CommGraphModel defines the interface required for communication graph.
size_t getVertexList(ArrayView< const gno_t > &Ids, ArrayView< input_t > &wgts) const
Sets pointers to this process' vertex Ids and their weights.
size_t getGlobalNumEdges() const
Returns the global number edges. For local graphs, the number of global edges is the number of local ...
size_t getGlobalNumObjects() const
Return the global number of objects.
size_t getLocalNumEdges() const
Returns the number of edges on this process. In global or subset graphs, includes off-process edges.
size_t getLocalNumVertices() const
Returns the number vertices on this process.
int getNumWeightsPerEdge() const
Returns the number (0 or greater) of weights per edge.
CommGraphModel(const RCP< const MatrixAdapter< user_t, userCoord_t > > &, const RCP< const Environment > &, const RCP< const Comm< int > > &, const modelFlag_t &modelflags=modelFlag_t())
Constructor.
CommGraphModel(const RCP< const MeshAdapter< user_t > > &, const RCP< const Environment > &, const RCP< const Comm< int > > &, const modelFlag_t &modelflags=modelFlag_t())
void getVertexDist(ArrayView< size_t > &vtxdist) const
Return the vtxDist array Array of size comm->getSize() + 1 Array[n+1] - Array[n] is number of vertice...
const RCP< const Comm< int > > getComm()
Return the communicator used by the model.
CommGraphModel(const RCP< const VectorAdapter< userCoord_t > > &, const RCP< const Environment > &, const RCP< const Comm< int > > &, const modelFlag_t &modelflags=modelFlag_t())
CommGraphModel(const RCP< const IdentifierAdapter< user_t > > &, const RCP< const Environment > &, const RCP< const Comm< int > > &, const modelFlag_t &modelflags=modelFlag_t())
size_t getGlobalNumVertices() const
Returns the global number vertices.
int getNumWeightsPerVertex() const
Returns the number (0 or greater) of weights per vertex.
size_t getLocalNumObjects() const
Return the local number of objects.
size_t getEdgeList(ArrayView< const gno_t > &edgeIds, ArrayView< const offset_t > &offsets, ArrayView< input_t > &wgts) const
The base class for all model classes.
map_t::local_ordinal_type lno_t
map_t::global_ordinal_type gno_t
Created by mbenlioglu on Aug 31, 2020.
std::bitset< NUM_MODEL_FLAGS > modelFlag_t