![]() |
Ginkgo Generated from branch based on master. Ginkgo version 1.7.0
A numerical linear algebra library targeting many-core architectures
|
The machine topology class represents the hierarchical topology of a machine, including NUMA nodes, cores and PCI Devices. More...
#include <ginkgo/core/base/machine_topology.hpp>
Public Member Functions | |
void | bind_to_cores (const std::vector< int > &ids, const bool singlify=true) const |
Bind the calling process to the CPU cores associated with the ids. | |
void | bind_to_core (const int &id) const |
Bind to a single core. | |
void | bind_to_pus (const std::vector< int > &ids, const bool singlify=true) const |
Bind the calling process to PUs associated with the ids. | |
void | bind_to_pu (const int &id) const |
Bind to a Processing unit (PU) | |
const normal_obj_info * | get_pu (size_type id) const |
Get the object of type PU associated with the id. | |
const normal_obj_info * | get_core (size_type id) const |
Get the object of type core associated with the id. | |
const io_obj_info * | get_pci_device (size_type id) const |
Get the object of type pci device associated with the id. | |
const io_obj_info * | get_pci_device (const std::string &pci_bus_id) const |
Get the object of type pci device associated with the PCI bus id. | |
size_type | get_num_pus () const |
Get the number of PU objects stored in this Topology tree. | |
size_type | get_num_cores () const |
Get the number of core objects stored in this Topology tree. | |
size_type | get_num_pci_devices () const |
Get the number of PCI device objects stored in this Topology tree. | |
size_type | get_num_numas () const |
Get the number of NUMA objects stored in this Topology tree. | |
void | hwloc_binding_helper (const std::vector< machine_topology::normal_obj_info > &obj, const std::vector< int > &ids, const bool singlify=true) const |
void | load_objects (hwloc_obj_type_t type, std::vector< normal_obj_info > &objects) const |
void | load_objects (hwloc_obj_type_t type, std::vector< io_obj_info > &vector) const |
int | get_obj_id_by_os_index (const std::vector< normal_obj_info > &objects, size_type os_index) const |
int | get_obj_id_by_gp_index (const std::vector< normal_obj_info > &objects, size_type gp_index) const |
Static Public Member Functions | |
static machine_topology * | get_instance () |
Returns an instance of the machine_topology object. | |
The machine topology class represents the hierarchical topology of a machine, including NUMA nodes, cores and PCI Devices.
Various information of the machine are gathered with the help of the Hardware Locality library (hwloc).
This class also provides functionalities to bind objects in the topology to the execution objects. Binding can enhance performance by allowing data to be closer to the executing object.
See the hwloc documentation (https://www.open-mpi.org/projects/hwloc/doc/) for more detailed information on topology detection and binding interfaces.
Bind to a single core.
ids | The ids of the core to be bound to the calling process. |
References bind_to_cores(), and get_instance().
|
inline |
Bind the calling process to the CPU cores associated with the ids.
ids | The ids of cores to be bound. |
singlify | The ids of PUs are singlified to prevent possibly expensive migrations by the OS. This means that the binding is performed for only one of the ids in the set of ids passed in. See hwloc doc for singlify |
References gko::one().
Referenced by bind_to_core().
Bind to a Processing unit (PU)
ids | The ids of PUs to be bound to the calling process. |
References bind_to_pus(), and get_instance().
|
inline |
Bind the calling process to PUs associated with the ids.
ids | The ids of PUs to be bound. |
singlify | The ids of PUs are singlified to prevent possibly expensive migrations by the OS. This means that the binding is performed for only one of the ids in the set of ids passed in. See hwloc doc for singlify |
References gko::one().
Referenced by bind_to_pu().
Get the object of type core associated with the id.
id | The id of the core |
References gko::one().
|
inlinestatic |
Returns an instance of the machine_topology object.
References gko::one().
Referenced by bind_to_core(), and bind_to_pu().
|
inline |
Get the number of core objects stored in this Topology tree.
|
inline |
Get the number of NUMA objects stored in this Topology tree.
|
inline |
Get the number of PCI device objects stored in this Topology tree.
|
inline |
Get the number of PU objects stored in this Topology tree.
Get the object of type pci device associated with the PCI bus id.
pci_bus_id | The PCI bus id of the pci device |
Get the object of type pci device associated with the id.
id | The id of the pci device |
References gko::one().
Get the object of type PU associated with the id.
id | The id of the PU |
References gko::one().