Isorropia: Partitioning, Load Balancing and more
|
#include <Isorropia_EpetraCostDescriber.hpp>
Public Member Functions | |
CostDescriber () | |
Constructor. More... | |
~CostDescriber () | |
Destructor. More... | |
CostDescriber (const CostDescriber &costs) | |
Copy constructor. More... | |
void | setVertexWeights (Teuchos::RCP< const Epetra_Vector > vwgts) |
setVertexWeights is called by a process to supply the weight of each vertex (row) in the graph or hypergraph. More... | |
void | setGraphEdgeWeights (Teuchos::RCP< const Epetra_CrsMatrix > gewts) |
setGraphEdgeWeights is called by a process to supply the weights for each of the edges of its vertices. More... | |
void | setHypergraphEdgeWeights (Teuchos::RCP< const Epetra_Vector > hgewts) |
setHypergraphEdgeWeights is called by processes in an application to supply weights for the hyperedges, which are represented by the columns of the matrix. More... | |
void | setHypergraphEdgeWeights (int numHGedges, const int *hgGIDs, const float *hgEwgts) |
setHypergraphEdgeWeights is called by processes in an application to supply weights for the hyperedges, which are represented by the columns of the matrix. More... | |
void | setHypergraphEdgeWeights (int numHGedges, const int *hgGIDs, const double *hgEwgts) |
setHypergraphEdgeWeights is called by processes in an application to supply weights for the hyperedges, which are represented by the columns of the matrix. More... | |
void | getCosts (std::map< int, float > &vertexWeights, std::map< int, std::map< int, float > > &graphEdgeWeights, std::map< int, float > &hypergraphEdgeWeights) const |
Get the contents of this CostDescriber. More... | |
void | show_cd (std::ostream &) const |
Print out the contents of this CostDescriber. More... | |
Private Member Functions | |
void | _transformWeights (const Epetra_Import &importer) |
int | _compareBeforeAndAfterGraph (const Epetra_RowMatrix *in_m, const Epetra_RowMatrix *out_m, const Epetra_CrsGraph *in_g, const Epetra_CrsGraph *out_g, const Epetra_Import &importer, std::vector< double > &balance, std::vector< int > &numCuts, std::vector< double > &cutWgt, std::vector< double > &cutn, std::vector< double > &cutl) const |
void | setParameters (const Teuchos::ParameterList ¶mlist) |
Set parameters for the CostDescriber instance. More... | |
bool | haveVertexWeights () const |
Query whether vertex weights have been supplied by the application. More... | |
int | getNumVertices () const |
Get the number of vertices for which this process supplied vertex weights. More... | |
void | getVertexWeights (int numVertices, int *global_ids, float *weights) const |
Get lists of the vertex ids and weights supplied by this process. More... | |
bool | haveGraphEdgeWeights () const |
Query whether graph edge weights have been supplied by the application. More... | |
int | getNumGraphEdges (int vertex_global_id) const |
Get the number of graph edges for a specified vertex. More... | |
int | getGraphEdgeVertices (std::set< int > &gids) const |
Get the set of global IDs for the vertices that we have edge information for. More... | |
void | getGraphEdgeWeights (int vertex_global_id, int num_neighbors, int *neighbor_global_ids, float *weights) const |
Get the graph edge weights for a specified vertex. More... | |
bool | haveHypergraphEdgeWeights () const |
Query whether hypergraph edge weights have been supplied by the application. More... | |
int | getNumHypergraphEdgeWeights () const |
Get the number of Hypergraph edges. More... | |
void | getHypergraphEdgeWeights (int numEdges, int *global_ids, float *weights) const |
Get the hypergraph edge weights that were supplied by this process. More... | |
int | getHypergraphEdgeWeights (std::map< int, float > &wgtMap) const |
Return the CostDescribers hypergraph edge weights as a map from hyperedge (column) global ID to weight. More... | |
int | getVertexWeights (std::map< int, float > &wgtMap) const |
Get vertex weights in the form of a map from vertex global ID to vertex weight. More... | |
const Epetra_Vector & | getVertexWeights () |
int | getGraphEdgeWeights (int vertex_global_id, std::map< int, float > &wgtMap) const |
getGraphEdgeWeights is called to obtain the graph edge weights for a given vertex (row). More... | |
bool | haveGlobalVertexWeights () const |
haveGlobalVertexWeights returns true if any process in the application has supplied vertex weights, it returns false otherwise. More... | |
void | setNumGlobalVertexWeights (int num) |
setNumGlobalVertexWeights may be used to set the count of the global number of vertex weights supplied to the CostDescriber More... | |
bool | haveGlobalGraphEdgeWeights () const |
haveGlobalGraphEdgeWeights returns true if any process in the application has supplied graph edge weights, it returns false otherwise. More... | |
void | setNumGlobalGraphEdgeWeights (int num) |
setNumGlobalGraphEdgeWeights may be used to set the count of the global number of graph edge weights supplied to the CostDescriber More... | |
bool | haveGlobalHypergraphEdgeWeights () const |
haveGlobalHypergraphEdgeWeights returns true if any process in the application has supplied hyperedge weights, it returns false otherwise. More... | |
void | setNumGlobalHypergraphEdgeWeights (int num) |
setNumGlobalHypergraphEdgeWeights may be used to set the count of the global number of hyperedge weights supplied to the CostDescriber More... | |
void | allocate_hg_edge_weights_ (int n) |
Dynamically allocate storage for hypergraph edge weights. More... | |
void | free_hg_edge_weights_ () |
Free storage used by hypergraph edge weights. More... | |
int | getEdges (int vertexGID, int len, int *nborGID, float *weights) const |
getEdges creates an array of the neighbors and edge weights for given vertex. More... | |
Private Attributes | |
Teuchos::RCP< const Epetra_Vector > | vertex_weights_ |
Teuchos::RCP< const Epetra_CrsMatrix > | graph_edge_weights_ |
std::set< int > | graph_self_edges_ |
Teuchos::ParameterList | paramlist_ |
int * | hg_edge_gids_ |
float * | hg_edge_weights_ |
int | num_hg_edge_weights_ |
int | numGlobalVertexWeights_ |
int | numGlobalGraphEdgeWeights_ |
int | numGlobalHypergraphEdgeWeights_ |
Friends | |
class | Isorropia::Operator |
class | Isorropia::Epetra::ZoltanLib::QueryObject |
class | Isorropia::Epetra::ZoltanLibClass |
std::ostream & | operator<< (std::ostream &, const Isorropia::Epetra::CostDescriber &cd) |
Overloaded << operator for CostDescriber object. More... | |
Isorropia::Epetra::CostDescriber::CostDescriber | ( | ) |
Constructor.
|
virtual |
Destructor.
Reimplemented from Isorropia::CostDescriber.
Isorropia::Epetra::CostDescriber::CostDescriber | ( | const CostDescriber & | costs | ) |
Copy constructor.
void Isorropia::Epetra::CostDescriber::setVertexWeights | ( | Teuchos::RCP< const Epetra_Vector > | vwgts | ) |
setVertexWeights is called by a process to supply the weight of each vertex (row) in the graph or hypergraph.
If the object to be partitioned is instead an Epetra_MultiVector representing real coordinates, then the weights represent the weight assigned to each coordinate.
[in] | vwgts | vector of weights, one for each vertex |
void Isorropia::Epetra::CostDescriber::setGraphEdgeWeights | ( | Teuchos::RCP< const Epetra_CrsMatrix > | gewts | ) |
setGraphEdgeWeights is called by a process to supply the weights for each of the edges of its vertices.
An edge corresponds to a non-zero in the row representing the vertex.
This method is called only when performing graph partitioning with a square symmetric matrix. For hypergraph partitioning call the equivalent hypergraph method.
gewts | an Epetra_CrsMatrix supplied by the application, each non-zero represents a weight for an edge |
void Isorropia::Epetra::CostDescriber::setHypergraphEdgeWeights | ( | Teuchos::RCP< const Epetra_Vector > | hgewts | ) |
setHypergraphEdgeWeights is called by processes in an application to supply weights for the hyperedges, which are represented by the columns of the matrix.
(A hyperedge can in general link more than one vertex.)
Matrices that represent hypergraphs are not in general square. There may be more or fewer hyperedges (columns) than vertices (rows).
hgewts | an Epetra_Vector containing the weights for each hyperedge. |
void Isorropia::Epetra::CostDescriber::setHypergraphEdgeWeights | ( | int | numHGedges, |
const int * | hgGIDs, | ||
const float * | hgEwgts | ||
) |
setHypergraphEdgeWeights is called by processes in an application to supply weights for the hyperedges, which are represented by the columns of the matrix.
(A hyperedge can in general link more than one vertex.)
Matrices that represent hypergraphs are not in general square. There may be more or fewer hyperedges (columns) than vertices (rows).
More than one process can supply a weight for the same column. (So there is no concept of a process owning a hyperedge.) Zoltan combines these weights according to the setting of the PHG_EDGE_WEIGHT_OPERATION parameter.
numHGedges | the length of the hgGIDs and heEwgts arrays |
hgGIDs | the global ID for each hyperedge this process will supply a weight for |
hgEwgts | the hyperedge weight corresponding to each hyperedge listed in hgGIDs |
void Isorropia::Epetra::CostDescriber::setHypergraphEdgeWeights | ( | int | numHGedges, |
const int * | hgGIDs, | ||
const double * | hgEwgts | ||
) |
setHypergraphEdgeWeights is called by processes in an application to supply weights for the hyperedges, which are represented by the columns of the matrix.
(A hyperedge can in general link more than one vertex.)
Matrices that represent hypergraphs are not in general square. There may be more or fewer hyperedges (columns) than vertices (rows).
More than one process can supply a weight for the same column. (So there is no concept of a process owning a hyperedge.) Zoltan combines these weights according to the setting of the PHG_EDGE_WEIGHT_OPERATION parameter.
numHGedges | the length of the hgGIDs and heEwgts arrays |
hgGIDs | the global ID for each hyperedge this process will supply a weight for |
hgEwgts | the hyperedge weight corresponding to each hyperedge listed in hgGIDs |
void Isorropia::Epetra::CostDescriber::getCosts | ( | std::map< int, float > & | vertexWeights, |
std::map< int, std::map< int, float > > & | graphEdgeWeights, | ||
std::map< int, float > & | hypergraphEdgeWeights | ||
) | const |
Get the contents of this CostDescriber.
vertexWeights | is set to a mapping from vertex global IDs to their weights |
graphEdgeWeights | is a mapping from vertex global IDs to a map from neighboring IDs to edge weights |
hypergraphEdgeWeights | is a mapping from hyperedge (column) global IDs to hyperedge weights |
void Isorropia::Epetra::CostDescriber::show_cd | ( | std::ostream & | ) | const |
Print out the contents of this CostDescriber.
|
private |
|
private |
|
privatevirtual |
Set parameters for the CostDescriber instance.
The contents of the input paramlist object are copied into an internal ParameterList attribute. Instances of this interface should not retain a reference to the input ParameterList after this method returns.
Implements Isorropia::CostDescriber.
|
privatevirtual |
Query whether vertex weights have been supplied by the application.
Implements Isorropia::CostDescriber.
|
privatevirtual |
Get the number of vertices for which this process supplied vertex weights.
Vertices typically correspond to matrix rows.
Implements Isorropia::CostDescriber.
|
privatevirtual |
Get lists of the vertex ids and weights supplied by this process.
numVertices | size of global_ids and weights arrays |
global_ids | pointer to an array of vertex global IDs, allocated by the caller. |
weights | pointer to an array of vertex weights, allocated by the caller. |
Implements Isorropia::CostDescriber.
|
privatevirtual |
Query whether graph edge weights have been supplied by the application.
Implements Isorropia::CostDescriber.
|
privatevirtual |
Get the number of graph edges for a specified vertex.
Graph edges typically correspond to matrix nonzeros.
vertex_global_id | The global ID for the vertex (on this process) for which the number of edges is desired |
Implements Isorropia::CostDescriber.
|
private |
Get the set of global IDs for the vertices that we have edge information for.
gids | will be set to the global IDs of the vertices for which neighbor and edge weight information have been provided |
|
privatevirtual |
Get the graph edge weights for a specified vertex.
vertex_global_id | vertex global ID (on this process) for which edge information is requested |
num_neighbors | size for which neighbor_global_ids and weights had been preallocated |
neighbor_global_ids | buffer allocated by caller, on return will contain a list of neighbor vertex global IDs |
weights | buffer allocated by caller, on return will contain a weight for each edge indicated in neighbor_global_ids |
Implements Isorropia::CostDescriber.
|
privatevirtual |
Query whether hypergraph edge weights have been supplied by the application.
Implements Isorropia::CostDescriber.
|
privatevirtual |
Get the number of Hypergraph edges.
Hypergraph edges typically correspond to matrix columns.
Implements Isorropia::CostDescriber.
|
privatevirtual |
Get the hypergraph edge weights that were supplied by this process.
numEdges | size for which global_ids and weights had been preallocated |
global_ids | buffer allocated by caller, on return will contain a list of hyperedge global IDs |
weights | buffer allocated by caller, on return will contain a weight for each hyperedge indicated in global_ids |
Implements Isorropia::CostDescriber.
|
private |
Return the CostDescribers hypergraph edge weights as a map from hyperedge (column) global ID to weight.
wgtMap | will be set to a map from hyperedge global ID to hyperedge weight |
|
private |
Get vertex weights in the form of a map from vertex global ID to vertex weight.
wgtMap | a map supplied by the caller, the vertex weights will be added to this map |
|
inlineprivate |
|
private |
getGraphEdgeWeights is called to obtain the graph edge weights for a given vertex (row).
vertex_global_id | the global ID of the vertex the caller wants edge weights for |
wgtMap | a map from the global ID of each vertex neighbor to the weight of the edge formed by the vertex and this neighbor |
|
private |
haveGlobalVertexWeights returns true if any process in the application has supplied vertex weights, it returns false otherwise.
|
private |
setNumGlobalVertexWeights may be used to set the count of the global number of vertex weights supplied to the CostDescriber
|
private |
haveGlobalGraphEdgeWeights returns true if any process in the application has supplied graph edge weights, it returns false otherwise.
|
private |
setNumGlobalGraphEdgeWeights may be used to set the count of the global number of graph edge weights supplied to the CostDescriber
|
private |
haveGlobalHypergraphEdgeWeights returns true if any process in the application has supplied hyperedge weights, it returns false otherwise.
|
private |
setNumGlobalHypergraphEdgeWeights may be used to set the count of the global number of hyperedge weights supplied to the CostDescriber
|
private |
Dynamically allocate storage for hypergraph edge weights.
|
private |
Free storage used by hypergraph edge weights.
|
private |
getEdges creates an array of the neighbors and edge weights for given vertex.
Self edges are not included.
vertexGID | the global ID of the vertex (must be one owned by calling process) |
len | of preallocated nborGID and weights arrays |
nborGID | on return contains the global ID of each vertex neighboring vertexGID, allocated by caller |
weights | on return contains the weight for each edge formed by the vertices in nborGID |
|
friend |
|
friend |
|
friend |
|
friend |
Overloaded << operator for CostDescriber object.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |