-
Notifications
You must be signed in to change notification settings - Fork 6
Improving an Existing Partition
#include <engpar.h>
#include <engpar_input.h>
To use EnGPar's different algorithms, first the application must construct an N-graph from the user's data. To do this see Constructing the N-graph.
The general way to run EnGPar's load balancing procedures is in the following form:
// C++
agi::Balancer* balancer = engpar::callToBalancer(...)
balancer->balance(tolerance)
If the goal is to balance out the vertices of the graph one can use the following function to construct a balancer that does so:
agi::Balancer* engpar::makeVtxBalancer(agi::Ngraph* g,
double stepFactor=0.1,
int verbosity=0);
The first argument, g, is the graph. The second, stepFactor, controls how much
weight can be sent in a single iteration, and the final, verbosity, is the level
of output provided by EnGPar; the higher the value the more output. Note that
higher levels of verbosity can increase computation and communication costs.
To have more control over how EnGPar balances the graph a general balancer can be constructed with the following calls:
engpar::Input* input = engpar::createDiffusiveInput(graph,stepFactor);
//Add a priority for each dimension that needs balancing
input->addPriority(edge_type,imbalance_tol);
agi::Balancer balancer = makeBalancer(input,verbosity);
The addPriority function allows you to specify what level each dimension should be balanced. Multiple calls to the function will cause EnGPar to balance the different dimensions in the order the calls are given. Passing an edge_type of -1 to the function will add the graph vertices as a priority.
When using the FORTRAN interface, graph vertices can be balanced with the following call:
// FORTRAN
call cengpar_balanceVertices(graph, tol, stepfactor, verbosity);
Once the N-graph is balanced, the user data can be repartitioned using a partition map provided by the N-graph. To do this see Retrieving the Partition.
A FORTRAN example which loads one of our graph files, increases the part count via parmetis, and then runs the balancer:
https://github.com/SCOREC/EnGPar/blob/master/test/splitAndBalance.f90