Skip to main content

Documentation Index

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

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

mpmetis partitions finite element meshes directly, without requiring you to convert them to a graph first. Internally it converts the mesh into either a dual graph (one node per element, edges between adjacent elements) or a nodal graph (one node per mesh node, edges between nodes sharing an element), then partitions that graph. Both an element partition and a node partition are written as output.

Usage

mpmetis [options] meshfile nparts
ArgumentDescription
meshfilePath to the mesh file to be partitioned.
npartsNumber of partitions to produce. Must be ≥ 2.

Dual vs. Nodal Graphs

Understanding the two graph types is key to choosing the right partitioning strategy.

Dual Graph (GTYPE_DUAL)

Each element of the mesh becomes a vertex in the graph. Two vertices are connected by an edge if the corresponding elements share at least ncommon mesh nodes. The resulting element partition (epart) directly tells you which processor each element is assigned to.

Nodal Graph (GTYPE_NODAL)

Each mesh node becomes a vertex in the graph. Two vertices are connected if the corresponding nodes belong to the same element. The resulting node partition (npart) tells you which processor owns each mesh node.
Use the dual graph (default) when your solver assigns work to elements (e.g., finite element assembly). Use the nodal graph when your solver assigns work to nodes (e.g., finite difference or finite volume methods).

Output Files

mpmetis writes two partition files:
FileContents
<meshfile>.epart.<nparts>Element partition: one partition ID per line, one per element.
<meshfile>.npart.<nparts>Node partition: one partition ID per line, one per mesh node.
Both files use 0-based partition IDs.

Examples

# Partition the METIS sample mesh into 4 parts (dual graph, k-way)
mpmetis graphs/metis.mesh 4

Options Reference

Graph Type

gtype
string
default:"dual"
Specifies which graph representation of the mesh to partition.
ValueDescription
dualPartition the dual graph: one vertex per element (default)
nodalPartition the nodal graph: one vertex per mesh node
ncommon
integer
default:"1"
Applies only when -gtype=dual. The minimum number of mesh nodes that two elements must share in order to be connected by an edge in the dual graph. Increasing this threshold produces a sparser dual graph, which can improve partition quality for higher-order elements.
For triangular meshes, ncommon=2 means two triangles must share a full edge. For tetrahedral meshes, ncommon=3 means two tetrahedra must share a full face.

Partitioning Algorithm

ptype
string
default:"kway"
Selects the k-way partitioning scheme.
ValueDescription
kwayDirect k-way partitioning (default)
rbRecursive bisection
-contig, -minconn, and -objtype=vol are only valid with ptype=kway and will cause an error if combined with ptype=rb.
objtype
string
default:"cut"
Objective function to optimize. Applies only when -ptype=kway.
ValueDescription
cutMinimize the total edge-cut (default)
volMinimize the total communication volume

Coarsening

ctype
string
default:"shem"
Vertex matching scheme for graph coarsening.
ValueDescription
shemSorted heavy-edge matching (default)
rmRandom matching

Initial Partitioning

iptype
string
default:"grow"
Initial partitioning scheme. Applies only when -ptype=rb.
ValueDescription
growGreedy growth bisection (default)
randomRandom bisection

Refinement

niter
integer
default:"10"
Number of refinement iterations at each uncoarsening level.
ncuts
integer
default:"1"
Number of independent partitionings to compute; the one with the best objective value is retained.

Load Balance

ufactor
integer
Maximum allowed load imbalance, expressed as integer x meaning 1 + x/1000 tolerance.
  • ptype=rb default: x=1 → tolerance 1.001
  • ptype=kway default: x=30 → tolerance 1.030
tpwgts
string
Path to a file specifying target partition weights. Each line contains a floating-point weight for one partition; weights must sum to 1.0. By default all partitions have equal weight.

Partition Quality Constraints

contig
flag
Requires that the partitioning produce contiguous (connected) partitions. Only valid with -ptype=kway. Silently ignored if the graph is disconnected.
minconn
flag
Minimizes the maximum degree of the subdomain connectivity graph to reduce the number of neighboring partitions each partition must communicate with. Only valid with -ptype=kway.

I/O and Diagnostics

nooutput
flag
Suppresses writing the .epart and .npart output files.
seed
integer
default:"-1"
Seed for the random number generator. Use a fixed value for reproducible results.
dbglvl
integer
default:"0"
Debug verbosity level. Set to 0 for no debug output (default).

Build docs developers (and LLMs) love