Hardware Locality

Hardware Locality

Maps CPU topology, caches and NUMA layout

Description

For parallel computing or server tuning, "this machine has 64 cores" is nowhere near enough: which cores share an L3, which belong to the same NUMA node, which PCI domain the network card sits under — those determine where threads should be pinned, and getting it wrong sends memory access across nodes at a real cost. Hardware Locality (hwloc) draws that structure as a topology tree: machine, NUMA nodes and CPU packages down through L3/L2/L1 caches to physical cores and hardware threads, with GPUs and network cards shown on the branch they actually hang from.

A subproject of Open MPI, it is a C library plus a handful of command-line tools. lstopo renders the topology as terminal text, a graphical window or an exported image; hwloc-bind pins processes and threads to specific cores or NUMA nodes; hwloc-calc converts between topology objects. MPI implementations, OpenMP runtimes and several schedulers use it underneath.

Cross-platform across Linux, Windows, macOS, the BSDs and Solaris, with a prebuilt Windows zip that runs from the folder. BSD licensed.

Features



Topology visualization: lstopo draws the full hierarchy — NUMA nodes, packages, L3/L2/L1 caches, physical cores and hyperthreads — making shared resources visible at a glance.

Multiple output formats: a text tree in the terminal, a graphical window, or export to PNG, SVG, PDF or XML, the last being how a remote machine's topology gets analyzed locally.

I/O device placement: GPUs, network cards, InfiniBand adapters and NVMe devices appear on the tree under the NUMA node they attach to, which is what makes device affinity decisions possible.

Process and thread binding: hwloc-bind pins a process or thread to chosen cores, packages or NUMA nodes and controls which node its memory is allocated from.

Topology calculations: hwloc-calc and hwloc-distances convert between CPU sets, object indexes and physical numbering, so scheduling scripts need not parse numbering rules by hand.

C API: the core is a portable C library that programs query at runtime to decide thread placement — the mechanism MPI and OpenMP implementations rely on.

Consistent across platforms: the same abstraction on Linux, Windows, macOS, FreeBSD/NetBSD, Solaris and AIX, so detection code is not rewritten per system.

No installer: the Windows distribution is a prebuilt zip with lstopo and the other executables in its bin directory.

BSD licensed: permissively open source and free to integrate into commercial software.