Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/KarypisLab/ParMETIS/llms.txt

Use this file to discover all available pages before exploring further.

ParMETIS_V32_NodeND is an extended variant of ParMETIS_V3_NodeND that exposes fine-grained control over the nested dissection algorithm. It accepts explicit parameters for matching strategy, separator refinement type, the number of parallel and serial bisection separators to evaluate, load imbalance tolerance, random seed, and debug output level. Use this function when the defaults of ParMETIS_V3_NodeND do not produce the desired ordering quality or reproducibility.
int ParMETIS_V32_NodeND(
    idx_t *vtxdist, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,
    idx_t *numflag, idx_t *mtype, idx_t *rtype, idx_t *p_nseps, idx_t *s_nseps,
    real_t *ubfrac, idx_t *seed, idx_t *dbglvl, idx_t *order,
    idx_t *sizes, MPI_Comm *comm);

Parameters

vtxdist
idx_t*
Distribution of vertices across processes. vtxdist[i] is the global index of the first vertex on process i. Size npes + 1; must be identical on all processes.
xadj
idx_t*
Local adjacency row pointers in CSR format. Size local_nvtxs + 1.
adjncy
idx_t*
Local adjacency column indices in CSR format. Size xadj[local_nvtxs].
vwgt
idx_t*
Vertex weights used for separator balance. One value per vertex. May be NULL to use unit weights.
numflag
idx_t*
Indexing convention. 0 for C-style 0-based indexing; 1 for Fortran-style 1-based indexing.
mtype
idx_t*
Matching type for coarsening. PARMETIS_MTYPE_LOCAL (1) restricts matching to vertices owned by the same process. PARMETIS_MTYPE_GLOBAL (2) allows matching with vertices on remote processes, which can improve coarsening quality at the cost of additional communication.
rtype
idx_t*
Separator refinement type. PARMETIS_SRTYPE_GREEDY (1) refines the separator by visiting vertices from highest to lowest gain. PARMETIS_SRTYPE_2PHASE (2) performs two-phase refinement, using greedy in the second phase, which can produce better separators.
p_nseps
idx_t*
Number of different parallel bisection separators to compute at each level of the nested dissection. The best separator among all trials is selected. Higher values improve separator quality at the cost of increased runtime.
s_nseps
idx_t*
Number of different serial bisection separators to compute when the subgraph is small enough to be processed on a single process. Higher values improve quality at the cost of runtime.
ubfrac
real_t*
Maximum allowed ratio of the larger to the smaller side of each bisection. Controls load imbalance during the nested dissection. For example, 1.05 allows at most a 5% imbalance between the two halves.
seed
idx_t*
Random number seed for reproducibility. Using the same seed on the same graph and communicator produces the same ordering.
dbglvl
idx_t*
Debug output level. Combine PARMETIS_DBGLVL_* constants with bitwise OR. Use 0 for no output. Available flags include PARMETIS_DBGLVL_TIME (1), PARMETIS_DBGLVL_INFO (2), PARMETIS_DBGLVL_PROGRESS (4), PARMETIS_DBGLVL_REFINEINFO (8), and PARMETIS_DBGLVL_MATCHINFO (16).
order
idx_t*
Output. Fill-reducing permutation array. order[i] is the new global index assigned to global vertex i. The caller must allocate this array with at least total_nvtxs elements.
sizes
idx_t*
Output. Separator sizes for the nested dissection tree. Array of size 2 * npes. Describes the vertex counts in each separator and subgraph, enabling parallel factorization scheduling.
comm
MPI_Comm*
Pointer to the MPI communicator covering all participating processes.

Return value

Returns METIS_OK (1) on success. Any other value indicates an error.

Usage example

#include <parmetis.h>

int main(int argc, char *argv[]) {
    MPI_Init(&argc, &argv);
    MPI_Comm comm = MPI_COMM_WORLD;

    int npes, rank;
    MPI_Comm_size(comm, &npes);
    MPI_Comm_rank(comm, &rank);

    idx_t local_nvtxs = 10;
    idx_t vtxdist[npes + 1];
    for (int i = 0; i <= npes; i++) vtxdist[i] = i * local_nvtxs;
    idx_t total_nvtxs = vtxdist[npes];

    idx_t xadj[local_nvtxs + 1];
    idx_t adjncy[/* nnz */];

    idx_t numflag  = 0;
    idx_t mtype    = PARMETIS_MTYPE_GLOBAL;
    idx_t rtype    = PARMETIS_SRTYPE_2PHASE;
    idx_t p_nseps  = 1;   /* try 1 parallel separator per level */
    idx_t s_nseps  = 1;   /* try 1 serial separator per level   */
    real_t ubfrac  = 1.05f;
    idx_t seed     = 42;
    idx_t dbglvl   = 0;   /* no debug output */

    idx_t order[total_nvtxs];
    idx_t sizes[2 * npes];

    int ret = ParMETIS_V32_NodeND(
        vtxdist, xadj, adjncy,
        NULL,           /* no vertex weights */
        &numflag, &mtype, &rtype, &p_nseps, &s_nseps,
        &ubfrac, &seed, &dbglvl,
        order, sizes, &comm);

    if (ret != METIS_OK) { /* handle error */ }

    MPI_Finalize();
    return 0;
}

Build docs developers (and LLMs) love