-
Notifications
You must be signed in to change notification settings - Fork 6
Retrieving the Partition
After balancing the graph the resulting assignment of graph vertices to processors can be retrieved using the following call:
// C++
agi::PartitionMap* map = g->getPartition();
In C++, the returned PartitionMap
maps from the vertex global ids to
the communicator rank that they should be assigned.
Every vertex that originally belonged on a part before partitioning will have an
entry in the map.
The PartitionMap
structure supports two methods of access. The first provides an
iterator to access the pairs of vertex global id to part info. This works well for
application data that supports random access via global id.
agi::PartitionMap::iterator itr;
for (itr=map->begin();itr!=map->end();itr++) {
agi::gid_t gid = itr->first;
int new_owner = itr->second;
...
}
The second method supports random access to the part assignment given the global id.
for(each data representing Ngraph vertices) {
//get gid of the data entry
int new_owner = map->at(data);
...
}
In FORTRAN,
// FORTRAN
call cengpar_getPartition(graph, verts, parts, nverts)
returns the list of global vertex ids, verts
, their new process assignment, parts
, and the size of these two arrays, nverts
, which is equal to the number of owned vertices on the calling process.