OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
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. More...
 
 ~Parmetis ()
 destructor More...
 
void initSubGraph (Graph &g, const openfpm::vector< rid > &vtxdist, const std::unordered_map< rid, gid > &m2g, bool w)
 Set the Sub-graph. More...
 
void decompose (const openfpm::vector< rid > &vtxdist)
 Decompose the graph. More...
 
void refine (openfpm::vector< rid > &vtxdist)
 Refine the graph. More...
 
void redecompose (openfpm::vector< rid > &vtxdist)
 Redecompose the graph. More...
 
idx_t * getPartition ()
 Get graph partition vector. More...
 
void reset (Graph &g, const openfpm::vector< rid > &vtxdist, const std::unordered_map< rid, gid > &m2g, bool vgw)
 Reset graph and reconstruct it. More...
 
void setDefaultParameters (bool w)
 Seth the default parameters for parmetis. More...
 
const Parmetis< Graph > & operator= (const Parmetis< Graph > &pm)
 Copy the object. More...
 
const Parmetis< Graph > & operator= (Parmetis< Graph > &&pm)
 Copy the object. More...
 
size_t get_ndec ()
 Get the decomposition counter. More...
 
void setDistTol (real_t tol)
 Distribution tolerance. More...
 

Private Member Functions

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

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

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 213 of file parmetis_util.hpp.

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

destructor

Destructor, It destroy all the memory allocated

Definition at line 257 of file parmetis_util.hpp.

Member Function Documentation

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.

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 366 of file parmetis_util.hpp.

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

Get the decomposition counter.

Returns
the decomposition counter

Definition at line 566 of file parmetis_util.hpp.

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

Get graph partition vector.

Definition at line 404 of file parmetis_util.hpp.

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 342 of file parmetis_util.hpp.

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 527 of file parmetis_util.hpp.

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 547 of file parmetis_util.hpp.

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

Redecompose the graph.

Template Parameters
iwhich property

Definition at line 394 of file parmetis_util.hpp.

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 380 of file parmetis_util.hpp.

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 416 of file parmetis_util.hpp.

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.

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

Distribution tolerance.

Parameters
toltolerance

Definition at line 576 of file parmetis_util.hpp.


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