-
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.
To control 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 edge type that needs balancing
input->addPriority(edge_type,imbalance_tol);
engpar::balance(input,verbosity);
The addPriority function allows you to specify what level each edge type should be balanced. Multiple calls to the function will cause EnGPar to balance the different edge types in the order the calls are given. Passing edge_type equal to -1 will add the graph vertices to the list.
The second argument to createDiffusiveInput, stepFactor, controls how much
weight can be sent in a single iteration; the lower the value the less weight can be moved. A good starting value is 0.1. The verbosity argument specifies 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.
When using the FORTRAN interface the general balancer can be called as follows:
// FORTRAN
type(c_ptr) :: graph, diffusiveInput
real(C_DOUBLE) :: tol, stepfactor
integer :: verbosity
...
tol=1.05 ! target a 5% imbalance
stepfactor=0.1 ! a good value to start with
verbosity=1 ! print some additional output
diffusiveInput = cengpar_createDiffusiveInput(graph,stepFactor)
call cengpar_addPriority(diffusiveInput,edge_type,tol)
call cengpar_balance(diffusiveInput,verbosity);
For details of the FORTRAN interface see engpar.f90.
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