hwloc

Software name: 
hwloc
Policy 

hwloc is freely available to users of HPC2N.

General 

The Portable Hardware Locality (hwloc) software package provides a portable abstraction (across OS, versions, architectures, ...) of the hierarchical topology of modern architectures, including NUMA memory nodes, sockets, shared caches, cores and simultaneous multithreading.

It also gathers various system attributes such as cache and memory information as well as the locality of I/O devices such as network interfaces, InfiniBand HCAs or GPUs.

Description 

The Portable Hardware Locality (hwloc) software package provides a portable abstraction (across OS, versions, architectures, ...) of the hierarchical topology of modern architectures, including NUMA memory nodes, sockets, shared caches, cores and simultaneous multithreading. It also gathers various system attributes such as cache and memory information as well as the locality of I/O devices such as network interfaces, InfiniBand HCAs or GPUs.

hwloc primarily aims at helping applications with gathering information about increasingly complex parallel computing platforms so as to exploit them accordingly and efficiently. For instance, two tasks that tightly cooperate should probably be placed onto cores sharing a cache. However, two independent memory-intensive tasks should better be spread out onto different sockets so as to maximize their memory throughput. As described in this paper, OpenMP threads have to be placed according to their affinities and to the hardware characteristics. MPI implementations apply similar techniques while also adapting their communication strategies to the network locality as described in this paper or this one.

hwloc may also help many applications just by providing a portable CPU and memory binding API and a reliable way to find out how many cores and/or hardware threads are available.

Availability 

On HPC2N we have hwloc available as a module on Kebnekaise.

Usage at HPC2N 

To use the hwloc module, first add it to your environment. Use:

module spider hwloc

to see which versions are available and how to load the module and the needed prerequisites.

Example, loading hwloc version 1.11.5

ml GCC/6.3.0-2.27
ml hwloc/1.11.5

You can read more about loading modules on our Accessing software with Lmod page and our Using modules (Lmod) page.

Usage examples

Getting node architecture is done with the "lstopo" tool:

lstopo [ options ] ... [ filename.format ]

Do

lstopo --help

for things like output format and formatting options and

man lstopo

for more details.

Some useful flags:

  • --logical Display hwloc logical object indexes (default for console output)
  • --physical Display physical object indexes (default for graphical output)
  • --output-format [default | console | ascii | fig | pdf | ps | png | svg | synthetic | xml]
  • -v verbose (include additional detail)

Example, verbose output as text:

lstopo --output-format console -v 

Example, verbose output as graphics, to a file in svg format:

lstopo --output-format svg -v > <filename>

Output for Kebnekaise compute node

Additional info 

More information can be found at the below locations:

Updated: 2024-11-01, 13:56