Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Attributes
gmx::HardwareTopology::Machine Struct Reference

#include <gromacs/hardware/hardwaretopology.h>

+ Collaboration diagram for gmx::HardwareTopology::Machine:

Description

Hardware topology information about the entire machine.

The machine structure is a tree with top-down information about all packages, cores, and processing units in the system. For example, an operating system logical processor index can be found as machine.packages[0].cores[2].processingUnits[1].osId. In some cases you might need the opposite lookup, i.e. the processing unit Id on the topology from the OS-assigned Id. This is present in the map osIdToPuId, provided we have sufficient support level.

It can happen that our process is only allowed to run on a subset of processors, e.g. because we are running in a container or because some cores are reserved for management, which complicates core detection a bit. In this case, the hardware topology will only list the PUs on which we are allowed to run, meaning it might look quite unbalanced.

First, remember that you must consider the supportLevel before using data in this class.

Note
Never use the size of the logicalProcessors vector to decide how many threads to start, but consult maxThreads().
If you use cpu sets or other ways to decide what processors to run on, such OS-provided functions always refer to the osId of the processing unit.

Public Attributes

std::vector< LogicalProcessorlogicalProcessors
 Logical processing unit info, indexed by PU Ids in vector.
 
std::map< int, int > osIdToPuId
 Map from OS to topology processing unit ids.
 
std::vector< Packagepackages
 All the packages in the system.
 
std::vector< Cachecaches
 Caches in increasing level order.
 
Numa numa
 Structure with all numa information.
 
std::vector< Devicedevices
 Devices on PCI bus.
 

The documentation for this struct was generated from the following files: