machine_topology Class Reference#
|
Reference API
|
#include <ginkgo/core/base/machine_topology.hpp>
Public Member Functions | |
| void | bind_to_cores (const std::vector< int > &ids, const bool singlify=true) const |
| void | bind_to_core (const int &id) const |
| void | bind_to_pus (const std::vector< int > &ids, const bool singlify=true) const |
| void | bind_to_pu (const int &id) const |
| const normal_obj_info * | get_pu (size_type id) const |
| const normal_obj_info * | get_core (size_type id) const |
| const io_obj_info * | get_pci_device (size_type id) const |
| const io_obj_info * | get_pci_device (const std::string &pci_bus_id) const |
| size_type | get_num_pus () const |
| size_type | get_num_cores () const |
| size_type | get_num_pci_devices () const |
| size_type | get_num_numas () const |
| 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 () |
Detailed Description
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.
- Note
- A global object of machine_topology type is created in a thread safe manner and only destroyed at the end of the program. This means that any subsequent queries will be from the same global object and hence use an extra atomic read.
Member Function Documentation
◆ bind_to_core()
|
inline |
Bind to a single core
- Parameters
-
ids The ids of the core to be bound to the calling process.
References bind_to_cores(), and get_instance().
◆ bind_to_cores()
|
inline |
Bind the calling process to the CPU cores associated with the ids.
- Parameters
-
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
Referenced by bind_to_core().
◆ bind_to_pu()
|
inline |
Bind to a Processing unit (PU)
- Parameters
-
ids The ids of PUs to be bound to the calling process.
References bind_to_pus(), and get_instance().
◆ bind_to_pus()
|
inline |
Bind the calling process to PUs associated with the ids.
- Parameters
-
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
Referenced by bind_to_pu().
◆ get_core()
|
inline |
Get the object of type core associated with the id.
- Parameters
-
id The id of the core
- Returns
- the core object struct.
◆ get_instance()
|
inlinestatic |
Returns an instance of the machine_topology object.
- Returns
- the machine_topology instance
Referenced by bind_to_core(), and bind_to_pu().
◆ get_num_cores()
|
inline |
Get the number of core objects stored in this Topology tree.
- Returns
- the number of cores.
◆ get_num_numas()
|
inline |
Get the number of NUMA objects stored in this Topology tree.
- Returns
- the number of NUMA objects.
◆ get_num_pci_devices()
|
inline |
Get the number of PCI device objects stored in this Topology tree.
- Returns
- the number of PCI devices.
◆ get_num_pus()
|
inline |
Get the number of PU objects stored in this Topology tree.
- Returns
- the number of PUs.
◆ get_pci_device() [1/2]
| const io_obj_info * gko::machine_topology::get_pci_device | ( | const std::string & | pci_bus_id | ) | const |
Get the object of type pci device associated with the PCI bus id.
- Parameters
-
pci_bus_id The PCI bus id of the pci device
- Returns
- the PCI object struct.
◆ get_pci_device() [2/2]
|
inline |
Get the object of type pci device associated with the id.
- Parameters
-
id The id of the pci device
- Returns
- the PCI object struct.
◆ get_pu()
|
inline |
Get the object of type PU associated with the id.
- Parameters
-
id The id of the PU
- Returns
- the PU object struct.
The documentation for this class was generated from the following file:
- ginkgo/core/base/machine_topology.hpp
Generated by