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_V3_NodeND computes a fill-reducing ordering of a distributed sparse symmetric matrix using parallel nested dissection. The ordering permutes the rows and columns of the matrix to minimize fill during sparse factorization (e.g., Cholesky or LU). The function returns both the permutation vector and the sizes of the separators in the nested dissection tree, which can be used to schedule the factorization on multiple processors.
int ParMETIS_V3_NodeND(
    idx_t *vtxdist, idx_t *xadj, idx_t *adjncy, idx_t *numflag,
    idx_t *options, idx_t *order, idx_t *sizes, MPI_Comm *comm);

Parameters

vtxdist
idx_t*
Distribution of vertices (matrix rows/columns) 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. Represents the sparsity pattern of the local rows of the matrix. Size local_nvtxs + 1.
adjncy
idx_t*
Local adjacency column indices in CSR format. Size xadj[local_nvtxs].
numflag
idx_t*
Indexing convention. 0 for C-style 0-based indexing; 1 for Fortran-style 1-based indexing.
options
idx_t*
Algorithm options. If options[0] = 0, all defaults are used. If options[0] = 1, options[PMV3_OPTION_DBGLVL] (index 1) sets the debug level and options[PMV3_OPTION_SEED] (index 2) sets the random seed.
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, where total_nvtxs = vtxdist[npes].
sizes
idx_t*
Output. Separator sizes for the nested dissection tree. Array of size 2 * npes. Describes the number of vertices in each separator and subgraph of the dissection tree, enabling the caller to schedule parallel factorization.
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 options[3] = {0, 0, 0};

    idx_t order[total_nvtxs];     /* permutation, size = total vertices */
    idx_t sizes[2 * npes];        /* separator tree sizes */

    int ret = ParMETIS_V3_NodeND(
        vtxdist, xadj, adjncy,
        &numflag, options,
        order, sizes, &comm);

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

    MPI_Finalize();
    return 0;
}

Build docs developers (and LLMs) love