/home/runner/work/HiCR/HiCR/include/hicr/backends/hwloc/computeResource.hpp Source File
HiCR
|
computeResource.hpp
Go to the documentation of this file.
114 __INLINE__ physicalProcessorId_t getPhysicalProcessorId() const { return _physicalProcessorId; }
124 __INLINE__ static void detectThreadPUs(hwloc_topology_t topology, hwloc_obj_t obj, int depth, std::vector<logicalProcessorId_t> &threadPUs)
127 for (unsigned int i = 0; i < obj->arity; i++) detectThreadPUs(topology, obj->children[i], depth + 1, threadPUs);
137 __INLINE__ static physicalProcessorId_t detectPhysicalProcessorId(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
140 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%lu) in this backend", logicalProcessorId);
143 // There is an asumption here that a HWLOC_OBJ_PU type always has a parent of type HWLOC_OBJ_CORE,
146 if (obj->type != HWLOC_OBJ_CORE) HICR_THROW_RUNTIME("Unexpected hwloc object type while trying to access Core/CPU (%lu)", logicalProcessorId);
158 __INLINE__ static numaAffinity_t detectCoreNUMAffinity(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
163 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%lu) in this backend", logicalProcessorId);
183 if (hwloc_obj_type_is_memory(nodeNUMA->type) && hwloc_bitmap_isset(obj->nodeset, nodeNUMA->os_index))
191 if (!found) HICR_THROW_RUNTIME("NUMA Domain not detected for compute resource (%lu)", logicalProcessorId);
210 __INLINE__ static std::unordered_set<std::shared_ptr<backend::hwloc::Cache>> detectCpuCaches(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
215 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%lu) in this backend", logicalProcessorId);
227 if (cache->type == HWLOC_OBJ_L1CACHE || cache->type == HWLOC_OBJ_L2CACHE || cache->type == HWLOC_OBJ_L3CACHE || cache->type == HWLOC_OBJ_L4CACHE ||
279 __INLINE__ static numaAffinity_t getCpuNumaAffinity(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
284 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%lu) in this backend", logicalProcessorId);
304 if (hwloc_obj_type_is_memory(nodeNUMA->type) && hwloc_bitmap_isset(obj->nodeset, nodeNUMA->os_index))
312 if (found == false) HICR_THROW_RUNTIME("NUMA Domain not detected for compute resource (%lu)", logicalProcessorId);
335 if (_type != "Processing Unit") HICR_THROW_LOGIC("The passed compute resource type '%s' is not compatible with this topology manager", _type.c_str());
338 if (input.contains(key) == false) HICR_THROW_LOGIC("The serialized object contains no '%s' key", key.c_str());
339 if (input[key].is_number() == false) HICR_THROW_LOGIC("The '%s' entry is not a number", key.c_str());
343 if (input.contains(key) == false) HICR_THROW_LOGIC("The serialized object contains no '%s' key", key.c_str());
344 if (input[key].is_number() == false) HICR_THROW_LOGIC("The '%s' entry is not a number", key.c_str());
348 if (input.contains(key) == false) HICR_THROW_LOGIC("The serialized object contains no '%s' key", key.c_str());
349 if (input[key].is_number() == false) HICR_THROW_LOGIC("The '%s' entry is not a number", key.c_str());
353 if (input.contains(key) == false) HICR_THROW_LOGIC("The serialized object contains no '%s' key", key.c_str());
354 if (input[key].is_array() == false) HICR_THROW_LOGIC("The '%s' entry is not an array", key.c_str());
Defines the Cache class for interacting with the host (CPUs) device type.
Definition computeResource.hpp:40
Definition computeResource.hpp:41
__INLINE__ void serializeImpl(nlohmann::json &output) const override
Definition computeResource.hpp:319
__INLINE__ void deserializeImpl(const nlohmann::json &input) override
Definition computeResource.hpp:332
ComputeResource(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
Definition computeResource.hpp:64
unsigned int logicalProcessorId_t
Definition computeResource.hpp:47
static __INLINE__ physicalProcessorId_t detectPhysicalProcessorId(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
Definition computeResource.hpp:137
static __INLINE__ std::unordered_set< std::shared_ptr< backend::hwloc::Cache > > detectCpuCaches(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
Definition computeResource.hpp:210
unsigned int numaAffinity_t
Definition computeResource.hpp:57
ComputeResource()
Definition computeResource.hpp:99
unsigned int physicalProcessorId_t
Definition computeResource.hpp:52
ComputeResource(const logicalProcessorId_t logicalProcessorId, const physicalProcessorId_t physicalProcessorId, const numaAffinity_t numaAffinity, std::unordered_set< std::shared_ptr< backend::hwloc::Cache > > caches)
Definition computeResource.hpp:81
static __INLINE__ numaAffinity_t detectCoreNUMAffinity(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
Definition computeResource.hpp:158
__INLINE__ logicalProcessorId_t getProcessorId() const
Definition computeResource.hpp:106
__INLINE__ physicalProcessorId_t getPhysicalProcessorId() const
Definition computeResource.hpp:114
static __INLINE__ numaAffinity_t getCpuNumaAffinity(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
Definition computeResource.hpp:279
~ComputeResource() override=default
static __INLINE__ void detectThreadPUs(hwloc_topology_t topology, hwloc_obj_t obj, int depth, std::vector< logicalProcessorId_t > &threadPUs)
Definition computeResource.hpp:124
Provides a base definition for a HiCR ComputeResource class.
Provides a failure model and corresponding exception classes.
Generated by