Gromacs  2016.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions
gmx::HardwareTopology Class Reference

#include <gromacs/hardware/hardwaretopology.h>

Description

Information about sockets, cores, threads, numa, caches.

This class is the main GROMACS interface to provide information about the hardware of the system we are running on. Internally, it uses either hwloc for full or almost-full information, or a fallback implementation that relies on CpuInfo on x86.

You should always use this class (rather than CpuInfo directly) to query the hardware layout in user code. Note that you cannot rely on any information being present, but you must check with the supportLevel() method before trying to access any information.

Classes

struct  Cache
 Information about a single cache level. More...
 
struct  Core
 Information about a single core in a socket. More...
 
struct  Device
 Information about a single PCI device. More...
 
struct  HWThread
 Information about a single hardware thread in a core. More...
 
struct  LogicalProcessor
 Information about socket, core and hwthread for a logical processor. More...
 
struct  Machine
 Hardware topology information about the entire machine. More...
 
struct  Numa
 Information about a single numa node. More...
 
struct  NumaNode
 Information about each numa node in system. More...
 
struct  Socket
 Information about a single socket in the system. More...
 

Public Types

enum  SupportLevel {
  SupportLevel::None, SupportLevel::LogicalProcessorCount, SupportLevel::Basic, SupportLevel::Full,
  SupportLevel::FullWithDevices
}
 Amount of topology information present (incremental) More...
 

Public Member Functions

SupportLevel supportLevel () const
 Check what topology information that is available and valid. More...
 
bool isThisSystem () const
 Return true if we actually detected hardware. More...
 
const Machinemachine () const
 Return the machine topology tree. More...
 
int numberOfCores () const
 Returns the number of cores. More...
 

Static Public Member Functions

static HardwareTopology detect ()
 Detects the hardware topology.
 

Member Enumeration Documentation

Amount of topology information present (incremental)

Enumerator
None 

No hardware information whatsoever. Sorry.

LogicalProcessorCount 

Only machine().logicalProcessorCount is valid.

Basic 

Socket, core and hardware thread info.

Full 

Cache, memory and numa node info.

FullWithDevices 

Information about devices on the PCI bus.

Member Function Documentation

bool gmx::HardwareTopology::isThisSystem ( ) const
inline

Return true if we actually detected hardware.

Returns
This method will normally return true, when we actually ran the hardware detection as part of this process to construct the object. It will be false when the object was constructed by reading a cached XML file, or possibly generated from synthetic data.
const Machine& gmx::HardwareTopology::machine ( ) const
inline

Return the machine topology tree.

You can always call this routine, but be aware that some or all contents will not be valid unless supportLevel() returns a sufficient level.

While data that is not valid has been initialized to special values, you should not rely on those but query the supportLevel() method before accessing it.

int gmx::HardwareTopology::numberOfCores ( ) const

Returns the number of cores.

You can always call this routine, but if sufficient support is not available, it may return the logical processor count or zero instead of the physical core count.

SupportLevel gmx::HardwareTopology::supportLevel ( ) const
inline

Check what topology information that is available and valid.

The amount of hardware topology information that can be detected depends on both the hardware and whether GROMACS was linked with the external hwloc library. You cannot assume that any information is present, although we can almost always provide the number of logical processors. On x86 we can usually get basic information about how sockets, cores and hardware threads are ordered even without hwloc. With the hwloc library we can usually also get information about cache, memory and concepts such as core groups and ccNUMA nodes. Finally, if hwloc was built with support for libpci we can also detect how the PCI devices are connected.


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