OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
Parmetis< Graph > Class Template Reference

Helper class to define Metis graph. More...

Detailed Description

template<typename Graph>
class Parmetis< Graph >

Helper class to define Metis graph.

Template Parameters
graphstructure that store the graph

Definition at line 99 of file parmetis_util.hpp.

#include <parmetis_util.hpp>

Public Member Functions

 Parmetis (Vcluster<> &v_cl, size_t nc)
 Constructor.
 
 ~Parmetis ()
 destructor
 
void initSubGraph (Graph &g, const openfpm::vector< rid > &vtxdist, const std::unordered_map< rid, gid > &m2g, bool w)
 Set the Sub-graph.
 
void decompose (const openfpm::vector< rid > &vtxdist)
 Decompose the graph.
 
void refine (openfpm::vector< rid > &vtxdist)
 Refine the graph.
 
void redecompose (openfpm::vector< rid > &vtxdist)
 Redecompose the graph.
 
idx_t * getPartition ()
 Get graph partition vector.
 
void reset (Graph &g, const openfpm::vector< rid > &vtxdist, const std::unordered_map< rid, gid > &m2g, bool vgw)
 Reset graph and reconstruct it.
 
void setDefaultParameters (bool w)
 Seth the default parameters for parmetis.
 
const Parmetis< Graph > & operator= (const Parmetis< Graph > &pm)
 Copy the object.
 
const Parmetis< Graph > & operator= (Parmetis< Graph > &&pm)
 Copy the object.
 
size_t get_ndec ()
 Get the decomposition counter.
 
void setDistTol (real_t tol)
 Distribution tolerance.
 

Private Member Functions

void constructAdjList (Graph &g, const std::unordered_map< rid, gid > &m2g)
 Construct Adjacency list.
 

Private Attributes

Parmetis_graph Mg
 Graph in metis reppresentation.
 
MPI_Comm comm = (MPI_Comm)NULL
 Communticator for OpenMPI.
 
Vclusterv_cl
 VCluster.
 
int p_id = 0
 Process rank information.
 
size_t nc = 0
 nc Number of partition
 
rid first
 first re-mapped id
 
rid last
 last re-mapped id
 
size_t nvertex
 number of vertices that the processor has
 
size_t n_dec
 indicate how many time decompose/refine/re-decompose has been called
 
real_t dist_tol = 1.05
 Distribution tolerance.
 

Constructor & Destructor Documentation

◆ Parmetis()

template<typename Graph >
Parmetis< Graph >::Parmetis ( Vcluster<> &  v_cl,
size_t  nc 
)
inline

Constructor.

Construct a metis graph from Graph_CSR

Parameters
v_clVcluster object
ncnumber of partitions

Definition at line 225 of file parmetis_util.hpp.

◆ ~Parmetis()

template<typename Graph >
Parmetis< Graph >::~Parmetis ( )
inline

destructor

Destructor, It destroy all the memory allocated

Definition at line 269 of file parmetis_util.hpp.

Member Function Documentation

◆ constructAdjList()

template<typename Graph >
void Parmetis< Graph >::constructAdjList ( Graph &  g,
const std::unordered_map< rid, gid > &  m2g 
)
inlineprivate

Construct Adjacency list.

Parameters
gGlobal graph
m2gmap from local index to global index

starting point in the adjacency list

Definition at line 140 of file parmetis_util.hpp.

◆ decompose()

template<typename Graph >
void Parmetis< Graph >::decompose ( const openfpm::vector< rid > &  vtxdist)
inline

Decompose the graph.

Template Parameters
iwhich property store the decomposition

Definition at line 391 of file parmetis_util.hpp.

◆ get_ndec()

template<typename Graph >
size_t Parmetis< Graph >::get_ndec ( )
inline

Get the decomposition counter.

Returns
the decomposition counter

Definition at line 594 of file parmetis_util.hpp.

◆ getPartition()

template<typename Graph >
idx_t * Parmetis< Graph >::getPartition ( )
inline

Get graph partition vector.

Definition at line 429 of file parmetis_util.hpp.

◆ initSubGraph()

template<typename Graph >
void Parmetis< Graph >::initSubGraph ( Graph &  g,
const openfpm::vector< rid > &  vtxdist,
const std::unordered_map< rid, gid > &  m2g,
bool  w 
)
inline

Set the Sub-graph.

Parameters
gGlobal graph to set
vtxdistindicate how the vertex of the graph are distrubuted across processors.
m2gmap the local ids of the vertex into global-ids
wtrue if vertices have weights

Definition at line 369 of file parmetis_util.hpp.

◆ operator=() [1/2]

template<typename Graph >
const Parmetis< Graph > & Parmetis< Graph >::operator= ( const Parmetis< Graph > &  pm)
inline

Copy the object.

Parameters
pmobject to copy
Returns
itself

Definition at line 553 of file parmetis_util.hpp.

◆ operator=() [2/2]

template<typename Graph >
const Parmetis< Graph > & Parmetis< Graph >::operator= ( Parmetis< Graph > &&  pm)
inline

Copy the object.

Parameters
pmobject to copy
Returns
itself

Definition at line 574 of file parmetis_util.hpp.

◆ redecompose()

template<typename Graph >
void Parmetis< Graph >::redecompose ( openfpm::vector< rid > &  vtxdist)
inline

Redecompose the graph.

Template Parameters
iwhich property

Definition at line 419 of file parmetis_util.hpp.

◆ refine()

template<typename Graph >
void Parmetis< Graph >::refine ( openfpm::vector< rid > &  vtxdist)
inline

Refine the graph.

Template Parameters
iwhich property store the refined decomposition

Definition at line 405 of file parmetis_util.hpp.

◆ reset()

template<typename Graph >
void Parmetis< Graph >::reset ( Graph &  g,
const openfpm::vector< rid > &  vtxdist,
const std::unordered_map< rid, gid > &  m2g,
bool  vgw 
)
inline

Reset graph and reconstruct it.

Parameters
gGlobal graph
vtxdistDistribution vector
m2gMapped id to global id map
vgwUsing weights on vertices

Definition at line 441 of file parmetis_util.hpp.

◆ setDefaultParameters()

template<typename Graph >
void Parmetis< Graph >::setDefaultParameters ( bool  w)
inline

Seth the default parameters for parmetis.

Set option for the graph partitioning (set as default)

is an output vector containing the partition for each vertex

adaptiveRepart itr value

init tpwgts to have balanced vertices and ubvec

This is used to indicate the numbering scheme that is used for the vtxdist, xadj, adjncy, and part arrays. (0 for C-style, start from 0 index)

This is used to indicate if the graph is weighted. wgtflag can take one of four values:

Definition at line 459 of file parmetis_util.hpp.

◆ setDistTol()

template<typename Graph >
void Parmetis< Graph >::setDistTol ( real_t  tol)
inline

Distribution tolerance.

Parameters
toltolerance

Definition at line 604 of file parmetis_util.hpp.

Field Documentation

◆ comm

template<typename Graph >
MPI_Comm Parmetis< Graph >::comm = (MPI_Comm)NULL
private

Communticator for OpenMPI.

Definition at line 108 of file parmetis_util.hpp.

◆ dist_tol

template<typename Graph >
real_t Parmetis< Graph >::dist_tol = 1.05
private

Distribution tolerance.

Definition at line 132 of file parmetis_util.hpp.

◆ first

template<typename Graph >
rid Parmetis< Graph >::first
private

first re-mapped id

Definition at line 120 of file parmetis_util.hpp.

◆ last

template<typename Graph >
rid Parmetis< Graph >::last
private

last re-mapped id

Definition at line 123 of file parmetis_util.hpp.

◆ Mg

template<typename Graph >
Parmetis_graph Parmetis< Graph >::Mg
private

Graph in metis reppresentation.

Definition at line 102 of file parmetis_util.hpp.

◆ n_dec

template<typename Graph >
size_t Parmetis< Graph >::n_dec
private

indicate how many time decompose/refine/re-decompose has been called

Definition at line 129 of file parmetis_util.hpp.

◆ nc

template<typename Graph >
size_t Parmetis< Graph >::nc = 0
private

nc Number of partition

Definition at line 117 of file parmetis_util.hpp.

◆ nvertex

template<typename Graph >
size_t Parmetis< Graph >::nvertex
private

number of vertices that the processor has

Definition at line 126 of file parmetis_util.hpp.

◆ p_id

template<typename Graph >
int Parmetis< Graph >::p_id = 0
private

Process rank information.

Definition at line 114 of file parmetis_util.hpp.

◆ v_cl

template<typename Graph >
Vcluster& Parmetis< Graph >::v_cl
private

VCluster.

Definition at line 111 of file parmetis_util.hpp.


The documentation for this class was generated from the following file: