Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MetisWrapper.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* MetisWrapper.h (C) 2000-2024 */
9/* */
10/* Wrapper around Parmetis calls. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_STD_METISWRAPPER
13#define ARCANE_STD_METISWRAPPER
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18
19#include <parmetis.h>
20#include <functional>
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27class MetisGraphView;
28class IParallelMng;
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
35class MetisWrapper
36: public TraceAccessor
37{
38 private:
39
40 using MetisCall = std::function<int(IParallelMng* pm, MetisGraphView graph,
41 ArrayView<idx_t> vtxdist)>;
42
43 public:
44
45 explicit MetisWrapper(IParallelMng* pm);
46
47 public:
48
56 int callPartKway(const bool print_digest, const bool gather,
57 idx_t* vtxdist, idx_t* xadj, idx_t* adjncy, idx_t* vwgt,
58 idx_t* adjwgt, idx_t* wgtflag, idx_t* numflag, idx_t* ncon, idx_t* nparts,
59 real_t* tpwgts, real_t* ubvec, idx_t* options, idx_t* edgecut, idx_t* part);
60
68 int callAdaptiveRepart(const bool print_digest, const bool gather,
69 idx_t* vtxdist, idx_t* xadj, idx_t* adjncy, idx_t* vwgt,
70 idx_t* vsize, idx_t* adjwgt, idx_t* wgtflag, idx_t* numflag, idx_t* ncon,
71 idx_t* nparts, real_t* tpwgts, real_t* ubvec, real_t* ipc2redist,
72 idx_t* options, idx_t* edgecut, idx_t* part);
73
74 private:
75
76 IParallelMng* m_parallel_mng = nullptr;
77
78 private:
79
80 int _callMetisWith2Processors(const Int32 ncon, const bool need_part,
81 ConstArrayView<idx_t> vtxdist, MetisGraphView my_graph,
82 MetisCall& metis);
83};
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
88} // End namespace Arcane
89
90/*---------------------------------------------------------------------------*/
91/*---------------------------------------------------------------------------*/
92
93#endif
Modifiable view of an array of type T.
Constant view of an array of type T.
Interface of the parallelism manager for a subdomain.
int callPartKway(const bool print_digest, const bool gather, idx_t *vtxdist, idx_t *xadj, idx_t *adjncy, idx_t *vwgt, idx_t *adjwgt, idx_t *wgtflag, idx_t *numflag, idx_t *ncon, idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, idx_t *edgecut, idx_t *part)
Simple wrapper around the ParMetis routine "ParMETIS_V3_PartKway".
int callAdaptiveRepart(const bool print_digest, const bool gather, idx_t *vtxdist, idx_t *xadj, idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, idx_t *wgtflag, idx_t *numflag, idx_t *ncon, idx_t *nparts, real_t *tpwgts, real_t *ubvec, real_t *ipc2redist, idx_t *options, idx_t *edgecut, idx_t *part)
Simple wrapper around the ParMetis routine "ParMETIS_V3_AdaptiveRepart".
int _callMetisWith2Processors(const Int32 ncon, const bool need_part, ConstArrayView< idx_t > vtxdist, MetisGraphView my_graph, MetisCall &metis)
Calls Metis by grouping the graph onto 2 processors.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int32_t Int32
Signed integer type of 32 bits.