ComputeResource Class Reference
HiCR
|
#include <computeResource.hpp>

Public Types | |
using | logicalProcessorId_t = unsigned int |
using | physicalProcessorId_t = unsigned int |
using | numaAffinity_t = unsigned int |
Public Member Functions | |
ComputeResource (hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId) | |
ComputeResource (const logicalProcessorId_t logicalProcessorId, const physicalProcessorId_t physicalProcessorId, const numaAffinity_t numaAffinity, std::unordered_set< std::shared_ptr< backend::hwloc::Cache > > caches) | |
~ComputeResource () override=default | |
ComputeResource ()=default | |
__INLINE__ std::string | getType () const override |
__INLINE__ logicalProcessorId_t | getProcessorId () const |
__INLINE__ physicalProcessorId_t | getPhysicalProcessorId () const |
ComputeResource (const nlohmann::json &input) | |
![]() | |
__INLINE__ nlohmann::json | serialize () const |
__INLINE__ void | deserialize (const nlohmann::json &input) |
Static Public Member Functions | |
static __INLINE__ void | detectThreadPUs (hwloc_topology_t topology, hwloc_obj_t obj, int depth, std::vector< logicalProcessorId_t > &threadPUs) |
static __INLINE__ physicalProcessorId_t | detectPhysicalProcessorId (hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId) |
static __INLINE__ numaAffinity_t | detectCoreNUMAffinity (hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId) |
static __INLINE__ std::unordered_set< std::shared_ptr< backend::hwloc::Cache > > | detectCpuCaches (hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId) |
static __INLINE__ numaAffinity_t | getCpuNumaAffinity (hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId) |
Protected Member Functions | |
__INLINE__ void | serializeImpl (nlohmann::json &output) const override |
__INLINE__ void | deserializeImpl (const nlohmann::json &input) override |
Detailed Description
This class represents a compute resource, visible by HWLoc. That is, a CPU processing unit (core or hyperthread) with information about caches and locality.
Member Typedef Documentation
◆ logicalProcessorId_t
using HiCR::backend::hwloc::ComputeResource::logicalProcessorId_t = unsigned int |
System-given logical processor (core or hyperthread) identifier that this class instance represents
◆ numaAffinity_t
using HiCR::backend::hwloc::ComputeResource::numaAffinity_t = unsigned int |
System-given NUMA affinity identifier
◆ physicalProcessorId_t
using HiCR::backend::hwloc::ComputeResource::physicalProcessorId_t = unsigned int |
System-given physical processor identifier that this class instance represents
Constructor & Destructor Documentation
◆ ComputeResource() [1/4]
|
inline |
Constructor for the compute resource class of the hwloc backend
- Parameters
-
topology HWLoc topology object for discovery logicalProcessorId Os-determied core affinity assigned to this compute resource
◆ ComputeResource() [2/4]
|
inline |
Constructor for the compute resource class of the hwloc backend
- Parameters
-
[in] logicalProcessorId Unique identifier for the core assigned to this compute resource [in] numaAffinity The NUMA domain associated to this core [in] caches The set of caches contained to or accessible by this core [in] physicalProcessorId The identifier of the physical core as assigned by the OS
◆ ~ComputeResource()
|
overridevirtualdefault |
Default destructor
Reimplemented from HiCR::ComputeResource.
◆ ComputeResource() [3/4]
|
default |
Default constructor for serialization/deserialization purposes
◆ ComputeResource() [4/4]
|
inline |
Deserializing constructor
The instance created will contain all information, if successful in deserializing it, corresponding to the passed processing unit This instance should NOT be used for anything else than reporting/printing the contained resources
- Parameters
-
[in] input A JSON-encoded serialized processing unit information
Member Function Documentation
◆ deserializeImpl()
|
inlineoverrideprotectedvirtual |
Backend-specific implementation of the deserialize function
- Parameters
-
[in] input Serialized compute resource information corresponding to the specific backend's topology manager
Implements HiCR::ComputeResource.
◆ detectCoreNUMAffinity()
|
inlinestatic |
Uses HWloc to discover the NUMA node associated with a given logical processor ID
- Parameters
-
[in] topology An HWLoc topology object, already initialized [in] logicalProcessorId The ID of the processor we are doing the search for
- Returns
- The ID of the associated memory space
◆ detectCpuCaches()
|
inlinestatic |
Uses HWloc to discover all caches associated with a given logical processor ID
- Parameters
-
[in] topology An HWLoc topology object, already initialized [in] logicalProcessorId The logical ID of the processor we are doing the search for
- Returns
- A vector of (type,size) entries, where type is a string describing the cache and size is the respective size in Bytes The 'type' string is has the following form: "Level <I/D/U> <P/S> <associated IDs>", where: Level: may be "L1", "L2, "L3" I/D/U: may be "Instruction", "Data", "Unified" P/S: may be "Private" or "Shared" associated IDs: (optional, for Shared cache) a list of core IDs, e.g. "0 1 2 3"
◆ detectPhysicalProcessorId()
|
inlinestatic |
Uses HWloc to discover the (physical) processor ID, associated with a given logical processor ID
- Parameters
-
[in] topology An HWLoc topology object, already initialized [in] logicalProcessorId The logical ID of the processor we are doing the search for
- Returns
- The ID of the associated physical identifier related to the passed logical processor id
◆ detectThreadPUs()
|
inlinestatic |
Uses HWloc to recursively (tree-like) identify the host's basic processing units (PUs)
- Parameters
-
[in] topology An HWLoc topology object, already initialized [in] obj The root HWLoc object for the start of the exploration tree at every recursion level [in] depth Stores the current exploration depth level, necessary to return only the processing units at the leaf level [out] threadPUs Storage for the found procesing units
◆ getCpuNumaAffinity()
|
inlinestatic |
Uses HWloc to discover the NUMA node associated with a given logical processor ID
- Parameters
-
[in] topology HWLoc topology object [in] logicalProcessorId The ID of the processor we are doing the search for
- Returns
- The ID of the associated memory space
◆ getPhysicalProcessorId()
|
inline |
Obtains the Core ID of the CPU; in non SMT systems that will be the actual id; in SMT it is the id of the actual core the thread belongs to.
- Returns
- The physical ID of the hardware Core
◆ getProcessorId()
|
inline |
Function to return the compute resource processor id
- Returns
- The processor id
◆ getType()
|
inlineoverridevirtual |
Indicates what type of compute unit is contained in this instance
- Returns
- A string containing a human-readable description of the compute resource type
Implements HiCR::ComputeResource.
◆ serializeImpl()
|
inlineoverrideprotectedvirtual |
Backend-specific implemtation of the serialize function that allows adding more information than the one provided by default by HiCR
- Parameters
-
[out] output JSON-formatted serialized compute resource information
Implements HiCR::ComputeResource.
The documentation for this class was generated from the following file:
- /home/runner/work/HiCR/HiCR/include/hicr/backends/hwloc/computeResource.hpp
Generated by