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.

METIS is a C library built from source using CMake. The top-level Makefile acts as a proxy that translates make config options into CMake flags, runs CMake inside a build/ directory, and then delegates all subsequent make targets to the generated build system. Before you can build METIS you must install its required external dependency, GKlib, as well as a C compiler and CMake.

System requirements

You need the following tools installed before proceeding:
  • GCC (or another C99-compatible compiler)
  • CMake 3.10 or later
  • Make
  • Git
On Debian/Ubuntu systems, install the build tools with:
sudo apt-get install build-essential
GKlib is a required external dependency that is not bundled with METIS. You must clone and install it separately before configuring METIS. Follow the instructions at github.com/KarypisLab/GKlib.

Installation

1

Install GKlib

Clone GKlib and install it to a local prefix. The default prefix used by both GKlib and METIS is ~/local.
git clone https://github.com/KarypisLab/GKlib.git
cd GKlib
make config prefix=~/local
make install
If you install GKlib to a different path, note it — you will need to pass it to METIS via gklib_path.
2

Clone METIS

Clone the METIS repository from GitHub:
git clone https://github.com/KarypisLab/METIS.git
cd METIS
3

Configure the build

Run make config with your desired options. This step creates the build/ directory, writes type-width headers, and runs CMake.
make config shared=1 cc=gcc prefix=~/local
If you installed GKlib to a prefix other than ~/local, pass it explicitly:
make config prefix=~/local gklib_path=/path/to/gklib
See the configuration options section below for the full list of available flags.
4

Build and install

Compile METIS and install the binaries, headers, and library:
make install
After installation, the following files will be placed under your prefix:
PathContents
<prefix>/binCLI executables: gpmetis, ndmetis, mpmetis, m2gmetis, graphchk, cmpfillin
<prefix>/includePublic header: metis.h
<prefix>/libStatic or shared library: libmetis.a / libmetis.so
5

Verify the installation

Confirm the tools are available:
gpmetis --help
Or run a quick partition test against a bundled sample graph (from inside the cloned METIS directory):
./build/programs/gpmetis graphs/4elt.graph 4

Configuration options

All options are passed to make config as key=value pairs. Running make config always triggers make distclean first, so it is safe to re-run with different options.

Build options

OptionDescriptionDefault
cc=<compiler>The C compiler to useDetermined by CMake
shared=1Build a shared library (.so/.dylib) instead of a static archive (.a)Off (static)
prefix=<path>Installation prefix for bin/, include/, and lib/~/local
gklib_path=<path>Path to the GKlib installation prefix. Omit if GKlib and METIS share the same prefix~/local
i64=1Use 64-bit integers for idx_t (vertex and adjacency data). Required when vertex count or total edge count exceeds 2^31−1Off (32-bit)
r64=1Use 64-bit doubles for real_t (floating-point weights). Enables double-precision arithmetic throughoutOff (32-bit float)

Debug options

These options are intended for development and debugging. They should not be used in production builds.
OptionDescriptionDefault
gdb=1Compile with GDB debug symbols (-g)Off
debug=1Enable debug mode, disables compiler optimizationsOff
assert=1Enable standard assertion checks throughout the libraryOff
assert2=1Enable expensive (performance-impacting) assertions for deep correctness checkingOff
A typical debug build combining all options:
make config debug=1 assert=1 gdb=1 prefix=~/local

Other make commands

Once METIS has been configured, the following commands are available:
CommandDescription
make installBuild and install METIS to the configured prefix
make uninstallRemove all files installed by make install (reads build/install_manifest.txt)
make cleanRemove compiled object files while retaining the CMake configuration in build/
make distcleanRemove the entire build/ directory, including all configuration and object files

Build docs developers (and LLMs) love